/* ==========================================================================
   Portfolio styles
   - responsive, accessible, no-framework
   ========================================================================== */

:root {
  --bg: #05060a;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --muted-2: rgba(255, 255, 255, 0.54);
  --accent: #7cc7ff;
  --accent-2: #ff7bd1;
  --accent-green: #33f29a;

  --grid-line: rgba(255, 255, 255, 0.06);
  --grid-line-strong: rgba(255, 255, 255, 0.09);

  --shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  --radius: 18px;
  --radius-sm: 14px;
  --container: 1100px;

  /* Typography system (per spec) */
  --font-display: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-heading: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-sans-alt: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
}
/* iOS safe-area handling */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Prevent Safari bottom bar from covering content */
body {
  padding-bottom: calc(14px + var(--safe-bottom));
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }


/* TEST: disable fixed full-screen overlay to see if Safari URL bar collapses properly */
/*
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 119px,
      var(--grid-line) 120px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 119px,
      var(--grid-line) 120px
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 479px,
      var(--grid-line-strong) 480px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 479px,
      var(--grid-line-strong) 480px
    ),
    radial-gradient(1200px 900px at 30% 20%, rgba(255,255,255,0.05), transparent 60%),
    radial-gradient(1200px 900px at 70% 30%, rgba(255,255,255,0.03), transparent 60%),
    radial-gradient(900px 700px at 50% 90%, rgba(0,0,0,0.55), rgba(0,0,0,0.75));
}
*/


:focus-visible {
  outline: 2px solid rgba(124, 199, 255, 0.8);
  outline-offset: 3px;
  border-radius: 10px;
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin-inline: auto;
}

@media (min-width: 901px) {
  .container { width: min(var(--container), calc(100% - 80px)); }
}

/* Typography */
h1, h2, h3, h4, h5 {
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

/* Spec:
  H1 "H1" 104px/1.3 Manrope Medium (site hero uses h1)
  Heading 1 60px/1.4 Inter Bold (map to h2)
  H2 "H2" 64px/1.4 Manrope Medium (optional utility via .display-h2)
  Heading 2 28px/1.4 Inter Bold (map to h3)
  H3 "H3" 32px/1.8 Manrope Medium (optional utility via .display-h3)
  Heading 3 22px/1.4 Inter Bold (map to h4)
  Heading 5 18px/1.4 Inter Bold (map to h5)
  Body 16px/1.8 Manrope Regular (base body)
  Body 2 20px/1.8 Manrope Regular (lede)
  Small 14px/1.4 DM Mono Light (kicker/meta)
  P H4 20px/28 DM Sans Regular (optional utility via .text-sans)
*/

h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(44px, 7vw, 104px);
  line-height: 1.3;
}
h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(30px, 4.2vw, 60px);
  line-height: 1.4;
}
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.4;
}
h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.4;
}
h5 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 18px;
  line-height: 1.4;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.kicker {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 14px;
  line-height: 1.4;
}
.lede { color: var(--muted); font-size: 20px; line-height: 1.8; max-width: 62ch; }
.meta {
  color: var(--muted-2);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.4;
}
.text-sans {
  font-family: var(--font-sans-alt);
  font-weight: 400;
  font-size: 20px;
  line-height: 28px;
}
.display-h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.4;
}
.display-h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.8;
}
.active { color: var(--text); }

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 14px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.button:hover { border-color: rgba(255, 255, 255, 0.32); }
.button-ghost {
  border-color: rgba(255, 255, 255, 0.14);
  background: transparent;
}
.button-ghost:hover { background: rgba(255, 255, 255, 0.04); }

/* iOS Safari: reduce sticky+blur weirdness */
@supports (-webkit-touch-callout: none) {
  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(5, 6, 10, 0.85); /* solid-ish instead of blur */
  }
}

/* Header */
.site-header {
  padding-top: var(--safe-top);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px);
  background: rgba(5, 6, 10, 0.20);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 22px 0;
}
/* When menu is open, header becomes solid black like the reference */
body.menu-open .site-header {
  background: #000;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
/* Replace △ with an SVG logo */
.brand-logo {
  display: block;
  height: 64px;   /* tweak if needed */
  width: auto;
}

/* Make the header feel like the reference on mobile */
@media (max-width: 900px) {
  .site-header {
    background: rgba(5, 6, 10, 0.92);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .header-inner {
    padding: 16px 0; /* slightly tighter */
  }

  /* Reference image shows logo only on mobile */
  .brand-text {
    display: none;
  }

  .brand-logo {
    height: 56px; /* slightly larger for mobile */
  }

  /* Ensure hamburger stays clean: no button chrome */
  .nav-toggle {
    width: 56px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .nav-toggle:active,
  .nav-toggle:hover {
    background: transparent;
  }
}
.brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: rgba(255, 255, 255, 0.50);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.nav a {
  padding: 6px 8px;
  border-radius: 12px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.03); color: rgba(255, 255, 255, 0.72); }
.nav a.active { color: rgba(255, 255, 255, 0.82); background: rgba(255, 255, 255, 0.03); }

/* CTA accent like reference "get template" */
.cta-desktop,
.nav-mobile .button {
  border-color: rgba(51, 242, 154, 0.30);
  color: rgba(51, 242, 154, 0.95);
}
.cta-desktop:hover,
.nav-mobile .button:hover {
  border-color: rgba(51, 242, 154, 0.55);
  color: rgba(51, 242, 154, 1);
}

.nav-toggle {
  display: none;
  position: relative;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  color: var(--text);
}

.nav-toggle:hover {
  border: 0;
  background: transparent;
}

.nav-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26px;
  height: 26px;
  display: block;
  opacity: 1;
  transform: scale(1);
  transition: opacity 160ms ease, transform 160ms ease;
}

/* Hide X by default */
.nav-icon-close {
  opacity: 0;
  transform: scale(0.92);
}

.nav-toggle[aria-expanded="true"] .nav-icon-menu {
  opacity: 0;
  transform: scale(0.92);
}

.nav-toggle[aria-expanded="true"] .nav-icon-close {
  opacity: 1;
  transform: scale(1);
}


/* Overlay mobile menu layer (matches: .nav-layer#mobile-nav in your HTML) */
.nav-layer {
  position: fixed;
  inset: 0;
  z-index: 90;

  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;

  /* Force a clean stacking context so z-index is predictable */
  isolation: isolate;
}

.nav-layer.is-open {
  opacity: 1;
  pointer-events: auto;
}


.nav-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;

  border: 0;
  background: rgba(0, 0, 0, 0.001); /* visually transparent, still receives taps */
  padding: 0;
}

.nav-mobile {
  position: absolute;
  z-index: 2;

  top: calc(var(--safe-top) + 68px); /* start below header */
  left: 0;
  right: 0;

  padding: 22px 22px 18px;
  background: #000;
  border: 0;
  border-radius: 0;
  box-shadow: none;

  transform: translateY(-14px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

/* Animate panel in when layer opens */
.nav-layer.is-open .nav-mobile {
  transform: translateY(0);
  opacity: 1;
}

.nav-mobile .nav-link {
  display: block;
  padding: 18px 6px;
  border-radius: 0;
  color: rgba(255,255,255,0.86);
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-mobile .nav-link:hover {
  background: transparent;
  color: #fff;
}

.nav-mobile .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  .nav-layer,
  .nav-mobile,
  .nav-icon {
    transition: none;
  }
}

.hero, .page-hero, .project-hero {
  position: relative;
  overflow: hidden; /* safer on iOS Safari */
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 60px;
  padding: 90px 0 22px;
  align-items: center;
}
.hero-visual { display: grid; place-items: center; }

.hero-haze {
  display: none;
}

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.chip-strong {
  border-color: rgba(124, 199, 255, 0.35);
  background: rgba(124, 199, 255, 0.10);
  color: var(--text);
}

/* Glass frame */
.glass-frame {
  width: 100%;
  max-width: 420px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.frame-top {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
}
.frame-body { padding: 16px 16px 18px; }
.frame-title { margin: 0 0 6px; font-weight: 750; color: var(--text); }
.frame-sub { margin: 0 0 10px; }
.frame-link { color: rgba(124, 199, 255, 0.90); font-weight: 650; }
.frame-link:hover { color: rgba(124, 199, 255, 1); }

/* Sections */
.section { padding: 48px 0; }
.section-muted {
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.03));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
}
.section-sub { width: 100%; max-width: none; }
.section-actions { margin-top: 18px; }

/* Project hero: always stack title + subcopy */
.section-head.section-head-stack {
  flex-direction: column;
  align-items: flex-start;
}

.section-head.section-head-stack .section-sub {
  width: 100%;
  max-width: none;
}

/* Home featured cards */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.work-card {
  display: grid;
  grid-template-rows: auto 1fr; /* thumb sizes itself, text fills remaining */
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.work-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 199, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
}
.thumb {
  aspect-ratio: 16 / 9;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #05060a;
}
.work-info { padding: 14px 14px 16px; }
.work-info p { margin-bottom: 10px; }

/* Projects grid */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row .chip { cursor: pointer; user-select: none; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.project-tile {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  min-height: 220px;
}
.tile-thumb {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: saturate(1.02) contrast(1.02);
}
.tile-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.12), rgba(0,0,0,0.64));
}
.tile-overlay {
  position: relative;
  padding: 18px;
  display: grid;
  align-content: end;
  height: 100%;
}
.tile-overlay p { margin: 8px 0 10px; color: rgba(255, 255, 255, 0.76); }
.tile-overlay .meta { color: rgba(255, 255, 255, 0.62); }

/* Project case study */
.page-hero .container { padding: 46px 0 12px; }
.project-hero .container { padding: 46px 0 12px; }

.project-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.meta-box {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
}
.meta-label { margin: 0 0 2px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.meta-value { margin: 0; color: var(--text); font-weight: 650; }

.project-hero-media {
  margin-top: 18px;
  height: clamp(240px, 36vw, 420px);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
}

.prose { max-width: 78ch; }
.prose h2 { margin-top: 26px; }
.prose p, .prose li { color: var(--muted); font-size: 17px; line-height: 1.7; }
.prose ul { margin: 10px 0 0 18px; padding: 0; }
.image-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.figure {
  margin: 0;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.figure img { width: 100%; height: auto; }
.figure figcaption { padding: 10px 12px; color: var(--muted-2); font-size: 13px; }

.outcomes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.outcome {
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}
.outcome-number { margin: 0 0 4px; font-size: 28px; font-weight: 800; color: var(--text); }
.outcome-label { margin: 0; color: var(--muted); }
.next-row { margin-top: 20px; }

/* Contact */
.contact-card {
  display: grid;
  grid-template-columns: 1.5fr 0.5fr;
  align-items: end;
  gap: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: transparent;
  padding: 24px;
}
.contact-label { margin: 0 0 2px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.contact-value { margin: 0; color: var(--text); font-weight: 650; }
.contact-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Big contact statement */
#contact .section-head { display: none; }
#contact .contact-label { display: none; }
#contact .contact-value {
  font-family: 'Inter', sans-serif;
  font-weight: 800; /* try 800 first */
  font-size: clamp(18px, 5.5vw, 60px); /* smaller minimum fixes mobile */
  line-height: 1.15;                  /* tighter for big type */
  color: rgba(255, 255, 255, 0.92);
  max-width: 34ch;

  /* critical: stop overflow from long emails */
  overflow-wrap: anywhere;
  word-break: break-word;
}
#contact .contact-value a { color: inherit; }
#contact .contact-actions { justify-content: flex-end; }
#contact .contact-actions .button {
  min-width: min(360px, 100%);
  justify-content: center;
}

/* Footer */
.site-footer {
  padding: 28px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.footer-links { display: flex; gap: 12px; }
.footer-links a { padding: 8px 10px; border-radius: 12px; }
.footer-links a:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }

/* Responsive */
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .container { width: min(var(--container), calc(100% - 32px)); }

  .header-inner { grid-template-columns: 1fr auto; }
  .nav-desktop, .cta-desktop { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .hero-inner { grid-template-columns: 1fr; padding: 56px 0 12px; gap: 18px; }
  .lede { font-size: 16px; }

  .section-head { flex-direction: column; align-items: flex-start; }

  .contact-card { grid-template-columns: 1fr; }
  .contact-actions { width: 100%; justify-content: flex-start; }
  .contact-actions .button { width: 100%; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 900px) {
  #contact .contact-value {
    font-size: 21px;   /* or 22px if you want tighter */
    line-height: 1.2;
    max-width: 100%;
  }
}

#contact .contact-value a {
  display: inline-block;
  max-width: 100%;
}
.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: white;
  text-decoration: none;
  transition: transform 120ms ease, border-color 200ms ease, background 200ms ease;
  overflow: hidden;
  will-change: transform;
}

.hero-video {
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.10);
  display: block;
}



.button::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: radial-gradient(
    280px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255,255,255,0.20),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 180ms ease;
  pointer-events: none;
}

.button:hover::before { opacity: 1; }
.button:hover { transform: translateY(-1px); }

.button:active { transform: translateY(0px) scale(0.98); }

