/* =============================================================
   PropertyIQ Design System — "Surveyor's Ledger"
   A blueprint-grid + brass-stamp identity: measurement marks,
   ruled ledger lines, and stamped monospace figures stand in
   for the generic gradient-card fintech look.
   ============================================================= */

:root {
  /* Color tokens */
  --blueprint-navy:   #10243E;
  --blueprint-navy-2: #16304F;
  --paper:            #F6F4EC;
  --paper-line:       #E4E0D2;
  --ink:              #1F2A37;
  --ink-soft:         #4B5768;
  --brass:            #B8863B;
  --brass-deep:       #93691F;
  --surveyor-green:   #2F6F4E;
  --surveyor-green-bg:#E7F0EA;
  --alert-red:        #A33B2E;
  --blue-line:        #6E93B4;

  /* Type */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Source Sans 3', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  /* Layout */
  --wrap: 1180px;
  --radius: 3px;
  --shadow-card: 0 1px 2px rgba(16,36,62,0.06), 0 8px 24px -12px rgba(16,36,62,0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    linear-gradient(var(--paper-line) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--blueprint-navy); line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: var(--blueprint-navy); }
strong { color: var(--ink); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--blueprint-navy);
  color: #fff; padding: 10px 16px; z-index: 200; border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2.5px solid var(--brass);
  outline-offset: 2px;
}

/* ---------------- Ruler edge motif (structural device: a measured tape) ---------------- */
.ruler-edge {
  height: 8px;
  background-image: repeating-linear-gradient(
    90deg, var(--brass) 0, var(--brass) 1px, transparent 1px, transparent 12px
  );
  background-color: var(--blueprint-navy);
}
.ruler-edge--top { order: -1; }

/* ---------------- Header ---------------- */
.site-header { background: var(--blueprint-navy); color: #fff; position: relative; z-index: 50; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand__mark { color: var(--brass); display: inline-flex; }
.brand__text { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.01em; color: #fff; }
.brand__text em { font-style: normal; color: var(--brass); }
.brand__text--footer { color: var(--blueprint-navy); }
.brand__text--footer em { color: var(--brass-deep); }

.main-nav ul { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; }
.main-nav > ul > li > a {
  display: inline-block; color: #E8ECF1; text-decoration: none; font-weight: 500;
  font-size: .95rem; padding: 10px 12px; border-radius: var(--radius);
}
.main-nav > ul > li > a:hover, .main-nav > ul > li > a:focus-visible { background: rgba(255,255,255,0.08); color: #fff; }

.has-submenu { position: relative; }
.submenu {
  display: none; position: absolute; top: 100%; left: 0; background: #fff;
  min-width: 240px; padding: 8px; border-radius: var(--radius); box-shadow: var(--shadow-card);
  border-top: 3px solid var(--brass);
}
.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu { display: block; }
.submenu li a {
  display: block; padding: 9px 12px; color: var(--ink); text-decoration: none;
  font-size: .93rem; border-radius: var(--radius);
}
.submenu li a:hover, .submenu li a:focus-visible { background: var(--surveyor-green-bg); color: var(--surveyor-green); }

.nav-toggle { display: none; }

/* ---------------- Breadcrumbs ---------------- */
.breadcrumbs { padding: 14px 24px 0; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; font-size: .82rem; color: var(--ink-soft); }
.breadcrumbs li:not(:last-child)::after { content: '/'; margin-left: 6px; color: var(--paper-line); }
.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brass-deep); text-decoration: underline; }

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  background: var(--blueprint-navy);
  color: #fff;
  overflow: hidden;
  padding: 64px 0 84px;
}
.hero::before {
  /* blueprint grid */
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(110,147,180,0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110,147,180,0.22) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 80% 60% at 30% 20%, black 40%, transparent 90%);
}
.hero__inner { position: relative; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono);
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brass);
  border: 1px solid rgba(184,134,59,0.5); padding: 5px 10px; border-radius: 2px; margin-bottom: 18px;
}
.hero h1 { color: #fff; margin-bottom: .4em; }
.hero__lede { color: #C8D2DE; font-size: 1.08rem; max-width: 46ch; }
.hero__ctas { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

/* Ledger stamp — the signature element: a rotated appraisal-stamp badge
   used for hero + calculator results, evoking a deed/appraisal stamp. */
.ledger-stamp {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2.5px solid var(--brass); border-radius: 50%;
  color: var(--brass); font-family: var(--font-mono); text-align: center;
  transform: rotate(-6deg);
  position: relative;
}
.ledger-stamp::after {
  content: ''; position: absolute; inset: 6px; border: 1px solid rgba(184,134,59,0.5); border-radius: 50%;
}
.hero__stamp-wrap { display: flex; justify-content: center; }
.ledger-stamp--hero { width: 240px; height: 240px; }
.ledger-stamp--hero .ledger-stamp__label { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.ledger-stamp--hero .ledger-stamp__value { font-size: 2rem; font-weight: 600; margin: 4px 0; color: #fff; }
.ledger-stamp--hero .ledger-stamp__sub { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; opacity: .7; }
.ledger-stamp--footer { width: 84px; height: 84px; border-color: var(--paper-line); color: var(--ink-soft); }
.ledger-stamp--footer .ledger-stamp__label { font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; }
.ledger-stamp--footer .ledger-stamp__year { font-family: var(--font-mono); font-weight: 600; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: .95rem;
  padding: 12px 22px; border-radius: var(--radius); text-decoration: none;
  border: 1.5px solid transparent; cursor: pointer; transition: transform .12s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brass); color: var(--blueprint-navy); }
.btn-primary:hover { background: #C8974A; }
.btn-outline { border-color: rgba(255,255,255,0.5); color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-ghost { border-color: var(--paper-line); color: var(--blueprint-navy); background: #fff; }
.btn-ghost:hover { border-color: var(--brass); }
.btn-block { width: 100%; }

/* ---------------- Sections / general ---------------- */
.section { padding: 64px 0; }
.section--tight { padding: 40px 0; }
.section--alt { background: #fff; border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); }
.section__head { max-width: 640px; margin: 0 0 36px; }
.eyebrow {
  display: inline-block; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brass-deep); margin-bottom: 10px;
}

/* ---------------- Calculator grid on homepage ---------------- */
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.calc-card {
  background: #fff; border: 1px solid var(--paper-line); border-radius: var(--radius);
  padding: 24px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-card); transition: transform .15s ease, border-color .15s ease;
  border-top: 3px solid var(--blue-line);
}
.calc-card:hover { transform: translateY(-3px); border-top-color: var(--brass); }
.calc-card__index { font-family: var(--font-mono); font-size: .78rem; color: var(--brass-deep); }
.calc-card h3 { margin-bottom: 2px; }
.calc-card p { font-size: .92rem; margin-bottom: 0; }
.calc-card__go { margin-top: auto; font-size: .85rem; font-weight: 600; color: var(--surveyor-green); }

/* ---------------- Calculator page layout ---------------- */
.calc-page { display: grid; grid-template-columns: 1fr; gap: 28px; }
.calc-intro { max-width: 760px; }
.calc-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }

.calc-panel {
  background: #fff; border: 1px solid var(--paper-line); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.calc-panel__head {
  background: var(--blueprint-navy); color: #fff; padding: 16px 22px;
  font-family: var(--font-mono); font-size: .82rem; letter-spacing: .06em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: space-between;
}
.calc-panel__body { padding: 22px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .88rem; color: var(--ink); margin-bottom: 6px; }
.field .hint { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-soft); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.input-affix {
  display: flex; align-items: stretch; border: 1.5px solid var(--paper-line); border-radius: var(--radius);
  overflow: hidden; background: #fff;
}
.input-affix:focus-within { border-color: var(--brass); }
.input-affix span {
  display: flex; align-items: center; padding: 0 12px; background: var(--paper);
  font-family: var(--font-mono); font-size: .85rem; color: var(--ink-soft); border-right: 1px solid var(--paper-line);
}
.input-affix span.suffix { border-right: none; border-left: 1px solid var(--paper-line); }
.input-affix input, .input-affix select {
  border: none; outline: none; padding: 11px 12px; font-family: var(--font-mono); font-size: .95rem;
  width: 100%; background: transparent; color: var(--ink);
}
select.plain { border: 1.5px solid var(--paper-line); border-radius: var(--radius); padding: 11px 12px; width: 100%; font-family: var(--font-body); background: #fff; }
select.plain:focus-visible { border-color: var(--brass); }

.range-field input[type="range"] { width: 100%; accent-color: var(--brass); }
.range-field .range-value { font-family: var(--font-mono); color: var(--brass-deep); font-weight: 600; }

/* Results */
.result-hero {
  text-align: center; padding: 26px 22px; border-bottom: 1px dashed var(--paper-line);
  background: repeating-linear-gradient(180deg, transparent, transparent 27px, var(--paper-line) 28px);
}
.result-hero__label { font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.result-hero__value { font-family: var(--font-mono); font-size: 2.6rem; font-weight: 600; color: var(--blueprint-navy); margin: 6px 0 2px; }
.result-hero__value .cents { font-size: 1.4rem; color: var(--ink-soft); }
.result-hero__sub { font-size: .85rem; color: var(--ink-soft); }

.result-list { list-style: none; margin: 0; padding: 18px 22px; }
.result-list li {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px dotted var(--paper-line); font-size: .92rem;
}
.result-list li:last-child { border-bottom: none; }
.result-list .k { color: var(--ink-soft); }
.result-list .v { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }
.result-list .v.positive { color: var(--surveyor-green); }
.result-list .v.negative { color: var(--alert-red); }

.verdict-banner {
  margin: 0 22px 22px; padding: 14px 16px; border-radius: var(--radius); font-size: .9rem;
  border-left: 4px solid var(--surveyor-green); background: var(--surveyor-green-bg); color: #1F4530;
}
.verdict-banner.negative { border-left-color: var(--alert-red); background: #F7E9E6; color: #5B241C; }

.table-wrap { overflow-x: auto; padding: 0 22px 22px; }
table.ledger-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.ledger-table th {
  text-align: right; font-family: var(--font-mono); font-weight: 600; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); padding: 8px 10px;
  border-bottom: 2px solid var(--blueprint-navy);
}
table.ledger-table th:first-child, table.ledger-table td:first-child { text-align: left; }
table.ledger-table td { text-align: right; padding: 7px 10px; font-family: var(--font-mono); border-bottom: 1px solid var(--paper-line); }
table.ledger-table tbody tr:hover { background: var(--paper); }

.actions-row { display: flex; gap: 10px; padding: 0 22px 22px; flex-wrap: wrap; }

/* Save / share form */
.save-form { display: flex; gap: 8px; padding: 0 22px 22px; }
.save-form input { flex: 1; border: 1.5px solid var(--paper-line); border-radius: var(--radius); padding: 10px 12px; font-family: var(--font-body); }
.save-status { padding: 0 22px 18px; font-size: .82rem; color: var(--surveyor-green); }

/* ---------------- Content / prose (about, blog) ---------------- */
.prose { max-width: 720px; }
.prose h2 { margin-top: 1.6em; }
.prose ul, .prose ol { color: var(--ink-soft); }
.prose a { color: var(--brass-deep); }

.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.article-card {
  background: #fff; border: 1px solid var(--paper-line); border-radius: var(--radius); padding: 22px;
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-card);
}
.article-card time { font-family: var(--font-mono); font-size: .74rem; color: var(--ink-soft); text-transform: uppercase; }
.article-card h3 { margin-bottom: 0; }
.article-card p { font-size: .9rem; margin-bottom: 0; }

/* ---------------- Forms (contact) ---------------- */
.form-grid { display: grid; gap: 16px; max-width: 560px; }
.form-grid input[type=text], .form-grid input[type=email], .form-grid textarea {
  width: 100%; border: 1.5px solid var(--paper-line); border-radius: var(--radius); padding: 11px 12px;
  font-family: var(--font-body); font-size: .95rem;
}
.form-grid textarea { min-height: 140px; resize: vertical; }
.form-grid label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.form-note { font-size: .82rem; color: var(--ink-soft); }
.alert-success { background: var(--surveyor-green-bg); color: #1F4530; border-left: 4px solid var(--surveyor-green); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; }
.alert-error { background: #F7E9E6; color: #5B241C; border-left: 4px solid var(--alert-red); padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; }

/* ---------------- Trust strip ---------------- */
.trust-strip { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; padding: 22px 0; color: var(--ink-soft); font-size: .86rem; font-family: var(--font-mono); }
.trust-strip span { display: inline-flex; align-items: center; gap: 8px; }
.trust-strip span::before { content: '—'; color: var(--brass); }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--paper); border-top: 1px solid var(--paper-line); margin-top: 40px; }
.footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr .8fr; gap: 32px; padding: 48px 24px 24px; }
.footer__brand p { font-size: .88rem; }
.footer__disclaimer { font-size: .78rem; color: #78828F; }
.footer__col h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-bottom: 12px; }
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer__col a { color: var(--ink); text-decoration: none; font-size: .9rem; }
.footer__col a:hover { color: var(--brass-deep); text-decoration: underline; }
.footer__col--ledger { display: flex; align-items: flex-start; justify-content: flex-end; }
.footer__bottom { border-top: 1px solid var(--paper-line); padding: 16px 24px; font-size: .8rem; color: var(--ink-soft); }

/* ---------------- Responsive ---------------- */
@media (max-width: 960px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__stamp-wrap { order: -1; }
  .calc-grid { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .calc-layout { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .main-nav ul#primary-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--blueprint-navy);
    flex-direction: column; padding: 10px; box-shadow: var(--shadow-card);
  }
  .main-nav ul#primary-menu.open { display: flex; }
  .submenu { position: static; box-shadow: none; border-top: none; display: none; background: rgba(255,255,255,0.05); }
  .has-submenu.open .submenu { display: block; }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 4px; background: none; border: none; padding: 8px; cursor: pointer;
  }
  .nav-toggle span { width: 22px; height: 2px; background: #fff; display: block; }
  .field-row { grid-template-columns: 1fr; }
  .calc-grid { grid-template-columns: 1fr; }
  .article-grid { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr; }
  .footer__col--ledger { justify-content: flex-start; }
  .result-hero__value { font-size: 2rem; }
  .ledger-stamp--hero { width: 190px; height: 190px; }
}
