/* ============================================================
   Patrick Carey / Portfolio
   Newcastle black & white + Dartmouth pine green
   Space Grotesk / Inter · light & dark themes, token-driven
   ============================================================ */

:root {
  /* Brand: Dartmouth pine ramp */
  --pine-300: #63dfa4;
  --pine-400: #38cf8b;
  --pine-500: #10a56b;
  --pine-600: #00875a;
  --pine-700: #00693e;
  --pine-900: #003722;

  /* Typography */
  --font-heading: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Spacing (spacious scale) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 96px;
  --space-7: 144px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 200ms;
  --dur-med: 400ms;
  --dur-slow: 800ms;

  --radius: 16px;
  --radius-lg: 24px;
}

/* ---- Dark theme (default) ---- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-background: #0a0c0b;
  --color-surface: rgba(255, 255, 255, 0.03);
  --color-glass: rgba(12, 15, 14, 0.6);
  --color-foreground: #ffffff;
  --color-muted-fg: #a3aca7;
  --color-border: rgba(255, 255, 255, 0.12);
  --color-accent: var(--pine-700);
  --color-accent-text: var(--pine-400);
  --color-accent-soft: rgba(16, 165, 107, 0.12);
  --color-on-accent: #ffffff;
  --shadow-lift: 0 28px 60px rgba(0, 0, 0, 0.65);
  --dot-color: rgba(255, 255, 255, 0.08);
  --tint-opacity: 0.14;
}

/* ---- Light theme ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --color-background: #ffffff;
  --color-surface: rgba(10, 12, 11, 0.025);
  --color-glass: rgba(255, 255, 255, 0.65);
  --color-foreground: #0b0f0d;
  --color-muted-fg: #4d5752;
  --color-border: rgba(10, 12, 11, 0.12);
  --color-accent: var(--pine-700);
  --color-accent-text: var(--pine-700);
  --color-accent-soft: rgba(0, 105, 62, 0.08);
  --color-on-accent: #ffffff;
  --shadow-lift: 0 28px 60px rgba(10, 12, 11, 0.14);
  --dot-color: rgba(10, 12, 11, 0.1);
  --tint-opacity: 0.07;
}

/* ============ Reset & base ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  position: relative;
  font-family: var(--font-sans);
  font-weight: 400;
  background: var(--color-background);
  color: var(--color-foreground);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--dur-med) ease, color var(--dur-med) ease;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
}

img, iframe { max-width: 100%; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--pine-700); color: #ffffff; }

.container {
  width: min(1120px, 100% - var(--space-4));
  margin-inline: auto;
}

/* ============ Skip link ============ */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-2);
  z-index: 200;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--pine-700);
  color: var(--color-on-accent);
  font-weight: 600;
  transition: top var(--dur-fast) ease;
}

.skip-link:focus-visible { top: var(--space-2); }

/* ============ Backdrop (constellation canvas + faint pine tint) ============ */
#constellation {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -11;
  pointer-events: none;
}

.backdrop {
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 760px;
  overflow: hidden;
  z-index: -10;
  pointer-events: none;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: -180px;
  height: 520px;
  background: radial-gradient(55% 65% at 50% 0%, rgba(0, 135, 90, var(--tint-opacity)), transparent 75%);
}

/* ============ Glass utility ============ */
.glass {
  background: var(--color-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
}

/* ============ Navigation ============ */
.nav-wrap {
  position: fixed;
  top: var(--space-2);
  left: 0; right: 0;
  z-index: 100;
  padding-inline: var(--space-2);
}

.nav {
  width: min(1120px, 100%);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 10px 22px;
  border-radius: 999px;
  transition: box-shadow var(--dur-med) var(--ease-out), background var(--dur-med) ease;
}

.nav.scrolled { box-shadow: var(--shadow-lift); }

.nav-logo {
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 23px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color var(--dur-fast) ease;
}

.nav-logo:hover { color: var(--color-accent-text); }

.logo-flourish {
  color: var(--color-accent-text);
  font-style: normal;
}

.nav-right { display: flex; align-items: center; gap: 6px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-link {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--color-muted-fg);
  cursor: pointer;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
}

.nav-link:hover { color: var(--color-foreground); background: var(--color-surface); }

.nav-link.active { color: var(--color-foreground); }

.nav-cta {
  color: var(--color-on-accent);
  background: var(--pine-700);
  font-weight: 600;
}

.nav-cta:hover { color: var(--color-on-accent); background: var(--pine-600); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: none;
  color: var(--color-muted-fg);
  cursor: pointer;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.theme-toggle:hover { color: var(--color-foreground); transform: rotate(15deg); }

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 12px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--color-foreground);
  border-radius: 2px;
  transition: transform var(--dur-fast) ease, opacity var(--dur-fast) ease;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
}

.btn:active { transform: scale(0.97); }

.btn svg { transition: transform var(--dur-fast) var(--ease-out); }
.btn:hover svg { transform: translate(2px, -2px); }

.btn-primary {
  background: var(--pine-700);
  color: var(--color-on-accent);
}

.btn-primary:hover {
  background: var(--pine-600);
  box-shadow: 0 8px 32px rgba(0, 135, 90, 0.35);
  transform: translateY(-2px);
}

.btn-ghost {
  border-color: var(--color-border);
  color: var(--color-foreground);
  background: var(--color-surface);
}

.btn-ghost:hover {
  border-color: var(--color-muted-fg);
  transform: translateY(-2px);
}

.btn-lg { padding: 16px 30px; font-size: 16px; }

/* ============ Hero ============ */
.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: var(--space-6);
  /* Reserve room for the absolutely-positioned marquee band below */
  padding-bottom: 150px;
  position: relative;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--color-muted-fg);
  margin-bottom: var(--space-3);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pine-500);
  box-shadow: 0 0 10px var(--pine-500);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.hero-title {
  font-size: clamp(44px, 8vw, 88px);
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin-bottom: var(--space-3);
}

.hero-em {
  font-style: normal;
  background: linear-gradient(100deg, var(--pine-600), var(--pine-400) 70%, var(--pine-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

:root[data-theme="light"] .hero-em {
  background: linear-gradient(100deg, var(--pine-900), var(--pine-700) 60%, var(--pine-500));
  -webkit-background-clip: text;
  background-clip: text;
}

.line-mask { display: block; overflow: hidden; }

.line {
  display: block;
  transform: translateY(110%);
  animation: line-up 900ms var(--ease-out) forwards;
}

.line-mask:nth-child(1) .line { animation-delay: 100ms; }
.line-mask:nth-child(2) .line { animation-delay: 220ms; }
.line-mask:nth-child(3) .line { animation-delay: 340ms; }

@keyframes line-up { to { transform: translateY(0); } }

.hero-sub {
  max-width: 520px;
  font-size: 18px;
  color: var(--color-muted-fg);
  margin-bottom: var(--space-4);
}

.hero-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Marquee */
.hero-marquee {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  padding-block: var(--space-3);
  overflow: hidden;
  border-top: 1px solid var(--color-border);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.marquee-track {
  display: flex;
  gap: 28px;
  width: max-content;
  animation: marquee 36s linear infinite;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--color-muted-fg);
  white-space: nowrap;
}

@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ Sections ============ */
.section { padding-block: var(--space-7); }

.section-head { max-width: 640px; margin-bottom: var(--space-5); }

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  margin-bottom: var(--space-2);
}

.section-title {
  font-size: clamp(30px, 4.5vw, 46px);
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin-bottom: var(--space-2);
}

.section-sub { color: var(--color-muted-fg); font-size: 17px; }

/* ============ Case study ============ */
.case-study {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-5);
  align-items: center;
}

.case-meta { display: flex; gap: 10px; margin-bottom: var(--space-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  color: var(--color-muted-fg);
}

.chip-live {
  color: var(--color-accent-text);
  border-color: rgba(16, 165, 107, 0.45);
  background: var(--color-accent-soft);
}

.case-title {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2);
}

.case-desc { color: var(--color-muted-fg); margin-bottom: var(--space-3); }

.case-points {
  list-style: none;
  margin-bottom: var(--space-3);
  display: grid;
  gap: 12px;
}

.case-points li {
  position: relative;
  padding-left: 26px;
  color: var(--color-muted-fg);
  font-size: 15px;
}

.case-points li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 12px; height: 12px;
  border-radius: 3px;
  background: var(--color-accent-soft);
  border: 1px solid rgba(16, 165, 107, 0.6);
}

.case-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }

.case-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.tag {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-muted-fg);
}

/* Browser frame */
.browser-frame {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lift);
  transition: transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}

.browser-frame:hover { transform: translateY(-6px); }

.browser-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-border);
}

.b-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
}

.b-dot:nth-child(1) { background: #f87171; }
.b-dot:nth-child(2) { background: #fbbf24; }
.b-dot:nth-child(3) { background: #34d399; }

.browser-url {
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--color-muted-fg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 5px 14px;
  border-radius: 999px;
  flex: 1;
  text-align: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-body {
  position: relative;
  aspect-ratio: 16 / 10.5;
  overflow: hidden;
  background: var(--color-surface);
}

/* Render the embedded site at 2x the frame size, scaled to 50%, so it
   lays out at desktop width and fills the frame completely. Absolutely
   positioned (and max-width reset overridden) so its layout box can't
   stretch the aspect-ratio container. */
.browser-body iframe {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  width: 200%;
  height: 200%;
  border: 0;
  transform: scale(0.5);
  transform-origin: top left;
  pointer-events: none;
  background: #fff;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: var(--space-2);
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.4));
  opacity: 0;
  transition: opacity var(--dur-fast) ease;
  cursor: pointer;
}

.browser-frame:hover .preview-overlay,
.preview-overlay:focus-visible { opacity: 1; }

.preview-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--pine-700);
  color: var(--color-on-accent);
}

/* ============ Projects grid ============ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-3);
}

.project-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--dur-med) var(--ease-out),
              border-color var(--dur-fast) ease,
              box-shadow var(--dur-med) var(--ease-out);
}

a.project-card { cursor: pointer; }

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(16, 165, 107, 0.5);
  box-shadow: var(--shadow-lift);
}

.project-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.project-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.45));
}

.project-glyph {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.04em;
  transition: transform var(--dur-med) var(--ease-out);
}

.project-card:hover .project-glyph { transform: scale(1.12) rotate(-3deg); }

.project-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-name {
  font-size: 19px;
  letter-spacing: -0.015em;
}

.project-desc { color: var(--color-muted-fg); font-size: 14.5px; }

.project-challenge {
  font-size: 13.5px;
  color: var(--color-muted-fg);
  border-left: 2px solid var(--pine-600);
  padding-left: 12px;
  flex: 1;
}

.project-challenge strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent-text);
  margin-bottom: 3px;
}

.project-tags { display: flex; flex-wrap: wrap; gap: 7px; }

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--color-muted-fg);
  margin-top: 4px;
  transition: color var(--dur-fast) ease;
}

.project-card:hover .project-link { color: var(--color-accent-text); }

/* ============ About ============ */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-5);
  align-items: start;
}

.about-copy { display: grid; gap: var(--space-2); }

.about-copy p { color: var(--color-muted-fg); font-size: 17px; max-width: 60ch; }

.about-copy strong { color: var(--color-foreground); font-weight: 600; }

.about-side {
  display: grid;
  gap: var(--space-2);
  position: sticky;
  top: 120px;
}

/* Timeline */
.timeline {
  list-style: none;
  position: relative;
  display: grid;
  gap: var(--space-4);
  padding-left: 0;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 24px;
  bottom: 24px;
  width: 2px;
  background: linear-gradient(180deg, var(--pine-500), var(--color-border));
}

.timeline-item {
  position: relative;
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
}

.timeline-logo {
  position: relative;
  z-index: 1;
  flex: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  box-shadow: 0 0 0 4px var(--color-background);
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) ease;
}

.timeline-item:hover .timeline-logo {
  transform: scale(1.08);
  border-color: rgba(16, 165, 107, 0.5);
}

.timeline-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.timeline-mono {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--color-accent-text);
}

.timeline-when {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent-text);
  margin-bottom: 2px;
}

.timeline-org {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.timeline-role {
  font-size: 13.5px;
  color: var(--color-muted-fg);
  margin-top: 2px;
}

/* ============ Contact ============ */
.contact { padding-bottom: var(--space-6); }

.contact-card {
  border-radius: var(--radius-lg);
  padding: clamp(var(--space-4), 7vw, var(--space-6));
  text-align: center;
  position: relative;
  overflow: hidden;
}

.contact-card::before {
  content: "";
  position: absolute;
  top: -140px; left: 50%;
  transform: translateX(-50%);
  width: 480px; height: 280px;
  background: radial-gradient(ellipse, rgba(0, 135, 90, 0.16), transparent 70%);
  pointer-events: none;
}

.contact-title {
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-2);
}

.contact-sub {
  color: var(--color-muted-fg);
  max-width: 440px;
  margin: 0 auto var(--space-4);
}

/* Contact form */
.contact-form {
  max-width: 560px;
  margin: 0 auto var(--space-4);
  display: grid;
  gap: var(--space-2);
  text-align: left;
  position: relative;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.form-field { display: grid; gap: 6px; }

.form-field label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent-text);
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 15px;
  resize: vertical;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.form-field input:focus-visible,
.form-field textarea:focus-visible {
  outline: none;
  border-color: var(--pine-500);
  box-shadow: 0 0 0 3px rgba(16, 165, 107, 0.2);
}

.botcheck {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

.form-submit { justify-content: center; }

.form-submit:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.form-status {
  min-height: 1.4em;
  text-align: center;
  font-size: 14px;
  color: var(--color-muted-fg);
}

.form-status.is-success { color: var(--color-accent-text); }
.form-status.is-error { color: #ef4444; }

:root[data-theme="light"] .form-status.is-error { color: #b91c1c; }

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.contact-links { display: flex; gap: 12px; }

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  color: var(--color-muted-fg);
  cursor: pointer;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.icon-link:hover {
  color: var(--color-foreground);
  border-color: var(--color-muted-fg);
  transform: translateY(-3px);
}

.back-to-top {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-muted-fg);
  cursor: pointer;
  transition: color var(--dur-fast) ease;
}

.back-to-top:hover { color: var(--color-foreground); }

/* ============ Scroll reveal ============ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}

.reveal.in-view { opacity: 1; transform: translateY(0); }

.project-grid .reveal:nth-child(2) { transition-delay: 80ms; }
.project-grid .reveal:nth-child(3) { transition-delay: 160ms; }
.project-grid .reveal:nth-child(4) { transition-delay: 240ms; }
.project-grid .reveal:nth-child(5) { transition-delay: 320ms; }
.project-grid .reveal:nth-child(6) { transition-delay: 400ms; }

.about-side .reveal:nth-child(2) { transition-delay: 90ms; }
.about-side .reveal:nth-child(3) { transition-delay: 180ms; }
.about-side .reveal:nth-child(4) { transition-delay: 270ms; }

/* ============ Focus states ============ */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--pine-500);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .case-study { grid-template-columns: 1fr; gap: var(--space-4); }
  .case-preview { order: -1; }
  .about-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .about-side { position: static; }
  .section { padding-block: var(--space-6); }
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: calc(100% + 10px);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-2);
    gap: 4px;
    border-radius: var(--radius-lg);
    background: var(--color-background);
    border: 1px solid var(--color-border);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
  }

  .nav-links.open { opacity: 1; transform: translateY(0); pointer-events: auto; }

  .nav-link { display: block; text-align: center; padding: 13px; }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

  .hero-sub { font-size: 16.5px; }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .contact-actions .btn { width: 100%; justify-content: center; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============ Reduced motion ============ */
@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;
  }

  .line { transform: none; animation: none; }
  .reveal { opacity: 1; transform: none; }
  .marquee-track { animation: none; }
}
