/* =============================================================
   29th Street Capital — modern product-UI redesign
   Structure & UI language follow the reference app aesthetic:
   soft light canvas, white elevated cards, pill badges, centered
   section headers, two-tone headings, small icon tiles.
   Brand colours and fonts remain 29SC's own:
   navy #0F426B · terracotta #D5835E · Lora + Barlow.
   ============================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* Brand */
  --navy: #0f426b;
  --navy-600: #14548a;
  --navy-700: #0c3859;
  --navy-deep: #08293f;
  --terracotta: #d5835e;
  --terracotta-dark: #b96842;

  /* Canvas — light, slightly cool, like the reference */
  --canvas: #f7f8fa;
  --canvas-alt: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f2f4f8;

  /* Ink */
  --ink: #101526;
  --ink-2: #33405a;
  --ink-muted: #4c566e;
  --ink-faint: #7b8598;

  /* Lines & tints */
  --line: rgba(15, 23, 42, 0.1);
  --line-2: rgba(15, 23, 42, 0.14);
  --line-dark: rgba(255, 255, 255, 0.14);
  --navy-tint: rgba(15, 66, 107, 0.09);
  --navy-tint-2: rgba(15, 66, 107, 0.06);
  --terra-tint: rgba(213, 131, 94, 0.12);

  /* Type */
  --font-display: 'Lora', Georgia, 'Times New Roman', serif;
  --font-text: 'Barlow', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --fs-h1: clamp(2.1rem, 1.5rem + 2.7vw, 3.3rem);
  --fs-h2: clamp(1.75rem, 1.35rem + 1.9vw, 2.8rem);
  --fs-h3: clamp(1.12rem, 1.05rem + 0.32vw, 1.28rem);
  --fs-h4: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --fs-body: 1rem;
  --fs-small: 0.9375rem;
  --fs-tiny: 0.84rem;
  --fs-pill: 0.72rem;

  --lh-head: 1.16;
  --lh-body: 1.72;

  /* Space */
  --gutter: clamp(1.15rem, 0.7rem + 2.2vw, 2.5rem);
  --section-y: clamp(4rem, 2.5rem + 5.5vw, 8rem);
  --shell: 1200px;
  --shell-wide: 1320px;
  --shell-text: 760px;
  --measure: 64ch;

  /* Radii — the reference's signature soft corners */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-pill: 100px;

  /* Shadows — soft, wide, low opacity */
  --sh-xs: 0 8px 24px -14px rgba(15, 23, 42, 0.16);
  --sh-sm: 0 10px 30px -18px rgba(15, 23, 42, 0.2);
  --sh-md: 0 18px 44px -22px rgba(15, 23, 42, 0.18);
  --sh-lg: 0 30px 70px -25px rgba(15, 23, 42, 0.22);
  --sh-navy: 0 10px 24px -12px rgba(15, 66, 107, 0.55);
  --sh-terra: 0 10px 24px -12px rgba(213, 131, 94, 0.5);

  --header-h: 76px;
  --ease: cubic-bezier(0.22, 0.61, 0.24, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 0.28s;
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, video, iframe { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }

/* ---------- 3. Accessibility ---------- */
:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; border-radius: 4px; }
.on-dark :focus-visible, .site-footer :focus-visible, .site-header :focus-visible {
  outline-color: #f0b08c;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -100%; z-index: 2000;
  background: var(--navy); color: #fff;
  padding: 0.8rem 1.35rem; border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--fs-tiny);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ---------- 4. Layout ---------- */
.shell {
  width: 100%; max-width: var(--shell);
  margin-inline: auto; padding-inline: var(--gutter);
}
.shell--wide { max-width: var(--shell-wide); }
.shell--text { max-width: var(--shell-text); }

.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(2.5rem, 1.8rem + 3vw, 4.5rem); }

.bg-canvas { background: var(--canvas); }
.bg-alt { background: var(--canvas-alt); }
.bg-white { background: var(--surface); }
.bg-navy { background: var(--navy); color: #e9f0f6; }
.bg-navy-deep { background: var(--navy-deep); color: #e3ecf3; }

.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4,
.bg-navy h1, .bg-navy h2, .bg-navy h3, .bg-navy h4,
.bg-navy-deep h1, .bg-navy-deep h2, .bg-navy-deep h3, .bg-navy-deep h4 { color: #fff; }

/* ---------- 5. Type ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-head);
  color: var(--ink);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.4; }
h4 { font-size: var(--fs-h4); line-height: 1.45; }

/* Two-tone heading — the reference's signature move */
.accent { color: var(--navy); }
.accent-2 { color: var(--terracotta); }
.on-dark .accent, .bg-navy .accent, .bg-navy-deep .accent { color: #8fc0e4; }

p { max-width: var(--measure); }
p + p { margin-top: 1em; }

.lede {
  font-size: clamp(1rem, 0.96rem + 0.28vw, 1.12rem);
  line-height: 1.68;
  color: var(--ink-muted);
  max-width: 62ch;
}
.on-dark .lede, .bg-navy .lede, .bg-navy-deep .lede { color: rgba(255, 255, 255, 0.78); }
.muted { color: var(--ink-muted); }

/* ---------- 6. Pill badge ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.48rem 0.85rem;
  background: var(--navy-tint);
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-pill);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}
.pill--terra { background: var(--terra-tint); color: var(--terracotta-dark); }
.pill--plain {
  background: var(--surface);
  color: var(--ink-muted);
  border-color: var(--line-2);
  box-shadow: var(--sh-xs);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
}
.pill--dark {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 7. Section header (centered) ---------- */
.sec-head {
  max-width: 44rem;
  margin: 0 auto clamp(2.25rem, 1.6rem + 2.4vw, 3.5rem);
  text-align: center;
}
.sec-head .pill { margin-bottom: 1.1rem; }
.sec-head p { margin-inline: auto; }
.sec-head .lede { margin-top: 1rem; }
.sec-head--left { margin-inline: 0; text-align: left; }
.sec-head--left p { margin-inline: 0; }

/* ---------- 8. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: 46px;
  padding: 0.72rem 1.45rem;
  background: var(--navy);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: var(--fs-tiny);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--sh-navy);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn:hover { transform: translateY(-2px); background: var(--navy-600); box-shadow: 0 16px 30px -14px rgba(15, 66, 107, 0.62); }
.btn:active { transform: translateY(0); }

.btn--accent { background: var(--terracotta); box-shadow: var(--sh-terra); }
.btn--accent:hover { background: var(--terracotta-dark); box-shadow: 0 16px 30px -14px rgba(213, 131, 94, 0.6); }

.btn--soft {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-2);
  box-shadow: var(--sh-xs);
}
.btn--soft:hover { background: var(--surface); color: var(--navy); border-color: var(--navy); box-shadow: var(--sh-sm); }

.btn--ghost { background: transparent; color: var(--navy); border-color: var(--line-2); box-shadow: none; }
.btn--ghost:hover { background: var(--navy-tint-2); border-color: var(--navy); box-shadow: none; }

.btn--on-dark { background: #fff; color: var(--navy); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5); }
.btn--on-dark:hover { background: #fff; color: var(--navy-700); }

.btn--outline-dark {
  background: transparent; color: #fff;
  border-color: rgba(255, 255, 255, 0.35); box-shadow: none;
}
.btn--outline-dark:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; color: #fff; }

.btn--sm { min-height: 38px; padding: 0.5rem 1.1rem; font-size: 0.8rem; }

/* Quiet inline link */
.tlink {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-size: var(--fs-tiny);
  font-weight: 600;
  color: var(--navy);
  transition: gap var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tlink:hover { gap: 0.7em; color: var(--terracotta-dark); }
.on-dark .tlink, .bg-navy .tlink, .bg-navy-deep .tlink { color: #9ecbe9; }
.on-dark .tlink:hover { color: #fff; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }
.cta-row--center { justify-content: center; }

/* ---------- 9. Cards ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
  height: 100%;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--line-2); }
.card h3 { margin-bottom: 0.55rem; }
.card p { color: var(--ink-muted); font-size: var(--fs-small); max-width: none; }
.card__foot { margin-top: auto; padding-top: 1.1rem; }

.card--flat { box-shadow: none; }
.card--flat:hover { transform: none; box-shadow: var(--sh-sm); }
.card--media { padding: 0; overflow: hidden; }
.card--dark {
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.12);
}
.card--dark:hover { background: rgba(255, 255, 255, 0.085); border-color: rgba(255, 255, 255, 0.22); }
.card--dark p { color: rgba(255, 255, 255, 0.74); }

/* Small square icon tile inside cards */
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: var(--r-sm);
  background: var(--navy-tint);
  color: var(--navy);
  margin-bottom: 1.1rem;
  flex: none;
}
.tile svg { width: 20px; height: 20px; }
.tile--terra { background: var(--terra-tint); color: var(--terracotta-dark); }
.tile--solid { background: var(--navy); color: #fff; }
.tile--dark { background: rgba(255, 255, 255, 0.12); color: #fff; }
.tile--num {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}

/* ---------- 10. Media ---------- */
.media { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-md); }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease-out); }
.media--4x3 { aspect-ratio: 4 / 3; }
.media--3x2 { aspect-ratio: 3 / 2; }
.media--16x9 { aspect-ratio: 16 / 9; }
.media--1x1 { aspect-ratio: 1 / 1; }
.media--portrait { aspect-ratio: 3 / 4; }
.media--flush { border-radius: 0; }
a:hover > .media img, .card:hover .media img, .plate:hover .media img { transform: scale(1.04); }

/* ---------- 11. Grids ---------- */
/* Card grids: fixed column counts so rows stay even at every size.
   Three across on desktop everywhere, two on tablet, one on phone. */
.grid { display: grid; gap: clamp(1.4rem, 1rem + 1.6vw, 2.25rem); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1000px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}
.stack > * + * { margin-top: 1.2rem; }

/* ---------- 12. Motion ---------- */
.reveal { opacity: 1; transform: none; }
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .reveal[data-delay="1"] { transition-delay: 0.07s; }
.js .reveal[data-delay="2"] { transition-delay: 0.14s; }
.js .reveal[data-delay="3"] { transition-delay: 0.21s; }
.js .reveal[data-delay="4"] { transition-delay: 0.28s; }
.js .reveal[data-delay="5"] { transition-delay: 0.35s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}

@media print {
  .site-header, .site-footer, .skip-link, .hero__controls { display: none !important; }
  body { background: #fff; color: #000; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}
