/* ===========================
   NAVIGATION
=========================== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 13, 20, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.nav-brand:hover { color: var(--gold-light); }

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.15rem;
  flex-wrap: nowrap;
}

.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--ink);
  background: rgba(255,255,255,0.06);
}

.nav-links a.active { color: var(--gold); }

body.has-nav { padding-top: calc(56px + 3rem); }

@media (max-width: 560px) {
  .nav-inner { padding: 0 1rem; gap: 1rem; }
  .nav-brand { font-size: 0.9rem; }
  .nav-links a { font-size: 0.75rem; padding: 0.35rem 0.5rem; }
  body.has-nav { padding-top: calc(56px + 2rem); }
}

/* ===========================
   HOMEPAGE
=========================== */
.homepage .page-wrap { max-width: 760px; }

.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.calc-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 2rem 1.8rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  transition: border-color 0.25s, transform 0.2s, box-shadow 0.25s;
  animation: fadeUp 0.6s ease both;
}

.calc-card:hover {
  border-color: rgba(232,201,122,0.3);
  transform: translateY(-3px);
  box-shadow: 0 16px 56px rgba(0,0,0,0.4);
}

.calc-card-icon {
  width: 44px;
  height: 44px;
  background: rgba(232,201,122,0.08);
  border: 1px solid rgba(232,201,122,0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.calc-card-icon svg {
  width: 22px;
  height: 22px;
  color: var(--gold);
}

.calc-card-body { flex: 1; }

.calc-card-body h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 0.55rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.calc-card-body p {
  font-size: 0.86rem;
  color: var(--ink-muted);
  font-weight: 300;
  line-height: 1.65;
  margin: 0;
}

.calc-card-cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: gap 0.2s;
}

.calc-card:hover .calc-card-cta { gap: 0.6rem; }

@media (max-width: 560px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .calc-card { padding: 1.5rem 1.25rem; }
}

/* ===========================
   TOKENS & RESET
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0a0d14;
  --surface:    #111520;
  --surface-2:  #161b28;
  --border:     rgba(255,255,255,0.07);
  --border-2:   rgba(255,255,255,0.12);

  --ink:        #f0f2f8;
  --ink-muted:  #7b8299;
  --ink-dim:    #3d4460;

  --gold:       #e8c97a;
  --gold-light: #f5e0a0;
  --green:      #5cdb95;
  --blue:       #6db3f2;

  --accent:     var(--gold);
  --radius:     14px;
  --radius-sm:  8px;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

html { font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  padding: 3rem 1rem 4rem;
  position: relative;
}

/* ===========================
   BACKGROUND ORBS
=========================== */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
}
.orb-1 { width: 600px; height: 600px; background: #c09a3a; top: -200px; left: -150px; }
.orb-2 { width: 500px; height: 500px; background: #2a3a7a; bottom: -100px; right: -80px; }
.orb-3 { width: 300px; height: 300px; background: #3a6a40; top: 40%; left: 55%; opacity: 0.1; }

/* ===========================
   LAYOUT
=========================== */
.page-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* ===========================
   HEADER
=========================== */
.site-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: fadeUp 0.7s ease both;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(232,201,122,0.35);
  background: rgba(232,201,122,0.07);
  padding: 0.3em 0.9em;
  border-radius: 99px;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.01em;
}
h1 em {
  font-style: italic;
  color: var(--gold);
}

.subtitle {
  max-width: 480px;
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.65;
}

/* ===========================
   CARD
=========================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.04) inset;
  animation: fadeUp 0.7s 0.15s ease both;
}

/* ===========================
   SECTION SHARED
=========================== */
.inputs-section,
.results-section {
  padding: 2rem 2.2rem;
}

.results-section {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1.4rem;
}

/* ===========================
   INPUT FIELDS
=========================== */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 1.4rem;
  margin-bottom: 1.8rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.input-wrap:focus-within {
  border-color: rgba(232,201,122,0.5);
  box-shadow: 0 0 0 3px rgba(232,201,122,0.08);
}

.prefix, .suffix {
  padding: 0 0.75rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
  font-weight: 500;
  user-select: none;
  flex-shrink: 0;
}

input[type="number"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  padding: 0.7rem 0.6rem;
  width: 100%;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

input::placeholder { color: var(--ink-dim); }

/* ===========================
   BUTTON
=========================== */
.calc-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem 1.5rem;
  background: var(--gold);
  color: #0a0d14;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(232,201,122,0.25);
  letter-spacing: 0.02em;
}

.calc-btn:hover {
  background: var(--gold-light);
  box-shadow: 0 6px 28px rgba(232,201,122,0.35);
  transform: translateY(-1px);
}

.calc-btn:active { transform: translateY(0); }

.btn-arrow {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.calc-btn:hover .btn-arrow { transform: translateX(3px); }

/* ===========================
   RESULTS — PLACEHOLDER
=========================== */
.results-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 2rem 0 1rem;
  color: var(--ink-dim);
  text-align: center;
}
.results-placeholder svg {
  width: 52px;
  height: 52px;
  color: var(--ink-dim);
  opacity: 0.5;
}
.results-placeholder p {
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--ink-muted);
}
.results-placeholder strong { font-weight: 500; color: var(--ink); }

/* ===========================
   RESULTS — GRID
=========================== */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1.6rem;
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.3s;
}

.result-card.featured {
  border-color: rgba(232,201,122,0.3);
  background: rgba(232,201,122,0.04);
}

.result-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.result-card.featured .result-label { color: rgba(232,201,122,0.6); }

.result-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--ink);
  line-height: 1.1;
}

.result-card.featured .result-value { color: var(--gold); }

/* ===========================
   BREAKDOWN BAR
=========================== */
.breakdown { margin-top: 0.4rem; }

.breakdown-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.breakdown-bar {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,0.05);
  display: flex;
  overflow: hidden;
}

.bar-segment {
  height: 100%;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.seg-principal    { background: var(--blue); }
.seg-contributions{ background: var(--green); }
.seg-interest     { background: var(--gold); }

.bar-legend {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.bar-legend span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-principal     { background: var(--blue); }
.dot-contributions { background: var(--green); }
.dot-interest      { background: var(--gold); }

/* ===========================
   SEO SECTIONS
=========================== */
.seo-sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.seo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
  animation: fadeUp 0.6s ease both;
}

.seo-card-inner {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0;
}

.seo-icon {
  padding: 2.2rem 0 2rem 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
}

.seo-icon svg {
  width: 26px;
  height: 26px;
  color: var(--gold);
  opacity: 0.7;
  flex-shrink: 0;
}

.seo-card-body {
  padding: 2rem 2.2rem 2rem 1.2rem;
}

.seo-card-body h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--ink);
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.seo-card-body p {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.75;
  margin-bottom: 0.9rem;
}
.seo-card-body p:last-child { margin-bottom: 0; }
.seo-card-body strong { color: var(--ink); font-weight: 500; }

/* --- Formula block --- */
.formula-block {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 1.2rem 1.4rem;
  margin: 1.2rem 0;
  overflow-x: auto;
}

.formula-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.formula-math {
  font-family: 'Georgia', serif;
  font-size: 1.05rem;
  color: var(--gold-light);
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.formula-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  gap: 2px;
  margin: 0 0.15em;
}

.frac-top, .frac-bottom {
  font-size: 0.78em;
  line-height: 1.2;
  color: var(--gold-light);
}

.frac-line {
  width: 100%;
  height: 1px;
  background: var(--gold);
  opacity: 0.5;
}

.formula-key {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 1.1rem 0;
  padding: 0;
}

.formula-key li {
  font-size: 0.86rem;
  color: var(--ink-muted);
  font-weight: 300;
  line-height: 1.5;
  padding-left: 1.1rem;
  position: relative;
}

.formula-key li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.formula-key li strong { color: var(--gold); font-weight: 600; }

/* --- Example table --- */
.example-table-wrap {
  margin: 1.2rem 0;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-2);
}

.example-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.example-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border-2);
}

.example-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}

.example-table td {
  padding: 0.8rem 1rem;
  color: var(--ink-muted);
  font-weight: 300;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

.example-table td.highlight {
  color: var(--ink);
  font-weight: 500;
}

.example-table tr.featured-row td {
  background: rgba(232,201,122,0.05);
  border-top-color: rgba(232,201,122,0.15);
}

.example-table tr.featured-row td.highlight {
  color: var(--gold);
  font-weight: 600;
}

.example-note {
  font-size: 0.75rem !important;
  color: var(--ink-dim) !important;
  font-style: italic;
  margin-top: 1rem !important;
}

/* --- FAQ --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  transition: background 0.2s;
}
.faq-item:last-child { border-bottom: none; }
.faq-item[open] { background: rgba(232,201,122,0.03); }

.faq-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.45;
  user-select: none;
  transition: color 0.2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item[open] summary { color: var(--gold); }

.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--ink-dim);
  line-height: 1;
  flex-shrink: 0;
  transition: transform 0.25s, color 0.2s;
}
.faq-item[open] summary::after {
  content: '−';
  color: var(--gold);
}

.faq-answer {
  padding: 0 1.2rem 1.1rem;
  animation: fadeUp 0.25s ease both;
}

.faq-answer p {
  font-size: 0.86rem;
  color: var(--ink-muted);
  line-height: 1.75;
  font-weight: 300;
  margin: 0;
}

/* ===========================
   FOOTER
=========================== */
.site-footer {
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.75rem;
  font-weight: 300;
  line-height: 1.6;
  animation: fadeUp 0.7s 0.3s ease both;
}

/* ===========================
   ANIMATION
=========================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.results-grid[hidden] { display: none; }
.breakdown[hidden]    { display: none; }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 560px) {
  body { padding: 2rem 0.75rem 3rem; }

  .inputs-section,
  .results-section { padding: 1.5rem 1.25rem; }

  .field-grid { grid-template-columns: 1fr; gap: 0.9rem; }

  .results-grid {
    grid-template-columns: 1fr 1fr;
  }
  .result-card.featured {
    grid-column: 1 / -1;
  }
  .result-value { font-size: 1.3rem; }

  /* SEO section mobile adjustments */
  .seo-card-inner {
    grid-template-columns: 1fr;
  }
  .seo-icon {
    padding: 1.5rem 1.25rem 0;
    justify-content: flex-start;
  }
  .seo-card-body {
    padding: 0.9rem 1.25rem 1.5rem;
  }
  .seo-card-body h2 { font-size: 1.2rem; }
}
