/* ============================================================
   PayLoanCentral — design system v2 "Private Ledger"
   Mode: Utility / Trust, luxe register.
   Direction: Mayfair private bank — porcelain ground, racing
   green, champagne-gold hairlines, one serif display face.
   The signature: the dark "vault card" results panel with
   ivory numerals and gold dotted leaders.
   One webfont (Marcellus, single weight) — speed budget intact.
   ============================================================ */

:root {
  --bg: #F7F5F0;
  --surface: #FFFFFF;
  --ink: #1B2620;
  --muted: #6E7269;
  --accent: #0B4A34;
  --accent-deep: #07331F;
  --accent-soft: #EBEFE6;
  --gold: #B3924F;
  --gold-bright: #CBAA62;
  --gold-soft: #F2EAD8;
  --cost: #9A6A2F;            /* semantic: interest paid / cost figures */
  --vault: #0D3B2C;           /* results panel ground */
  --vault-deep: #092C20;
  --ivory: #F6F2E7;
  --ivory-muted: #C9CDBE;
  --line: #E2DFD6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(27, 38, 32, 0.05), 0 10px 30px rgba(27, 38, 32, 0.07);
  --font-display: "Marcellus", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 1rem;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.site-header::after {
  /* the gold hairline — the thread that runs through the whole site */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
  opacity: 0.55;
}
.header-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 66px;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.375rem;
  color: var(--accent-deep);
  text-decoration: none;
  letter-spacing: 0.02em;
  padding: 12px 0;
}
.wordmark .mark-tick { color: var(--gold); }
.site-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.site-nav a {
  display: inline-block;
  padding: 10px 13px;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-radius: 8px;
  line-height: 24px;
}
.site-nav a:hover { color: var(--accent-deep); background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--accent-deep); background: var(--accent-soft); }

/* ---------- Page scaffold ---------- */
.page {
  max-width: 1060px;
  margin: 0 auto;
  padding: 36px 16px 64px;
}
.page-head { max-width: 720px; margin-bottom: 28px; }
h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: 0.005em;
  margin-bottom: 10px;
  color: var(--accent-deep);
}
.value-prop { color: var(--muted); font-size: 1.0625rem; max-width: 56ch; }

/* ---------- The tool ---------- */
.tool {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 26px;
  align-items: start;
  margin-bottom: 20px;
}
@media (max-width: 780px) {
  .tool { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 7px;
}
.input-wrap { position: relative; display: flex; }
.input-wrap .affix {
  position: absolute;
  top: 0; bottom: 0;
  display: flex;
  align-items: center;
  color: var(--gold);
  font-family: var(--font-num);
  font-size: 0.9375rem;
  pointer-events: none;
}
.affix.pre { left: 14px; }
.affix.post { right: 14px; }
input[type="number"], select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 1.0625rem;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  appearance: textfield;
}
input.has-pre { padding-left: 32px; }
input.has-post { padding-right: 36px; }
select { font-family: var(--font-body); }
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(179, 146, 79, 0.45);
  outline-offset: 1px;
  border-color: var(--gold);
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; }

.field-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.field-hint { font-size: 0.8125rem; color: var(--muted); margin-top: 6px; }
.field-error {
  display: none;
  font-size: 0.8438rem;
  color: #96421C;
  margin-top: 6px;
}
.field.invalid .field-error { display: block; }
.field.invalid input { border-color: #B36A3A; }

/* ---------- The vault card (results — the signature) ---------- */
.results {
  padding: 0;
  overflow: hidden;
  background: linear-gradient(168deg, var(--vault), var(--vault-deep));
  border: 1px solid var(--vault-deep);
  color: var(--ivory);
}
.results-hero {
  padding: 26px 24px 20px;
  border-bottom: 1px solid rgba(203, 170, 98, 0.28);
  position: relative;
}
.results-hero::before {
  /* gold hairline crest along the top of the card */
  content: "";
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  opacity: 0.8;
}
.results-hero .hero-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
}
.hero-amount {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums lining-nums;
  font-size: clamp(2.3rem, 7.5vw, 3.4rem);
  font-weight: 400;
  line-height: 1.08;
  color: var(--ivory);
  margin-top: 4px;
}
.hero-amount .per { font-size: 0.38em; color: var(--ivory-muted); font-family: var(--font-body); }
.results .field-hint { color: var(--ivory-muted); padding: 0; }
.results-hero .field-hint { margin-top: 6px; }

.ledger { list-style: none; padding: 16px 24px 8px; }
.ledger li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.9688rem;
}
.ledger .l-label { color: var(--ivory-muted); white-space: nowrap; }
.ledger .l-dots {
  flex: 1;
  border-bottom: 2px dotted rgba(203, 170, 98, 0.45);
  transform: translateY(-4px);
  min-width: 24px;
}
.ledger .l-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ivory);
}
.ledger .l-value.cost { color: #E4B87A; }
.ledger .l-value.gain { color: #A8D8B9; }

/* principal vs interest proportion bar */
.split-bar-wrap { padding: 12px 24px 24px; }
.split-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(203, 170, 98, 0.35);
}
.split-bar .seg-principal { background: #2E7B5C; }
.split-bar .seg-interest { background: var(--gold); }
.split-legend {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--ivory-muted);
  flex-wrap: wrap;
}
.split-legend strong { color: var(--ivory); font-family: var(--font-num); font-weight: 600; }
.split-legend .dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
}
.dot.p { background: #2E7B5C; }
.dot.i { background: var(--gold); }

/* ---------- Actions ---------- */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-body);
  border-radius: 8px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--ivory); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { background: var(--surface); color: var(--accent-deep); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--accent-deep); }

/* ---------- Amortization / data tables ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
  overflow: hidden;
}
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.table-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.3125rem;
  letter-spacing: 0.01em;
  color: var(--accent-deep);
}
.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 560px;
}
table.data th {
  text-align: right;
  font-size: 0.7188rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td {
  padding: 9px 16px;
  text-align: right;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--line);
}
table.data tr:last-child td { border-bottom: none; }
table.data tr:nth-child(even) td { background: #FBFAF6; }
table.data td.year-marker { font-weight: 700; color: var(--accent-deep); }

/* ---------- Ad zones (empty until AdSense approval) ---------- */
.ad-zone { min-height: 0; margin: 30px 0; }
.ad-zone:empty { display: none; }

/* ---------- Content sections ---------- */
.content { max-width: 720px; }
.content h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5625rem;
  letter-spacing: 0.01em;
  color: var(--accent-deep);
  margin: 42px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gold-soft);
}
.content h3 { font-size: 1.0625rem; margin: 22px 0 6px; }
.content p { margin-bottom: 15px; color: #2E3832; }
.content ol, .content ul { margin: 0 0 15px 22px; }
.content li { margin-bottom: 9px; color: #2E3832; }
.content a { color: var(--accent-deep); text-decoration-color: var(--gold); text-underline-offset: 2px; }

.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  padding: 15px 18px;
  font-weight: 600;
  font-size: 0.9688rem;
  list-style: none;
  position: relative;
  padding-right: 44px;
  min-height: 44px;
}
.faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 13px;
  font-size: 1.25rem;
  color: var(--gold);
  font-family: var(--font-num);
}
.faq details[open] { border-color: var(--gold); }
.faq details[open] summary::after { content: "\2212"; }
.faq .faq-a { padding: 0 18px 15px; color: #2E3832; font-size: 0.9375rem; }
.faq .faq-a p { margin-bottom: 10px; }

.crosslinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.crosslink {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: 10px;
  padding: 18px 16px;
  text-decoration: none;
  color: var(--ink);
}
.crosslink:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.crosslink strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--accent-deep);
  margin-bottom: 5px;
  font-size: 1.0313rem;
}
.crosslink span { color: var(--muted); font-size: 0.875rem; line-height: 1.5; }

.disclaimer {
  margin-top: 40px;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  font-size: 0.8438rem;
  color: var(--muted);
}

/* ---------- Legal / prose pages ---------- */
.prose { max-width: 720px; }
.prose h1 { margin-bottom: 18px; }
.prose h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.375rem;
  color: var(--accent-deep);
  margin: 30px 0 10px;
}
.prose p, .prose li { color: #2E3832; margin-bottom: 12px; }
.prose ul { margin-left: 22px; }
.prose a { color: var(--accent-deep); text-decoration-color: var(--gold); text-underline-offset: 2px; }
.updated { color: var(--muted); font-size: 0.875rem; margin-bottom: 26px; }

/* ---------- Contact form ---------- */
.contact-form { max-width: 560px; }
.contact-form .field textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}
.contact-form input[type="text"], .contact-form input[type="email"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--line);
  border-radius: 8px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 28px;
  position: relative;
}
.site-footer::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold) 82%, transparent);
  opacity: 0.55;
}
.footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 30px 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--muted);
}
.footer-links { display: flex; gap: 4px 20px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; padding: 4px 0; letter-spacing: 0.02em; }
.footer-links a:hover { color: var(--accent-deep); }

/* toast for Copy actions */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: var(--vault-deep);
  color: var(--ivory);
  border: 1px solid var(--gold);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9063rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
