/* ==========================================================================
   NHÀ PHỐ — demo site for Hoàng Anh Studio
   --------------------------------------------------------------------------
   CONCEPT
   A property register, not a brochure: the page is bound like a cadastral
   ledger — deep navy cover, off-white paper pages, brass rules, monospaced
   record codes, and a strict grid where every listing is a row of facts.

   PALETTE  (contrast ratios computed against the adjacent surface)
   --ground      #060F1B  deep navy page ground
   --navy-800    #102237  raised dark surface (plates, nav panel)
   --line-dark   #22384F  hairlines on dark (non-text, 1.6:1)
   --text        #E9EEF4  body on dark          16.49:1 on --ground
   --text-muted  #A3B2C2  secondary on dark      8.89:1 on --ground
   --brass       #D9B26A  accent on dark         9.64:1 on --ground
   --paper       #F4EFE5  off-white ledger page
   --paper-2     #E8E1D2  ruled bands, filter bar
   --paper-3     #FBF7EF  listing card surface
   --ink         #08131F  body on paper         16.31:1 on --paper
   --ink-2       #4E5A68  secondary on paper     6.14:1 on --paper, 5.40:1 on --paper-2, 6.58:1 on --paper-3
   --brass-ink   #6E5218  accent on paper        6.36:1 on --paper, 5.60:1 on --paper-2, 6.82:1 on --paper-3
   --error       #8C2F1E  form errors            7.21:1 on --paper, 7.74:1 on --paper-3
   --success     #1F5B3A  success message        7.01:1 on --paper
   Pressed chip: --paper on --ink 16.31:1; its count in --brass on --ink 9.37:1.
   Placeholders #5A6675: 5.10:1 on --paper, 5.47:1 on --paper-3.
   Borders are non-text but still checked: input and select #8A7E68 — 3.48:1
   on --paper, 3.73:1 on --paper-3, 3.06:1 on --paper-2 (the filter bar).
   Ghost-button and control borders #4A6178 on --ground 3.00:1.
   Focus rings: #E8C88A on dark (11.96:1), #6E5218 on paper (6.36:1).
   The brass button deliberately inherits #E8C88A rather than using --ink:
   its 2px ring sits on the page ground outside the fill, so a dark ring
   would measure 1.03:1. All rings ≥ 3:1 against the adjacent surface.

   TYPE  Bricolage Grotesque (display) + Inter (text)
   display / h1  clamp(2.5rem, 5.8vw, 4.5rem) / .98 / -.035em / 600
   h2            clamp(1.9rem, 3.9vw, 3.1rem) / 1.02 / -.028em / 600
   h3            1.1875rem / 1.25 / -.015em / 600
   body          1rem / 1.6 / 0 / 400
   small         .9375rem / 1.5 / 0 / 500   (labels, buttons, plate meta)
   meta          .75rem / 1.4 / .14em / 500 uppercase
   mono          .75rem / 1.4 / .08em (record codes)

   LAYOUT
   A 12-column shell (max 1240px). Every section is introduced by a numbered
   index rail ("01 Quy trình") that runs down the left of the content, so the
   page reads as a sequence of bound pages. The listing section flips to an
   off-white "ledger" page carrying a ruled filter bar and a strict 3-column
   card grid; the rest of the page stays on the navy cover.

   SIGNATURE MOTION
   FLIP on the listing grid. When a filter or sort changes, cards that survive
   travel from their old box to their new one in 480ms, staggered 55ms across
   the grid so the block resolves as a wave; cards that enter fade and lift in
   behind them. Measured with getBoundingClientRect, inverted with transform,
   then released — no layout property is ever animated. Everything else on the
   page stays quiet: the hero headline rise is a single 900ms mask, and reveals
   are a 680ms opacity/translate.

   PORTFOLIO
   "Danh sách nhà" — ten demonstration records across four property types,
   filtered by type chips plus area and price selects, with a live count.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --ground: #060F1B;
  --navy-900: #0A1828;
  --navy-800: #102237;
  --line-dark: #22384F;
  --line-dark-2: #3E5B78;

  --text: #E9EEF4;
  --text-muted: #A3B2C2;
  --brass: #D9B26A;
  --brass-soft: #B08C4A;

  --paper: #F4EFE5;
  --paper-2: #E8E1D2;
  --paper-3: #FBF7EF;
  --ink: #08131F;
  --ink-2: #4E5A68;
  --brass-ink: #6E5218;
  --rule-ink: rgba(8, 19, 31, 0.24);
  --rule-ink-soft: rgba(8, 19, 31, 0.12);
  --error: #8C2F1E;
  --success: #1F5B3A;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-text: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  --ease-enter: cubic-bezier(.16, 1, .3, 1);
  --ease-expo: cubic-bezier(.19, 1, .22, 1);
  --ease-move: cubic-bezier(.65, 0, .35, 1);
  --ease-exit: cubic-bezier(.7, 0, .84, 0);
  --ease-pop: cubic-bezier(.34, 1.4, .64, 1);
  --dur-micro: 140ms;
  --dur-small: 220ms;
  --dur-med: 320ms;
  --dur-large: 480ms;
  --dur-reveal: 680ms;
  --dur-hero: 900ms;

  --shell: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --focus: #E8C88A;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 600; }
p, dl, dd, figure, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--brass); color: var(--ink); }

/* Keep the hidden attribute authoritative over component display rules. */
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 1px;
}

.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 {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--brass);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur-small) var(--ease-enter);
}
.skip:focus-visible { transform: translateY(0); }
/* Ring stays #E8C88A (11.96:1 on the ground). The offset puts it outside
   the brass fill, so an --ink ring would measure 1.03:1 — same trap as the
   brass button, so it is deliberately not overridden here. */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- shared bits ---------- */
.index {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}
.index span {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 22px;
  border: 1px solid currentColor;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.fineprint {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 54ch;
}

.mono { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; }

.tag {
  display: inline-block;
  padding: 4px 8px;
  border: 1px solid var(--brass-soft);
  color: var(--brass);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- buttons ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-bd: #4A6178;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-text);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  border-radius: 1px;
  transition: transform var(--dur-micro) var(--ease-move),
              background-color var(--dur-small) var(--ease-move),
              border-color var(--dur-small) var(--ease-move),
              color var(--dur-small) var(--ease-move);
}
.btn .ico { transition: transform var(--dur-small) var(--ease-enter); }
.btn:active { transform: translateY(1px); }

.btn--brass {
  --btn-bg: var(--brass);
  --btn-fg: var(--ink);
  --btn-bd: var(--brass);
  font-weight: 600;
}
.btn--quiet {
  --btn-fg: var(--ink-2);
  --btn-bd: transparent;
  --focus: var(--brass-ink);
  min-height: 44px;
  padding: 0 4px;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--rule-ink);
}

/* ---------- hover (fine pointers only) ----------
   One block so every hover affordance is gated: a touch tap must not leave
   sticky hover styling behind. */
@media (hover: hover) and (pointer: fine) {
  .btn--brass:hover { --btn-bg: #E4C181; --btn-bd: #E4C181; }
  .btn--brass:hover .ico { transform: translateX(3px); }
  .btn--ghost:hover { --btn-bg: rgba(217, 178, 106, 0.08); border-color: var(--brass-soft); }
  .btn--quiet:hover { --btn-fg: var(--ink); }
  .site-nav__link:hover { color: var(--text); }
  .site-nav__link--cta:hover { background: rgba(217, 178, 106, 0.1); color: var(--brass); }
  .chip:hover { color: var(--ink); border-color: var(--rule-ink); }
  .select-wrap select:hover { border-color: var(--brass-ink); }
  .form__input:hover { border-color: var(--brass-ink); }
  .listing:hover { background: #FFFCF5; }
  .listing:hover .listing__fig .photo-real { transform: scale(1.035); }
  .listing:hover .listing__fig { border-color: rgba(110, 82, 24, 0.3); }
  .listing__cta:hover { text-decoration: underline; text-underline-offset: 4px; }
  .listing__cta:hover svg { transform: translateX(3px); }
  .footer__nav a:hover { color: var(--text); text-decoration: underline; }
  .footer__credit a:hover { text-decoration-color: currentColor; }
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 15, 27, 0.88);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid var(--line-dark);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  position: relative;
}
.site-header::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: 0 50%;
  opacity: 0.9;
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .site-header::after {
    animation: header-progress linear both;
    animation-timeline: scroll(root block);
  }
  @keyframes header-progress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  margin-right: auto;
  text-decoration: none;
  color: var(--text);
}
.brand__mark { color: var(--brass); flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand__tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}

.site-nav__list { display: flex; align-items: center; gap: 4px; }
.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  transition: color var(--dur-small) var(--ease-move),
              opacity var(--dur-micro) var(--ease-move);
}
.site-nav__link::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 9px;
  height: 1px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--dur-small) var(--ease-enter);
}
.site-nav__link:active { opacity: .7; }
.site-nav__link[aria-current="page"],
.site-nav__link[aria-current="true"] { color: var(--text); }
.site-nav__link[aria-current="page"]::after,
.site-nav__link[aria-current="true"]::after { transform: scaleX(1); }
.site-nav__link--cta {
  margin-left: 8px;
  border: 1px solid var(--brass-soft);
  color: var(--brass);
  padding: 0 18px;
}
.site-nav__link--cta::after { display: none; }

.nav-toggle {
  display: none;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid #4A6178;
  background: transparent;
  border-radius: 1px;
  transition: transform var(--dur-micro) var(--ease-move);
}
.nav-toggle:active { transform: scale(.97); }
.nav-toggle__box { display: grid; gap: 6px; width: 20px; }
.nav-toggle__bar {
  display: block;
  height: 1.5px;
  background: var(--text);
  transition: transform var(--dur-small) var(--ease-move);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: clamp(40px, 7vw, 84px) 0 clamp(56px, 8vw, 104px);
  overflow: hidden;
}
.hero__wash {
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 78%;
  background:
    radial-gradient(58% 62% at 22% 30%, rgba(217, 178, 106, 0.11), transparent 68%),
    radial-gradient(48% 55% at 82% 8%, rgba(62, 91, 120, 0.5), transparent 70%);
  pointer-events: none;
}
.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: clamp(32px, 4.5vw, 64px);
  align-items: start;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: clamp(20px, 3vw, 30px);
}
.eyebrow__tick {
  width: 18px; height: 1px;
  background: var(--brass);
  flex: none;
}

.hero__title {
  font-size: clamp(2.5rem, 5.8vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin-bottom: clamp(20px, 3vw, 30px);
}
.line { display: block; overflow: hidden; padding-block: 0.06em; }
/* Each .line is one deliberate break; nowrap keeps a wrapped second line
   from breaking the rise mask mid-reveal. The clamp floors above guarantee
   the copy fits, so this never has to clip. */
.line__in { display: block; white-space: nowrap; }

.hero__lead {
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.62;
  color: var(--text-muted);
  max-width: 46ch;
  margin-bottom: clamp(24px, 3.4vw, 34px);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: clamp(32px, 5vw, 56px);
  padding-top: 20px;
  border-top: 1px solid var(--line-dark);
  max-width: 460px;
}
.hero__meta-item dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.hero__meta-item dd {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}
.hero__meta-item dd span {
  font-family: var(--font-text);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
}

/* ---------- hero plate (local property photo + sample record) ---------- */
.plate {
  position: relative;
  padding: 9px;
  border: 1px solid var(--line-dark-2);
  background: linear-gradient(160deg, #12283F 0%, #0B1B2C 100%);
}
.plate::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(217, 178, 106, 0.24);
  transform: translate(10px, 10px);
  pointer-events: none;
  opacity: 0.9;
}
.plate__map {
  position: relative;
  aspect-ratio: 7 / 5;
  overflow: hidden;
  background: var(--navy-900);
  border: 1px solid var(--line-dark);
}
.plate__map svg { width: 100%; height: 100%; }
.plate__map::after { content: none; }

.plate__card {
  position: relative;
  margin: -52px 10px 10px;
  padding: 18px 18px 16px;
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  border-top: 3px solid var(--brass);
  --focus: var(--brass-ink);
}
.plate__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.plate__head .tag { border-color: var(--brass-ink); color: var(--brass-ink); }
.plate__head .mono { color: var(--ink-2); }
.plate__price {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
}
.plate__price span { font-size: 0.9375rem; font-weight: 500; letter-spacing: 0; }
.plate__name {
  margin-top: 6px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.plate__specs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule-ink);
}
.plate__specs dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.plate__specs dd {
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 2px;
}
.plate__note {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

/* ---------- section scaffolding / numbered rail ---------- */
.section { padding-block: clamp(56px, 8vw, 104px); }

.rail {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.rail__aside { position: sticky; top: 104px; }
.rail__title {
  font-size: clamp(1.9rem, 3.9vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.028em;
  margin-top: 18px;
  text-wrap: balance;
}
.rail__note {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 34ch;
}

.steps { border-top: 1px solid var(--line-dark); }
.step {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: clamp(14px, 2.4vw, 28px);
  padding: 26px 0;
  border-bottom: 1px solid var(--line-dark);
}
.step__num {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  color: var(--brass);
  padding-top: 4px;
}
.step__text h3 { font-size: 1.1875rem; line-height: 1.25; letter-spacing: -0.015em; }
.step__text p {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 52ch;
}
.rail__body .fineprint { margin-top: 22px; }

/* ---------- listings: the off-white ledger page ---------- */
.section--listings {
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  --focus: var(--brass-ink);
  padding-block: clamp(48px, 7vw, 88px);
  border-top: 1px solid rgba(8, 19, 31, 0.2);
  border-bottom: 1px solid rgba(8, 19, 31, 0.2);
}
.section--listings .index { color: var(--brass-ink); }

.sec-head { margin-bottom: clamp(24px, 3.5vw, 38px); }
.sec-head__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(20px, 4vw, 56px);
  margin-top: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule-ink);
}
.sec-head__title {
  font-size: clamp(1.9rem, 3.9vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.028em;
  flex: none;
}
.sec-head__lead {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 46ch;
  padding-bottom: 6px;
}

/* ---------- filter bar ---------- */
.filterbar {
  border: 1px solid var(--rule-ink);
  background: var(--paper-2);
  margin-bottom: clamp(20px, 3vw, 30px);
}
.filterbar__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}
.filterbar__row--chips {
  border-bottom: 1px solid var(--rule-ink-soft);
  padding-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.filterbar__label {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-left: 2px;
}
.chips { display: flex; gap: 6px; flex: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 1px;
  transition: background-color var(--dur-small) var(--ease-move),
              color var(--dur-small) var(--ease-move),
              border-color var(--dur-small) var(--ease-move),
              transform var(--dur-micro) var(--ease-move);
}
.chip__n {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-2);
  padding: 1px 5px;
  border: 1px solid var(--rule-ink);
  min-width: 20px;
  text-align: center;
  transition: color var(--dur-small) var(--ease-move),
              border-color var(--dur-small) var(--ease-move);
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip[aria-pressed="true"]:focus-visible { outline-color: var(--brass-ink); outline-offset: 3px; }
.chip[aria-pressed="true"] .chip__n {
  color: var(--brass);
  border-color: rgba(244, 239, 229, 0.36);
}
.chip:active { transform: translateY(1px); }

.filterbar__row--selects {
  flex-wrap: wrap;
  gap: 10px 18px;
  padding-top: 12px;
  padding-bottom: 12px;
}
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field > label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}

.select-wrap { position: relative; display: inline-flex; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  padding: 0 34px 0 12px;
  background: var(--paper-3);
  border: 1px solid #8A7E68;
  border-radius: 1px;
  color: var(--ink);
  color-scheme: light;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-small) var(--ease-move),
              background-color var(--dur-small) var(--ease-move);
}
.select-wrap select:active { border-color: var(--brass-ink); }
.select-wrap__ico {
  position: absolute;
  right: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-2);
  pointer-events: none;
}
.filterbar__reset { margin-left: auto; }

.filterbar__status {
  padding: 9px 12px;
  border-top: 1px solid var(--rule-ink-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.filterbar__status b { color: var(--ink); font-weight: 600; }

/* ---------- listing grid ---------- */
/* Hairlines tile from each cell's right/bottom edge, so a partly filled final
   row leaves clean paper rather than a band of gutter colour. */
.listings {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  background: transparent;
  border-top: 1px solid var(--rule-ink);
  border-left: 1px solid var(--rule-ink);
}

.listing {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 33.3333%;
  padding: 18px 18px 16px;
  background: var(--paper-3);
  color: var(--ink);
  min-width: 0;
  border-right: 1px solid var(--rule-ink);
  border-bottom: 1px solid var(--rule-ink);
  outline-offset: -2px;
}
.listing:focus-within { outline: 2px solid var(--brass-ink); }
.listing__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-ink-soft);
}
.listing__code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--brass-ink);
}
.listing__type {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.listing__fig {
  margin: 14px 0 14px;
  padding: 6px;
  border: 1px solid var(--rule-ink-soft);
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, var(--rule-ink-soft) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--rule-ink-soft) 23px 24px),
    var(--paper);
  aspect-ratio: 16 / 11;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.listing__fig svg {
  width: 100%;
  height: 100%;
  color: var(--brass-ink);
  transition: transform var(--dur-large) var(--ease-expo);
}
.listing__title {
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: -0.012em;
  text-wrap: pretty;
}
.listing__where {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.listing__where span { color: var(--brass-ink); }

.listing__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule-ink-soft);
}
.listing__specs dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 2px;
}
.listing__specs dd {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.listing__specs dd span {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--ink-2);
  letter-spacing: 0;
}

.listing__price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule-ink-soft);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.listing__price span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.listing__price b { font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); }

.listing__cta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin-top: 8px;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--brass-ink);
  text-decoration: none;
}
.listing__cta svg { transition: transform var(--dur-small) var(--ease-enter); }
.listing__cta:active { transform: translateY(1px); }

/* FLIP + entry states are driven by JS classes on .listing.
   Cards travel with a small per-column delay so the grid resolves as a wave
   rather than a single block — this is the page's signature moment. No
   will-change is kept: the transform transition promotes itself while it runs. */
html.js-ready .listings { position: relative; }
html.js-ready .listing {
  transition: transform var(--dur-large) var(--ease-move) var(--flip-delay, 0ms);
}
/* A travelling card paints above its neighbours so it never slides under one. */
.listing.is-flip { z-index: 2; }
.listing.is-enter {
  animation: listing-in-motion var(--dur-large) var(--ease-enter) var(--enter-delay, 0ms) both;
}
@keyframes listing-in-motion {
  from { opacity: 0; translate: 0 14px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ---------- empty state ---------- */
.empty {
  margin-top: 1px;
  padding: clamp(36px, 6vw, 64px) 24px;
  border: 1px solid var(--rule-ink);
  background: var(--paper-3);
  text-align: center;
}
.empty__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.empty__text {
  margin: 10px auto 22px;
  max-width: 42ch;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.inventory-note {
  margin-top: 18px;
  padding-left: 14px;
  border-left: 2px solid var(--brass);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 72ch;
}

/* ---------- consultation ---------- */
.section--consult {
  position: relative;
  padding-block: clamp(56px, 8vw, 104px);
  border-top: 1px solid var(--line-dark);
}
.section--consult::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(46% 60% at 78% 30%, rgba(217, 178, 106, 0.09), transparent 70%);
  pointer-events: none;
}
.consult {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.consult__title {
  font-size: clamp(1.9rem, 3.9vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.028em;
  margin-top: 16px;
}
.consult__lead {
  margin-top: 16px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 42ch;
}
.consult__points {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line-dark);
  display: grid;
  gap: 10px;
  max-width: 42ch;
}
.consult__points li {
  position: relative;
  padding-left: 20px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
}
.consult__points li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.62em;
  width: 9px; height: 1px;
  background: var(--brass);
}
.consult__copy .fineprint { margin-top: 22px; }

.form {
  position: relative;
  padding: clamp(20px, 3.2vw, 32px);
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  border-top: 3px solid var(--brass);
  --focus: var(--brass-ink);
  display: grid;
  gap: 18px;
}
.form__context {
  padding: 10px 12px;
  border: 1px solid var(--rule-ink);
  border-left: 2px solid var(--brass-ink);
  background: var(--paper-3);
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.5;
}
.form__field { display: grid; gap: 6px; }
.form__label {
  font-family: var(--font-text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--ink);
}
.form__req { color: var(--error); }
.form__opt { font-weight: 400; color: var(--ink-2); }

.form__input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  background: var(--paper-3);
  border: 1px solid #8A7E68;
  border-radius: 1px;
  color: var(--ink);
  color-scheme: light;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color var(--dur-small) var(--ease-move),
              background-color var(--dur-small) var(--ease-move);
}
.form__input::placeholder { color: #5A6675; opacity: 1; }
.form__input--area { min-height: 96px; resize: vertical; }
.select-wrap--paper select { width: 100%; }
.select-wrap--paper { width: 100%; }

/* Align the form selects with the text inputs: .select-wrap select is more
   specific than .form__input, so it has to be re-stated inside .form. */
.form .select-wrap select {
  min-height: 48px;
  padding: 11px 34px 11px 13px;
  font-size: 1rem;
}

.form__hint {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink-2);
}
.form__err {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--error);
}
.form__err::before {
  content: "";
  flex: none;
  width: 12px; height: 12px;
  margin-top: 0.2em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background:
    linear-gradient(currentColor, currentColor) center / 1.5px 6px no-repeat;
}
/* Scoped to .form so it outranks `.form .select-wrap select` on the two
   select fields, which would otherwise keep the 48px geometry when invalid. */
.form .form__input[aria-invalid="true"] {
  border-color: var(--error);
  border-width: 2px;
  padding: 10px 12px;
  background: #FBF3F0;
}
.form .select-wrap select[aria-invalid="true"] { padding-right: 33px; }

.form__submit { width: 100%; margin-top: 2px; }
.form__note {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--ink-2);
  text-align: center;
}
.form__success {
  padding: 14px 16px;
  border: 1px solid var(--success);
  border-left-width: 3px;
  background: #EEF4EF;
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.55;
}
.form__success-title {
  font-weight: 600;
  color: var(--success);
  margin-bottom: 4px;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line-dark);
  padding-block: clamp(32px, 5vw, 52px) clamp(24px, 4vw, 40px);
  background: var(--navy-900);
}
.footer {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr) minmax(0, 3fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}
.brand--footer { margin-right: 0; }
.footer__line {
  margin-top: 14px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 34ch;
}
.footer__nav ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 16px;
}
.footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--dur-small) var(--ease-move),
              opacity var(--dur-micro) var(--ease-move);
}
.footer__nav a:active { opacity: .7; }
.footer__credit {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text-muted);
  padding-top: 12px;
  border-top: 1px solid var(--line-dark);
}
.footer__credit a {
  color: var(--brass);
  text-decoration-color: rgba(217, 178, 106, 0.5);
}

/* ---------- reveal motion ---------- */
html.js-motion [data-reveal] {
  opacity: 0;
  translate: 0 18px;
  transition: opacity var(--dur-reveal) var(--ease-enter),
              translate var(--dur-reveal) var(--ease-enter);
  transition-delay: calc(var(--i, 0) * 55ms);
}
html.js-motion [data-reveal].is-revealed {
  opacity: 1;
  translate: 0 0;
}

/* Safety net: if main.js never runs (404, syntax error), the reveal styles
   must not leave content invisible. js-ready is set on main.js's first line. */
html.js-motion:not(.js-ready) [data-reveal] { opacity: 1; translate: none; }

/* hero headline: translate mask, always painted, resolves without JS */
html.js-motion .line__in {
  animation: line-rise var(--dur-hero) var(--ease-expo) both;
}
html.js-motion .line:nth-child(1) .line__in { animation-delay: 80ms; }
html.js-motion .line:nth-child(2) .line__in { animation-delay: 170ms; }
@keyframes line-rise {
  from { transform: translateY(112%); }
  to   { transform: translateY(0); }
}
html.js-motion .eyebrow,
html.js-motion .hero__lead,
html.js-motion .hero__actions,
html.js-motion .hero__meta {
  animation: hero-fade var(--dur-large) var(--ease-enter) both;
}
html.js-motion .eyebrow { animation-delay: 40ms; }
html.js-motion .hero__lead { animation-delay: 260ms; }
html.js-motion .hero__actions { animation-delay: 340ms; }
html.js-motion .hero__meta { animation-delay: 420ms; }
html.js-motion .plate {
  animation: plate-in var(--dur-hero) var(--ease-expo) 200ms both;
}
@keyframes hero-fade {
  from { opacity: 0; translate: 0 10px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes plate-in {
  from { opacity: 0; translate: 0 24px; }
  to   { opacity: 1; translate: 0 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr); gap: clamp(32px, 6vw, 48px); }
  .plate { max-width: 520px; }
  .rail { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .rail__aside { position: static; }
  .rail__note { max-width: 56ch; }
  .consult { grid-template-columns: minmax(0, 1fr); }
  .listing { flex-basis: 50%; }
  .footer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer__credit { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  /* Without JS the toggle cannot work, so the nav stays visible as a wrapped row. */
  html:not(.js-ready) .site-nav {
    position: static;
    padding: 0;
    border: 0;
    background: none;
    display: block;
  }
  html:not(.js-ready) .site-header__inner { flex-wrap: wrap; row-gap: 4px; padding-bottom: 8px; }
  html:not(.js-ready) .site-nav__list { flex-direction: row; flex-wrap: wrap; }
  html:not(.js-ready) .site-nav__link { width: auto; min-height: 44px; padding: 0 12px; border: 0; }
  html:not(.js-ready) .site-nav__link--cta { margin: 0; }
  html:not(.js-ready) .nav-toggle { display: none; }

  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: calc(var(--gutter) * -1);
    right: calc(var(--gutter) * -1);
    background: var(--navy-800);
    border-block: 1px solid var(--line-dark-2);
    padding: 8px var(--gutter) 14px;
    display: none;
  }
  .site-nav[data-open="true"] { display: block; }
  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .site-nav__link {
    width: 100%;
    min-height: 52px;
    padding: 0 4px;
    font-size: 1rem;
    border-bottom: 1px solid var(--line-dark);
  }
  .site-nav__link::after { display: none; }
  .site-nav__link[aria-current="page"],
  .site-nav__link[aria-current="true"] { color: var(--brass); }
  .site-nav__link--cta {
    margin: 12px 0 0;
    border: 1px solid var(--brass-soft);
    justify-content: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--brass-soft);
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bar:first-child {
    transform: translateY(3.75px) rotate(45deg);
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bar:last-child {
    transform: translateY(-3.75px) rotate(-45deg);
  }
  .sec-head__row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .filterbar__row--selects { gap: 10px; }
  .filterbar__reset { margin-left: 0; }
}

@media (max-width: 680px) {
  html { scroll-padding-top: 78px; }
  .site-header__inner { min-height: 60px; gap: 12px; }
  .brand__tag { display: none; }
  .hero { padding-top: 30px; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { width: 100%; }
  .hero__meta { gap: 12px; }
  .hero__meta-item dd { font-size: 1.3125rem; }
  .hero__meta-item dd span { display: block; margin-top: 2px; }
  .plate { padding: 7px; }
  .plate::before { transform: translate(7px, 7px); }
  .plate__card { margin: -40px 6px 6px; padding: 15px 14px 14px; }
  .plate__specs { gap: 8px; }
  .step { grid-template-columns: 1fr; gap: 6px; padding: 22px 0; }
  .step__num { padding-top: 0; }
  .listing { flex-basis: 100%; padding: 16px 15px 14px; }
  .listing__fig { aspect-ratio: 16 / 9; }
  .footer { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .footer__credit { padding-top: 14px; }
  .form { padding: 20px 16px 22px; }
  .filterbar__row { padding: 8px 10px; }
  .filterbar__row--chips { padding-bottom: 10px; }
  /* Keep the group's accessible name in the tree on small screens. */
  .filterbar__label {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .chip { padding: 0 12px; font-size: 0.8125rem; }
  .inline-field { flex: 1 1 100%; }
  .select-wrap { flex: 1 1 auto; }
  .select-wrap select { width: 100%; }
}

@media (max-width: 480px) {
  /* The two hero lines are deliberate hard breaks, so the clamp floor is
     what decides clipping: the longest line is ≈8.2em wide. The base 2.5rem
     floor renders it at ≈328px, which stops fitting the measure below
     ≈370px of viewport; this override carries the whole 320–480px band and
     also removes the 40px → 34px step the base floor would produce at 400px. */
  .hero__title { font-size: clamp(1.8rem, 8.6vw, 2.4rem); }
  .hero__meta { gap: 10px; }
  .hero__meta-item dt { letter-spacing: 0.08em; }
  .plate__price { font-size: 1.5rem; }
}

/* ---------- accessibility preferences ---------- */
@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: var(--ground);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .hero__wash { display: none; }
}

@media (prefers-contrast: more) {
  :root {
    --line-dark: #4A6178;
    --line-dark-2: #7A93AB;
    --text-muted: #C7D2DE;
    --ink-2: #2E3A47;
    --rule-ink: rgba(8, 19, 31, 0.55);
    --rule-ink-soft: rgba(8, 19, 31, 0.32);
  }
  .site-header { background: var(--ground); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .filterbar { border-width: 2px; }
  .form__input { border-color: var(--ink); }
  .form .select-wrap select { border-color: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  html.js-motion [data-reveal] { opacity: 1 !important; translate: none !important; scale: none !important; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  html { scroll-behavior: auto; }
  .listing.is-enter { animation: none; }
  /* No scroll-linked progress under reduced motion: an empty track, not a
     full one, so the bar never asserts a false "fully scrolled" state. */
  .site-header::after { animation: none; transform: scaleX(0); }
}

@media print {
  .site-header, .filterbar, .hero__actions, .skip, .sprite { display: none; }
  body { background: #fff; color: #000; }
  .section--listings { background: #fff; }
}

/* Real local photographs fill the existing media frames, not the diagram grid. */
.photo-real { display: block; max-width: 100%; object-fit: cover; }
.plate__map .photo-real, .listing__fig .photo-real { width: 100%; height: 100%; }
.listing__fig { padding: 0; overflow: hidden; background: var(--paper-3); }

.listing__photo { transition: transform var(--dur-large) var(--ease-expo); }
