/* ============================================================
   Design tokens — 임대주택 찾기
   Trust-forward Korean public service aesthetic
   ============================================================ */
:root {
  /* Brand — deep navy as anchor of trust */
  --navy-950: #061328;
  --navy-900: #0A1F3D;
  --navy-800: #112B52;
  --navy-700: #1E3A6F;
  --navy-600: #2C4E91;
  --navy-500: #4669B0;
  --navy-100: #DCE5F2;
  --navy-50:  #EEF2F9;
  --navy-25:  #F6F8FC;

  /* Accent — warm coral, signals "home" + CTA */
  --coral-600: #E84F2B;
  --coral-500: #FF6B47;
  --coral-100: #FFE3DA;
  --coral-50:  #FFF1EC;

  /* Semantic */
  --green-700: #047857;
  --green-500: #10B981;
  --green-50:  #ECFDF5;
  --amber-700: #B45309;
  --amber-500: #F59E0B;
  --amber-50:  #FFFBEB;
  --red-600:   #DC2626;
  --red-50:    #FEF2F2;

  /* Neutrals */
  --ink-900: #0B1424;
  --ink-700: #1F2A44;
  --ink-500: #4A5874;
  --ink-400: #6B7894;
  --ink-300: #94A0B8;
  --ink-200: #C9D1E0;
  --line:    #E5EAF2;
  --line-strong: #D5DCE8;
  --bg:      #F4F6FB;
  --surface: #FFFFFF;

  /* Type */
  --font-sans: "Pretendard Variable","Pretendard",-apple-system,BlinkMacSystemFont,system-ui,"Segoe UI",Roboto,sans-serif;
  --font-display: var(--font-sans);
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(11,20,36,0.04);
  --shadow-sm: 0 2px 6px rgba(11,20,36,0.05), 0 1px 2px rgba(11,20,36,0.04);
  --shadow-md: 0 6px 20px rgba(11,20,36,0.06), 0 2px 6px rgba(11,20,36,0.04);
  --shadow-lg: 0 20px 40px rgba(11,20,36,0.10), 0 4px 10px rgba(11,20,36,0.05);
  --shadow-navy: 0 12px 32px rgba(17,43,82,0.18);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-pill: 999px;
}

@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/pretendard@1.3.9/dist/web/variable/woff2/PretendardVariable.woff2") format("woff2-variations");
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink-900);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--navy-100); color: var(--navy-900); }

/* ============================================================
   App shell
   ============================================================ */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topnav__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex; align-items: center; gap: 32px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--navy-900);
  letter-spacing: -0.02em;
  font-size: 16px;
}
.brand__mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-600));
  display: grid; place-items: center;
  color: white;
  box-shadow: var(--shadow-sm);
}
.topnav__menu {
  display: flex; gap: 4px; flex: 1;
}
.topnav__link {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  color: var(--ink-500);
  transition: color .15s, background .15s;
}
.topnav__link:hover { color: var(--navy-900); background: var(--navy-50); }
.topnav__link.is-active { color: var(--navy-900); background: var(--navy-50); }
.topnav__cta {
  display: flex; gap: 8px; align-items: center;
}
.topnav__pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--green-50);
  color: var(--green-700);
  font-size: 12px; font-weight: 600;
}
.topnav__pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green-500);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.18);
}
.btn-ghost {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-700);
  transition: border-color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--ink-200); background: var(--navy-25); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(70,105,176,0.16), transparent 60%),
    radial-gradient(900px 500px at 5% 110%, rgba(255,107,71,0.08), transparent 60%),
    linear-gradient(180deg, #061328 0%, #0A1F3D 60%, #112B52 100%);
  color: white;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(900px 500px at 50% 30%, black 30%, transparent 70%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 72px 32px 96px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0;
}
.hero__eyebrow .star { color: var(--coral-500); }
.hero__title {
  font-size: 56px;
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 700;
  margin: 22px 0 18px;
  color: white;
  text-wrap: balance;
}
.hero__title em {
  font-style: normal;
  background: linear-gradient(120deg, #FFB199 0%, #FF6B47 50%, #FFB199 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}
.hero__sub {
  font-size: 18px;
  color: rgba(255,255,255,0.78);
  max-width: 540px;
  margin: 0 0 36px;
  line-height: 1.6;
}
.hero__cta {
  display: flex; gap: 12px; flex-wrap: wrap;
}
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  border-radius: 12px;
  background: var(--coral-500);
  color: white;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid var(--coral-500);
  box-shadow: 0 10px 24px rgba(255,107,71,0.30);
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-primary:hover { background: var(--coral-600); transform: translateY(-1px); box-shadow: 0 14px 32px rgba(255,107,71,0.40); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: white;
  font-weight: 500;
  font-size: 15px;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); }

.hero__stats {
  display: flex; gap: 36px;
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,0.10);
}
.hero__stat {
  display: flex; flex-direction: column; gap: 4px;
}
.hero__stat .n {
  font-size: 30px; font-weight: 700;
  letter-spacing: -0.03em;
  color: white;
}
.hero__stat .l {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

/* Hero visual — illustrated card stack */
.hero__visual {
  position: relative;
  height: 480px;
}
.hv-card {
  position: absolute;
  background: white;
  color: var(--ink-900);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px;
}
.hv-card--main {
  width: 360px;
  top: 60px; right: 0;
  padding: 22px;
  z-index: 3;
}
.hv-card--match {
  width: 270px;
  top: 0; left: 20px;
  z-index: 2;
  transform: rotate(-3deg);
}
.hv-card--rank {
  width: 230px;
  bottom: 20px; left: 0;
  z-index: 4;
  transform: rotate(2deg);
  padding: 16px 18px;
}
.hv-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.01em;
}
.hv-tag--green { background: var(--green-50); color: var(--green-700); }
.hv-tag--coral { background: var(--coral-50); color: var(--coral-600); }
.hv-tag--navy { background: var(--navy-50); color: var(--navy-700); }
.hv-card .ttl {
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.02em;
  margin: 10px 0 4px;
}
.hv-card .sub { font-size: 13px; color: var(--ink-500); margin-bottom: 14px; }
.hv-card .row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.hv-card .row .k { color: var(--ink-500); }
.hv-card .row .v { color: var(--ink-900); font-weight: 600; }
.hv-card .matchbar {
  height: 6px; border-radius: 4px; background: var(--navy-50);
  overflow: hidden; margin: 8px 0 4px;
}
.hv-card .matchbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-600), var(--coral-500)); }
.hv-card .matchpct {
  font-size: 32px; font-weight: 800; letter-spacing: -0.03em;
  color: var(--navy-900);
}
.hv-card .matchlbl { font-size: 12px; color: var(--ink-500); }
.hv-rank__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.hv-rank__item:last-child { border-bottom: 0; }
.hv-rank__n {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--navy-50);
  color: var(--navy-700);
  font-weight: 700;
  display: grid; place-items: center;
  font-size: 12px;
}
.hv-rank__n.is-1 { background: var(--coral-50); color: var(--coral-600); }

/* ============================================================
   Result banner (1차 판정 안내)
   ============================================================ */
.result-banner {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.result-banner__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.rb-left { display: flex; align-items: center; gap: 14px; }
.rb-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--amber-50);
  color: var(--amber-700);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.rb-title { font-weight: 600; color: var(--ink-900); font-size: 14px; }
.rb-desc { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.rb-counts {
  display: flex; gap: 14px; align-items: center;
}
.rb-count {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
}
.rb-count span:last-child { white-space: nowrap; }
.rb-count .n { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.rb-count--ok .n { color: var(--green-700); }
.rb-count--no .n { color: var(--ink-400); }

/* ============================================================
   Main layout
   ============================================================ */
.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
}

/* ---------- Sidebar profile form ---------- */
.sidebar { position: sticky; top: 76px; align-self: start; }
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.pc-head {
  padding: 18px 20px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.pc-head__title {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.pc-head__title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral-500); }
.pc-progress { font-size: 12px; color: var(--ink-500); }

.pc-body { padding: 6px 0; }
.pc-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.pc-section:last-child { border-bottom: 0; }
.pc-step {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.pc-step__n {
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--navy-50);
  color: var(--navy-700);
  font-weight: 700;
  font-size: 12px;
  display: grid; place-items: center;
}
.pc-step__title {
  font-size: 13px; font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
}
.pc-step__hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-400);
}

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 500;
  color: var(--ink-500);
  margin-bottom: 6px;
}
.field__label .req { color: var(--coral-600); margin-left: 2px; }
.field__hint { font-size: 11px; color: var(--ink-400); font-weight: 400; }

.input, .select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  color: var(--ink-900);
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
}
.input:hover, .select:hover { border-color: var(--ink-200); }
.input:focus, .select:focus {
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(70,105,176,0.16);
}
.input--with-suffix { padding-right: 38px; }
.field__wrap { position: relative; }
.field__suffix {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px; color: var(--ink-400);
  pointer-events: none;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M3 4.5L6 7.5L9 4.5' stroke='%236B7894' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--navy-25);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.seg__btn {
  border: 0; background: transparent;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  border-radius: 8px;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg__btn:hover { color: var(--navy-700); }
.seg__btn.is-on {
  background: white;
  color: var(--navy-900);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(11,20,36,0.08);
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12px; font-weight: 500;
  color: var(--ink-500);
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--navy-500); color: var(--navy-700); }
.chip.is-on {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: white;
}
.chip.is-on .ck { color: var(--coral-500); }
.chip .ck {
  width: 12px; height: 12px;
  display: grid; place-items: center;
  color: var(--ink-300);
}

.chip-details {
  margin-top: 14px;
  display: flex; flex-direction: column;
  gap: 10px;
}
.chip-details:empty { margin-top: 0; }

/* Single-column page main (catalog/list pages) */
.page-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px;
}
@media (max-width: 980px) {
  .page-main { padding: 24px; }
}

/* Hero compact variant for sub-pages */
.hero--compact .hero__inner { grid-template-columns: 1fr; padding: 56px 32px 56px; }
.hero--compact .hero__title { font-size: 40px; margin: 14px 0 12px; }
.hero--compact .hero__sub { margin-bottom: 0; }
@media (max-width: 980px) {
  .hero--compact .hero__inner { padding: 44px 24px 44px; }
  .hero--compact .hero__title { font-size: 32px; }
}

/* FAQ details marker — rotate caret on open for visual state cue */
.faq-item[open] .faq-marker { transform: rotate(180deg); }
.faq-item summary::-webkit-details-marker { display: none; }

.pc-foot {
  padding: 16px 20px;
  background: var(--navy-25);
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.btn-cta {
  padding: 12px 14px;
  background: var(--navy-900);
  color: white;
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  transition: background .15s, transform .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-cta:hover { background: var(--navy-800); }
.btn-cta:active { transform: translateY(1px); }
.btn-reset {
  padding: 12px 14px;
  background: transparent;
  color: var(--ink-500);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 13px; font-weight: 500;
}
.btn-reset:hover { border-color: var(--ink-200); color: var(--ink-700); }

/* ============================================================
   Right column — filter + grid
   ============================================================ */
.results__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}
.results__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink-900);
}
.results__title em {
  font-style: normal;
  color: var(--coral-600);
}
.results__sub {
  font-size: 13px;
  color: var(--ink-500);
  margin-top: 4px;
}
.results__sort {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--ink-500);
}

.filterbar {
  display: flex; gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filterbar::-webkit-scrollbar { display: none; }
.fchip {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px; font-weight: 500;
  color: var(--ink-500);
  transition: all .15s;
}
.fchip:hover { border-color: var(--navy-500); color: var(--navy-700); }
.fchip.is-on {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: white;
}
.fchip .count {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--navy-50);
  color: var(--navy-700);
  font-size: 11px; font-weight: 700;
}
.fchip.is-on .count { background: rgba(255,255,255,0.16); color: white; }

/* ---------- Housing cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 1240px) { .grid { grid-template-columns: repeat(2, 1fr); } }

.hcard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column;
  min-height: 330px;
  overflow: hidden;
}
.hcard::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--hcard-accent, var(--navy-600));
  opacity: 0.85;
}
.hcard:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--hcard-accent, var(--navy-500));
}
.hcard__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.hcard__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--hcard-tint, var(--navy-50));
  color: var(--hcard-accent, var(--navy-700));
  display: grid; place-items: center;
  flex-shrink: 0;
}
.hcard__status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  flex-shrink: 0;
  white-space: nowrap;
}
.hcard__status .dot { width: 6px; height: 6px; border-radius: 50%; }
.hcard__status--ok { background: var(--green-50); color: var(--green-700); }
.hcard__status--ok .dot { background: var(--green-500); box-shadow: 0 0 0 3px rgba(16,185,129,0.18);}
.hcard__status--review { background: var(--amber-50); color: var(--amber-700); }
.hcard__status--review .dot { background: var(--amber-500); }
.hcard__status--no { background: #F4F6FB; color: var(--ink-400); }
.hcard__status--no .dot { background: var(--ink-300); }

.hcard__cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--hcard-accent, var(--navy-700));
  background: var(--hcard-tint, var(--navy-50));
  padding: 3px 9px;
  border-radius: var(--r-pill);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.hcard__title {
  font-size: 19px; font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink-900);
  margin: 0 0 4px;
}
.hcard__tag {
  font-size: 13px;
  color: var(--ink-500);
  margin-bottom: 14px;
  line-height: 1.5;
}
.hcard__meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
  padding: 12px 14px;
  background: var(--navy-25);
  border-radius: 10px;
  margin-bottom: 14px;
}
.hcard__metaitem {
  display: flex; flex-direction: column; gap: 2px;
}
.hcard__metalabel {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px;
  color: var(--ink-400);
  font-weight: 500;
}
.hcard__metavalue {
  font-size: 13px; font-weight: 600;
  color: var(--ink-900);
}
.hcard__targets {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 18px;
}
.hcard__tgt {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-500);
}
.hcard__foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.hcard__cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-900);
  padding: 6px 0;
}
.hcard__cta .arr {
  transition: transform .2s;
}
.hcard:hover .hcard__cta .arr {
  transform: translateX(3px);
  color: var(--hcard-accent, var(--navy-700));
}
.hcard__bookmark {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-400);
  display: grid; place-items: center;
  transition: color .15s, border-color .15s, background .15s;
}
.hcard__bookmark:hover { color: var(--coral-600); border-color: var(--coral-100); background: var(--coral-50); }

/* ============================================================
   How-it-works strip
   ============================================================ */
.how {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-top: 24px;
}
.how__inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 56px 32px;
}
.how__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px;
  gap: 24px;
}
.how__title {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink-900);
}
.how__sub {
  font-size: 14px;
  color: var(--ink-500);
  margin-top: 6px;
}
.how__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.how__step {
  position: relative;
  padding: 24px;
  background: var(--navy-25);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.how__n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--navy-900);
  color: white;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.how__step h4 {
  font-size: 17px; font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink-900);
}
.how__step p {
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.6;
  margin: 0;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--navy-950);
  color: rgba(255,255,255,0.6);
  padding: 56px 32px 36px;
}
.footer__inner {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 48px;
}
.footer__brand {
  color: white;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.footer__desc {
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.5);
  max-width: 340px;
}
.footer__col h5 {
  color: white;
  font-size: 13px; font-weight: 600;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.footer__col ul { list-style: none; padding: 0; margin: 0; }
.footer__col li { padding: 5px 0; font-size: 13px; color: rgba(255,255,255,0.55); }
.footer__col li:hover { color: white; }
.footer__bottom {
  max-width: 1440px;
  margin: 36px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex; justify-content: space-between;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; padding: 56px 24px 72px; }
  .hero__visual { display: none; }
  .hero__title { font-size: 40px; }
  .main { grid-template-columns: 1fr; padding: 24px; }
  .sidebar { position: static; }
  .grid { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr 1fr; }
  .how__grid { grid-template-columns: 1fr; }
  .topnav__menu { display: none; }
}

@media (max-width: 640px) {
  .result-banner__inner {
    padding: 18px 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .rb-left {
    align-items: flex-start;
  }

  .rb-counts {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .rb-count {
    justify-content: center;
    min-height: 48px;
    padding: 9px 10px;
  }
}

/* ============================================================
   Mobile overflow guard
   Grid/flex items default to min-width:auto, refusing to shrink
   below their content's min-content size. On narrow viewports this
   cascades up the layout and forces horizontal page overflow.
   Resetting min-width to 0 lets the responsive single-column
   layouts actually fit the viewport, and converts the auto-min
   grid tracks (minmax(auto,1fr)) to behave as minmax(0,1fr).
   Applies at all widths — harmless on desktop, essential on mobile.
   ============================================================ */
.app, .app * { min-width: 0; }

/* Grid tracks: make the 1fr columns explicitly shrinkable too
   (belt-and-suspenders alongside the min-width reset above). */
.main { grid-template-columns: 360px minmax(0, 1fr); }
.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hcard__meta { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.seg { grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 1240px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .main { grid-template-columns: minmax(0, 1fr); }
  .grid { grid-template-columns: minmax(0, 1fr); }
}

/* Horizontal-scroll regions keep their intended inner scroll */
.filterbar { min-width: 0; }
