/* ═══════════════════════════════════════════════════════════════
   Building Blocks — generic, token-driven UI layer
   No client-specific values live here; everything reads from the
   theme file. Pair with a theme-*.css and js/blocks.js.

   Contents:
   1. Reset & base        5. Section headers
   2. Layout              6. Dividers & hairlines
   3. Typography          7. Reveal system (scroll motion)
   4. Buttons             8. Hero choreography & atmosphere
                          9. CTA panel · 10. Utilities
   ═══════════════════════════════════════════════════════════════ */

/* ─── 1. Reset & base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }

/* ─── 2. Layout ──────────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 32px;
  min-width: 0;
}
.section { padding: var(--space-section) 0; }
.section-sm { padding: var(--space-section-sm) 0; }

/* ─── 3. Typography ──────────────────────────────────────────── */
.display-hero {
  font-family: var(--font-display);
  font-size: clamp(72px, 10vw, 140px);
  font-weight: 300;
  font-style: italic;
  line-height: var(--leading-display);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.display-section {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 400;
  line-height: var(--leading-display);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.display-section-italic {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 300;
  font-style: italic;
  line-height: var(--leading-display);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.heading {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}
.label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-text);
}
.body-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.body-text-light {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-primary);
  opacity: 0.75;
}

/* ─── 4. Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: all var(--dur-quick) var(--ease-out);
  white-space: nowrap;
}
.btn-primary {
  background: transparent;
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
}
.btn-primary:hover {
  border-color: var(--brand-light);
  color: var(--brand-light);
}
.btn-outline {
  background: transparent;
  color: var(--brand-text);
}
.btn-outline:hover {
  color: var(--text-primary);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); }
.btn-sm {
  padding: 9px 20px;
  font-size: 12px;
}
/* Text buttons have no visible box, so horizontal padding only pushes them
   out of alignment with the copy above. Must follow .btn-sm to win. */
.btn-outline,
.btn-ghost,
.btn-flush { padding-left: 0; padding-right: 0; }
.btn svg {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
}

/* ─── 5. Section headers ─────────────────────────────────────── */
.section-header {
  margin-bottom: 56px;
}
.section-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 56px;
}
.section-header-left .label { margin-bottom: 12px; }

/* ─── 6. Dividers & hairlines ────────────────────────────────── */
/* Short accent rule under headings / centered in CTAs */
.gold-line {
  width: 48px;
  height: 1px;
  background: var(--brand);
  margin: 20px 0;
}

/* Semi-transparent full-width hairlines that fade at the edges.
   Add .divider-top / .divider-bottom to any section-level element.
   With JS present they draw outward from center on first view. */
.divider-top,
.divider-bottom { position: relative; }
.divider-top::before,
.divider-bottom::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%, var(--divider) 15%, var(--divider) 85%, transparent 100%);
}
.divider-top::before { top: 0; }
.divider-bottom::after { bottom: 0; }

.reveals-on .divider-top::before,
.reveals-on .divider-bottom::after {
  transform: scaleX(0);
  transition: transform 1.4s var(--ease-soft) 0.1s;
}
.reveals-on .divider-top.is-drawn::before,
.reveals-on .divider-bottom.is-drawn::after {
  transform: scaleX(1);
}

/* ─── 7. Reveal system ───────────────────────────────────────── */
/* Usage:
   data-reveal            → fade-up on first view
   data-reveal="fade"     → fade only, no movement
   data-reveal-delay="150" → delay in ms
   data-reveal-stagger    → on a container: children auto-stagger
   js/blocks.js adds .reveals-on to <html>; without JS nothing hides. */
.reveals-on [data-reveal] {
  opacity: 0;
  transform: translateY(var(--reveal-distance));
  transition:
    opacity var(--dur-reveal) var(--ease-out),
    transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}
.reveals-on [data-reveal="fade"] { transform: none; }
.reveals-on [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* ─── 8. Hero choreography & atmosphere ──────────────────────── */
/* js/blocks.js adds .hero-in to .hero once the page is ready. */
.reveals-on .hero .hero-content > * {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity var(--dur-hero) var(--ease-soft),
    transform var(--dur-hero) var(--ease-soft),
    filter var(--dur-hero) var(--ease-soft),
    background-size 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveals-on .hero .hero-content > .hero-title { filter: blur(6px); }
.reveals-on .hero .hero-content > :nth-child(1) { transition-delay: 0.05s; }
.reveals-on .hero .hero-content > :nth-child(2) { transition-delay: 0.18s; }
.reveals-on .hero .hero-content > :nth-child(3) { transition-delay: 0.38s; }
.reveals-on .hero .hero-content > :nth-child(4) { transition-delay: 0.52s; }
.reveals-on .hero.hero-in .hero-content > * {
  opacity: 1;
  transform: none;
  filter: none;
}

/* Arc line-drawing — blocks.js sets pathLength="1" on stroked shapes */
.reveals-on .hero-arc { opacity: 0; transition: opacity 1.8s var(--ease-soft) 0.3s; }
.reveals-on .hero.hero-in .hero-arc { opacity: 0.08; }
.reveals-on .hero-arc [stroke] {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 2.4s var(--ease-soft);
}
.reveals-on .hero-arc [stroke]:nth-child(1) { transition-delay: 0.3s; }
.reveals-on .hero-arc [stroke]:nth-child(2) { transition-delay: 0.55s; }
.reveals-on .hero-arc [stroke]:nth-child(3) { transition-delay: 0.8s; }
.reveals-on .hero.hero-in .hero-arc [stroke] { stroke-dashoffset: 0; }

/* Slow Ken Burns drift for hero media */
.kenburns { animation: kenburns 28s var(--ease-soft) infinite alternate; }
@keyframes kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

/* Parallax — blocks.js drives --parallax-y on [data-parallax="speed"] */
[data-parallax] { transform: translateY(var(--parallax-y, 0px)); }

/* Media hover zoom — put on the clipped wrapper around an img */
.media-zoom { overflow: hidden; }
.media-zoom img {
  transition: transform 0.6s var(--ease-soft);
}
@media (hover: hover) {
  a:hover .media-zoom img,
  .media-zoom:hover img { transform: scale(1.045); }
}

/* ─── 9. CTA panel ───────────────────────────────────────────── */
.cta-panel {
  background: var(--bg-surface);
  padding: 80px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 90% at 50% 110%, var(--brand-dim) 0%, transparent 65%),
    radial-gradient(ellipse 60% 80% at 50% 50%, var(--amber-glow) 0%, transparent 70%);
}
.cta-panel-inner { position: relative; z-index: 1; }
.cta-panel .label { margin-bottom: 16px; }
.cta-panel .display-section,
.cta-panel .display-section-italic { margin-bottom: 16px; }
.cta-panel .body-text { max-width: 480px; margin: 0 auto 32px; }
.cta-panel .gold-line { margin: 20px auto; }

/* ─── 10. Utilities ──────────────────────────────────────────── */
.text-gold { color: var(--brand-text); }
.text-secondary { color: var(--text-secondary); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mt-64 { margin-top: 64px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-48 { margin-bottom: 48px; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 20px; }
  .section-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 32px;
  }
  .section-header { margin-bottom: 32px; }
  .cta-panel { padding: 56px 0; }
}

/* ─── Reduced motion: everything settles instantly ───────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* ─── 11. Accessibility primitives ───────────────────────────── */
/* Visually hidden, still read by assistive tech */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* One visible focus ring for every keyboard-focused control */
:focus-visible {
  outline: 2px solid var(--brand-light);
  outline-offset: 3px;
  border-radius: 3px;
}
.btn:focus-visible { outline-offset: 2px; border-radius: var(--radius-pill); }
/* Dialog containers receive focus programmatically; the modal itself is the cue */
[role="dialog"]:focus { outline: none; }
/* Content behind an open modal (inert fallback for older engines) */
[inert] { pointer-events: none; user-select: none; }
/* A button that reads as the card's title but makes the whole card clickable.
   The card needs position: relative. */
.card-btn {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; letter-spacing: inherit; line-height: inherit;
  text-align: inherit; cursor: pointer;
}
.card-btn::after { content: ''; position: absolute; inset: 0; }
.card-btn:focus-visible { outline: none; }
.has-card-btn { position: relative; }
.has-card-btn:focus-within {
  outline: 2px solid var(--brand-light);
  outline-offset: 3px;
}
/* Lists used purely for layout: keep the semantics, drop the bullets */
.plain-list { list-style: none; padding: 0; }
.plain-list > li { list-style: none; margin: 0; min-width: 0; }
/* A visible button that also makes its whole row/card clickable; the row needs position: relative */
.card-btn-stretch::after { content: ''; position: absolute; inset: 0; }
/* One-line title: ellipsis at the end of the first line; the full text shows in a tooltip on hover/focus.
   Works on the heading itself or on the .card-btn inside it. */
.truncate, .truncate > .card-btn {
  display: block; width: 100%; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Chip row that collapses to one line: main.js hides what overflows and appends a +N chip */
[data-chip-row] { flex-wrap: wrap; }
[data-chip-row] > .is-overflow { display: none; }
.chip-more {
  position: relative; z-index: 1;
  font: inherit; cursor: pointer;
  color: var(--text-primary);
}
.chip-more:hover, .chip-more:focus-visible { border-color: var(--brand-border); }
/* Shared tooltip (window.Tooltip): one element, positioned above its anchor, flips below near the top */
.tooltip {
  position: fixed; z-index: 1200; max-width: 280px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  font-family: var(--font-body); font-size: 12px; line-height: 1.45;
  pointer-events: none;
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--dur-quick) var(--ease-out), transform var(--dur-quick) var(--ease-out);
}
.tooltip.is-below { transform: translateY(-4px); }
.tooltip.is-visible { opacity: 1; transform: none; }
.tooltip[hidden] { display: none; }
.tooltip > ul { margin: 0; }
/* Focus sentinels bracket a dialog's content; they are never visible */
.focus-sentinel { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
