/* ==========================================================================
   A2ZCALCULATE.COM - BLACK & WHITE MINIMALIST DESIGN SYSTEM
   ========================================================================== */

:root {
  --bg-body: #ffffff;
  --bg-card: #ffffff;
  --text-main: #000000;
  --text-muted: #555555;
  --border: #000000;
  --color-investment: #2563eb;
  --color-returns: #16a34a;
  --color-maturity: #7c3aed;
  --font-mono: ui-monospace, Consolas, "Courier New", monospace;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-body: #0a0a0a;
    --bg-card: #121212;
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --border: #ffffff;
    --color-investment: #60a5fa;
    --color-returns: #4ade80;
    --color-maturity: #c084fc;
  }
}

/* --------------------------------------------------------------------------
   1. RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   2. TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6,
.brand-logo,
.mono-font,
.breadcrumb,
.result-val,
.nav-links a,
.footer-links a,
.tag-btn,
.btn-black,
.submit-btn,
.form-label,
.form-control,
.form-input,
.form-textarea {
  font-family: var(--font-mono);
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

a {
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   3. LAYOUT & CONTAINERS
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-main {
  flex: 1;
  padding: 2rem 0;
}

.tool-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}

.tool-main-col {
  min-width: 0;
}

.sticky-sidebar {
  position: sticky;
  top: 1rem;
}

@media (max-width: 850px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   4. HEADER & FOOTER
   -------------------------------------------------------------------------- */
.header-nav {
  border-bottom: 2px solid var(--border);
  padding: 1rem 0;
  background: var(--bg-body);
}

.header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand-logo {
  font-size: 1.4rem;
  font-weight: 900;
  text-decoration: none;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.brand-logo:hover {
  text-decoration: none;
  opacity: 0.85;
}

.header-search {
  max-width: 260px;
  width: 100%;
}

.nav-links,
.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a,
.footer-links a {
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 600;
  color: var(--text-main);
}

.nav-links a:hover,
.footer-links a:hover {
  text-decoration: underline;
}

footer {
  border-top: 2px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
  background: var(--bg-body);
}

.footer-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   5. CARDS & GRID COMPONENTS
   -------------------------------------------------------------------------- */
.bw-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 1.5rem;
  text-decoration: none;
  display: block;
  color: var(--text-main);
  transition: background 0.2s ease, color 0.2s ease;
}

.bw-card:hover {
  background: var(--text-main);
  color: var(--bg-body);
}

.bw-card:hover * {
  color: var(--bg-body) !important;
  border-color: var(--bg-body) !important;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   6. FORM CONTROLS & BUTTONS
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-main);
}

.form-control,
.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--text-main);
  background: var(--bg-body);
  border: 2px solid var(--border);
  border-radius: 0;
  outline: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.form-control-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
}

.form-control:focus,
.form-input:focus,
.form-textarea:focus {
  background: var(--text-main);
  color: var(--bg-body);
}

.btn-black,
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bg-body);
  background: var(--text-main);
  border: 2px solid var(--text-main);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  width: 100%;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-black:hover,
.submit-btn:hover {
  background: var(--bg-body);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-black:disabled,
.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Category Filter Tags */
.tags-flex {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
  align-items: center;
}

.tag-btn {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--bg-body);
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tag-btn:hover,
.tag-btn.active {
  background: var(--text-main);
  color: var(--bg-body);
}

.case-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.case-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  min-height: 48px;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--bg-body);
  color: var(--text-main);
  cursor: pointer;
  text-align: center;
  user-select: none;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
  width: 100%;
}

.case-action-btn:hover {
  background: var(--text-main);
  color: var(--bg-body);
  box-shadow: 3px 3px 0px var(--border);
}

.case-action-btn:active,
.case-action-btn.active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px var(--border);
  background: var(--text-main);
  color: var(--bg-body);
}

/* --------------------------------------------------------------------------
   7. BREADCRUMBS & OUTPUT DISPLAY
   -------------------------------------------------------------------------- */
.breadcrumbs,
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  text-transform: lowercase;
  padding: 0;
}

.breadcrumbs li,
.breadcrumb li {
  display: inline-flex;
  align-items: center;
}

.breadcrumbs li + li::before,
.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--text-muted);
}

.breadcrumbs a,
.breadcrumb a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumbs a:hover,
.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumbs span,
.breadcrumb span {
  color: var(--text-muted);
}

.result-box {
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.1rem;
  margin: 1.5rem 0;
  background: var(--bg-card);
  color: var(--text-main);
}

.result-val {
  font-size: 1.75rem;
  display: block;
  margin-top: 0.4rem;
  font-weight: 900;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   8. ADSENSE SAFEGUARDING (CLS PROTECTION)
   -------------------------------------------------------------------------- */
.ad-slot-leaderboard,
.ad-slot-sidebar,
.ad-slot-infeed {
  background: rgba(128, 128, 128, 0.05);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

.ad-slot-leaderboard {
  min-height: 90px;
  margin: 1rem 0;
}

.ad-slot-sidebar {
  min-height: 280px;
  margin-bottom: 1.5rem;
}

.ad-slot-infeed {
  min-height: 120px;
  margin: 1.5rem 0;
}

/* --------------------------------------------------------------------------
   9. PROSE & ARTICLE STYLES
   -------------------------------------------------------------------------- */
.seo-article {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.prose p {
  margin-bottom: 1.25rem;
  line-height: 1.7;
  color: var(--text-main);
}

.prose h2 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.prose ul, .prose ol {
  margin-left: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.prose li {
  margin-bottom: 0.4rem;
}