/* ─── Design tokens ──────────────────────────────────────────────── */
:root {
  /* Background gradient */
  --bg-deep: #0e1420;
  --bg-mid:  #1a1f2e;
  --bg-warm: #2a2218;

  /* Glass surfaces */
  --glass-bg:          rgba(255, 255, 255, 0.07);
  --glass-bg-2:        rgba(255, 255, 255, 0.14);
  --glass-border:      rgba(255, 255, 255, 0.10);
  --glass-border-gold: rgba(212, 165, 116, 0.30);

  /* Text */
  --text-primary:   #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.78);
  --text-muted:     rgba(255, 255, 255, 0.55);
  --text-disabled:  rgba(255, 255, 255, 0.35);

  /* Gold accent */
  --gold:      #d4a574;
  --gold-soft: rgba(212, 165, 116, 0.85);
  --gold-tint: rgba(212, 165, 116, 0.18);

  /* Semantic */
  --positive: #86efac;
  --negative: #fca5a5;

  /* Fonts */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Base reset / page background ───────────────────────────────── */
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  min-height: 100vh;
  background:
    radial-gradient(at 20% 10%, rgba(180,150,90,.30) 0%, transparent 55%),
    radial-gradient(at 80% 80%, rgba(60,80,110,.40) 0%, transparent 60%),
    linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 50%, var(--bg-warm) 100%);
  background-attachment: fixed;
}

/* ─── Glass utility ──────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.glass-active {
  background: var(--glass-bg-2);
  border-color: var(--glass-border-gold);
}

/* ─── Section labels (uppercase, tracked, gold) ─────────────────── */
.section-label {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--gold-soft);
}

/* ─── Display headlines (Fraunces) ──────────────────────────────── */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.display em {
  font-style: italic;
  font-weight: 500;
  color: var(--gold);
}

/* ─── Tabular numbers ───────────────────────────────────────────── */
.tabular {
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

/* ─── Icons ─────────────────────────────────────────────────────── */
.icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 6px;
  opacity: 0.85;
  color: var(--gold-soft);
}
.icon-sm { width: 11px; height: 11px; margin-right: 4px; }

/* ─── Sidebar area links ────────────────────────────────────────── */
.area-link {
  display: flex;
  justify-content: space-between;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  border-radius: 12px;
  cursor: pointer;
  transition: background 120ms ease;
}
.area-link:hover { background: rgba(255,255,255,0.04); }
.area-link[aria-current="true"] {
  background: var(--gold-tint);
  border: 1px solid var(--glass-border-gold);
  color: var(--text-primary);
  font-weight: 500;
}
.area-link .count { color: var(--text-muted); }
.area-link[aria-current="true"] .count { color: var(--gold); }

/* ─── Mobile pill row (sidebar replacement) ─────────────────────── */
.pill-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 4px 0;
  width: 100%;
}
.pill-row::-webkit-scrollbar { display: none; }
.pill {
  scroll-snap-align: start;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.pill[aria-current="true"] {
  background: var(--gold-tint);
  border-color: var(--glass-border-gold);
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── Pill button (outline) ─────────────────────────────────────── */
.pill-button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: var(--text-primary);
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.pill-button:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--gold);
}

/* ─── Listings grid (desktop) ───────────────────────────────────── */
.listing-row {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1fr 1fr;
  gap: 0;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
}
.listing-row:last-child { border-bottom: none; }
.listing-row .price { text-align: right; font-weight: 500; color: var(--text-primary); }

/* ─── Listings stack (mobile card) ──────────────────────────────── */
.listing-card {
  background: var(--glass-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 11px 14px;
  margin-bottom: 6px;
}
.listing-card .row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.listing-card .row2 {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ─── Mobile/desktop toggle classes (used with Tailwind responsive) */
@media (min-width: 1024px) {
  .desktop-only { display: revert; }
  .mobile-only  { display: none; }
}
@media (max-width: 1023px) {
  .desktop-only { display: none; }
  .mobile-only  { display: revert; }
}

/* ─── Hidden attribute must beat Tailwind's display utilities ────── */
/* The article panels use `class="flex"` + the `hidden` attribute. Tailwind's
   `.flex` and `[hidden]` have the same CSS specificity but `.flex` is loaded
   later, so it wins. Forcing `!important` here makes the panel-toggle JS
   actually hide non-active panels. */
[hidden] { display: none !important; }

/* ─── Sub-project filter chips ───────────────────────────────────── */
.sp-chip {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.10);
  cursor: pointer;
}
.sp-chip:hover { border-color: rgba(255, 255, 255, 0.30); }
.sp-chip[aria-current="true"] {
  background: var(--gold-tint);
  border-color: var(--glass-border-gold);
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── Mobile drawer (hamburger overlay) ──────────────────────────── */
/* On mobile the header nav is hidden by Tailwind's `hidden md:flex`. When
   the user taps the hamburger, body.drawer-open shows the nav as a panel
   stacked under the header. Higher specificity than `.hidden` so it wins. */
@media (max-width: 767px) {
  body.drawer-open header {
    position: relative;
  }
  body.drawer-open header nav {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-deep);
    padding: 16px 20px;
    border-bottom: 1px solid var(--glass-border);
    gap: 14px;
    font-size: 14px;
    z-index: 40;
  }
  body.drawer-open header nav a {
    color: var(--text-secondary);
    padding: 6px 0;
    text-decoration: none;
  }
}

/* ─── Focus + accessibility ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ─── Print ─────────────────────────────────────────────────────── */
@media print {
  body { background: white; color: black; }
  .glass, .glass-active, .pill-row, header, footer { display: none; }
}
