/* ========================================
   DESIGN TOKENS
   ======================================== */
:root {
  /* Colors — Sage Green palette */
  --color-bg: #f7f7f4;
  --color-surface: #ffffff;
  --color-text: #2c2c2a;
  --color-text-secondary: #636360;
  --color-text-tertiary: #8a8a85;
  --color-accent: #6b8f71;
  --color-accent-hover: #567358;
  --color-border: #ddddd8;
  --color-border-light: #eeeee9;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 10rem;

  /* Elevation — sage-tinted rather than neutral gray, so lift reads as part
     of the palette. Used by any "this matters" surface: .featured__card,
     .cs-glance, .cs-metrics. Pair with --color-surface fill, never --color-bg
     (that's the page background, which leaves a card with no fill contrast). */
  --shadow-card: 0 12px 40px rgba(107, 143, 113, 0.10);
  --shadow-card-hover: 0 18px 52px rgba(107, 143, 113, 0.20);

  /* Layout */
  --max-width: 1200px;
  --nav-height: 72px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration: 0.4s;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

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

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* Print reset — `overflow-x: clip` above forces the computed overflow-y to
   clip too, which clips <body> on both axes and breaks print pagination in
   Chromium (blank/failed preview). Restore normal flow for printing. */
@media print {
  html,
  body {
    overflow: visible !important;
    height: auto !important;
  }
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

ul {
  list-style: none;
}

/* ========================================
   UTILITIES
   ======================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--color-accent);
  color: #fff;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  z-index: 1000;
  font-weight: 500;
  font-size: 0.875rem;
}

.skip-link:focus {
  top: var(--space-sm);
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ========================================
   NAVIGATION
   ======================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(247, 247, 244, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border-light);
  transition: transform var(--duration) var(--ease-out);
}

.nav--hidden {
  transform: translateY(-100%);
}

.nav nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.nav__logo {
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav__links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: color 0.2s ease;
  padding: var(--space-xs) 0;
}

.nav__links a:hover {
  color: var(--color-text);
}

.nav__cta {
  background: var(--color-text);
  color: var(--color-bg) !important;
  padding: 0.625rem 1.25rem !important;
  border-radius: 100px;
  transition: background 0.2s ease, transform 0.2s ease !important;
}

.nav__cta:hover {
  background: var(--color-accent) !important;
  transform: translateY(-1px);
}

/* Mobile toggle */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.nav__toggle-bar {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s ease;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:first-child {
  transform: translateY(4px) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-bar:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* Mobile menu */
.mobile-menu {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-menu[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu ul {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.mobile-menu a {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: var(--space-xs) 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ========================================
   HERO
   ======================================== */
.hero {
  padding: calc(var(--nav-height) + var(--space-3xl)) 0 var(--space-3xl);
  min-height: 85vh;
  display: flex;
  align-items: center;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 800px;
  color: var(--color-text);
}

.hero__title em {
  font-style: italic;
  color: var(--color-accent);
}

.hero__subtitle {
  margin-top: var(--space-lg);
  font-size: clamp(1.0625rem, 1.5vw, 1.25rem);
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 580px;
}

.hero__subtitle strong {
  color: var(--color-text);
  font-weight: 600;
}

.hero__scroll {
  margin-top: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero__scroll svg {
  animation: float 2s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ========================================
   PROJECTS
   ======================================== */
/* Featured (Approach) block — distinct from the project cards */
.featured {
  padding: var(--space-xl) 0 0;
}

.featured__card {
  display: block;
  padding: var(--space-xl);
  border-radius: 16px;
  /* White fill, not a sage wash: the eyebrow and link are both --color-accent,
     and accent-on-accent-tint kills the figure/ground separation that makes
     sage read as an accent at all. */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}

@media (hover: hover) {
  .featured__card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--color-accent);
  }
}

.featured__meta {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.featured__title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
  max-width: 720px;
}

.featured__desc {
  margin-top: var(--space-md);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
  max-width: 620px;
}

.featured__link {
  display: inline-block;
  margin-top: var(--space-md);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-accent);
}

.work {
  padding: var(--space-2xl) 0 var(--space-3xl);
}

.project {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: var(--space-xl);
  align-items: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--color-border);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.project:last-child {
  border-bottom: 1px solid var(--color-border);
}

@media (hover: hover) {
  .project:hover {
    opacity: 0.85;
  }

  .project:hover .project__link {
    color: var(--color-accent);
  }

  .project:hover .project__placeholder,
  .project:hover .project__screenshot {
    transform: scale(1.02);
  }
}

.project--reverse {
  grid-template-columns: 1fr 1.2fr;
  direction: rtl;
}

.project--reverse > * {
  direction: ltr;
}

.project__image {
  border-radius: 12px;
  overflow: hidden;
}

.project__screenshot {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: top left;
  display: block;
  transition: transform var(--duration) var(--ease-out);
}

.project__placeholder {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  transition: transform var(--duration) var(--ease-out);
}

/* More work (lighter section: Meridian + galleries) */
.more {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--color-border);
}

.more__label {
  font-size: 0.8125rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-lg);
}

.more__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.more__card {
  display: block;
  text-decoration: none;
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .more__card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
  }
}

.more__type {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-accent);
}

.more__title {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin: 0.4rem 0 0.5rem;
}

.more__desc {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--color-text-secondary);
}

@media (max-width: 780px) {
  .more__grid {
    grid-template-columns: 1fr;
  }
}

.project__meta {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}

.project__title {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.project__desc {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
  max-width: 440px;
}

.project__link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
  transition: color 0.2s ease;
}

/* ========================================
   ABOUT
   ======================================== */
.about {
  padding: var(--space-3xl) 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: var(--space-xl);
  align-items: start;
}

.about__photo-img {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 30%;
  border-radius: 12px;
  display: block;
}

.about__photo-placeholder {
  aspect-ratio: 3 / 4;
  background: var(--color-border-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  max-width: 360px;
}

.about__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
}

.about__content p {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.about__content p:last-of-type {
  margin-bottom: var(--space-lg);
}

.about__links {
  display: flex;
  gap: var(--space-md);
  row-gap: var(--space-sm);
  flex-wrap: wrap;
}

.about__links a {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--color-text);
  padding: 10px 0;
  border-bottom: 1.5px solid var(--color-border);
  transition: border-color 0.2s ease, color 0.2s ease;
}

@media (hover: hover) {
  .about__links a:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
  }
}

/* ========================================
   CONTACT
   ======================================== */
.contact {
  padding: var(--space-3xl) 0;
  text-align: center;
}

.contact__title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.contact__subtitle {
  margin-top: var(--space-md);
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

.contact__email {
  display: inline-block;
  margin-top: var(--space-xl);
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: var(--color-accent);
  padding-bottom: 4px;
  border-bottom: 2px solid var(--color-accent);
  transition: opacity 0.2s ease;
}

.contact__email:hover {
  opacity: 0.7;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--color-border-light);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-text-tertiary);
}

.footer__inner a {
  color: var(--color-text-tertiary);
  margin-left: var(--space-md);
  padding: 10px 0;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .footer__inner a:hover {
    color: var(--color-text);
  }
}

/* ========================================
   SCROLL ANIMATIONS
   ======================================== */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.fade-in--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered delays for grouped elements */
.fade-in[data-delay="1"] { transition-delay: 0.1s; }
.fade-in[data-delay="2"] { transition-delay: 0.2s; }
.fade-in[data-delay="3"] { transition-delay: 0.3s; }
.fade-in[data-delay="4"] { transition-delay: 0.4s; }

/* Hero entrance animation */
.hero__title,
.hero__subtitle,
.hero__scroll {
  opacity: 0;
  transform: translateY(20px);
  animation: heroEntrance 0.8s var(--ease-out) forwards;
}

.hero__title { animation-delay: 0.1s; }
.hero__subtitle { animation-delay: 0.3s; }
.hero__scroll { animation-delay: 0.5s; }

@keyframes heroEntrance {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Case study page entrance */
.cs-hero__back,
.cs-hero__meta,
.cs-hero__title,
.cs-hero__summary,
.cs-hero__details {
  opacity: 0;
  transform: translateY(16px);
  animation: heroEntrance 0.7s var(--ease-out) forwards;
}

.cs-hero__back { animation-delay: 0.05s; }
.cs-hero__meta { animation-delay: 0.1s; }
.cs-hero__title { animation-delay: 0.2s; }
.cs-hero__summary { animation-delay: 0.35s; }
.cs-hero__details { animation-delay: 0.5s; }

/* ========================================
   EASTER EGG
   ======================================== */
.easter-egg {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(44, 44, 42, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.easter-egg--active {
  opacity: 1;
  pointer-events: auto;
}

.easter-egg__toast {
  position: absolute;
  top: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #3d3d3a;
  color: #e8e8e3;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.4;
  border: 1px solid #4d4d4a;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease-out);
  max-width: calc(100vw - 48px);
}

.easter-egg__toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.easter-egg__toast strong {
  display: block;
  color: #a3bfa8;
  font-size: 0.9375rem;
  margin-bottom: 2px;
}

.easter-egg__trophy {
  font-size: 1.5rem;
}

#pong-canvas {
  border-radius: 12px;
  max-width: 90vw;
  max-height: 70vh;
  height: auto;
}

.easter-egg__close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: #8a8a85;
  font-size: 1.5rem;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.2s ease, background 0.2s ease;
}

.easter-egg__close:hover {
  color: #e8e8e3;
  background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 900px) {
  .project {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .project--reverse {
    grid-template-columns: 1fr;
    direction: ltr;
  }

  .about__grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .about__photo-placeholder {
    aspect-ratio: 16 / 9;
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .nav__links {
    display: none;
  }

  .nav__toggle {
    display: flex;
  }

  .hero {
    min-height: 70vh;
    padding-top: calc(var(--nav-height) + var(--space-2xl));
    padding-bottom: var(--space-2xl);
  }

  .project {
    padding: var(--space-lg) 0;
  }

  .project__desc {
    max-width: 100%;
  }

  .footer__inner {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  .footer__inner a:first-child {
    margin-left: 0;
  }

  /* ⚠ `.hero__title br { display: none }` was REMOVED here 2026-08-25. It existed for the
     old two-line headline ("I design products people<br>don't want to put down"), which had
     to reflow on narrow screens. The hero is now three deliberate one-line beats —
     Build it. / Feel it. / Ship it. — and the longest is 9 characters, which fits inside the
     2.5rem mobile floor of the clamp with room to spare. Suppressing the breaks would
     re-wrap them unevenly ("Build it. Feel it." / "Ship it."). Don't add it back. */
}

/* Short screens (landscape phones) */
@media (max-height: 500px) {
  .hero {
    min-height: auto;
    padding-top: calc(var(--nav-height) + var(--space-lg));
    padding-bottom: var(--space-lg);
  }
}
