/* ============================================================
   ESTUDIO CRAFT — Shared Design System
   estudiocraft.com · 2025
   ============================================================ */

/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  /* Colours */
  --ink:       #0a0a0a;
  --surface:   #111111;
  --lift:      #181818;
  --text:      #f0ede8;
  --mid:       #888888;
  --muted:     #505050;
  --dim:       #2a2a2a;
  --rule:      rgba(255,255,255,0.07);
  --border:    rgba(255,255,255,0.06);
  --hover-bg:  rgba(255,255,255,0.028);

  /* Typography */
  --f-serif: 'Playfair Display', Georgia, serif;
  --f-sans:  'Oswald', sans-serif;
  --f-mono:  'DM Mono', 'Courier New', monospace;
  --f-cond:  'Oswald', sans-serif;

  /* Type scale */
  --t-hero:  clamp(54px, 9vw, 128px);
  --t-h1:    clamp(34px, 4.8vw, 68px);
  --t-h2:    clamp(22px, 2.8vw, 34px);
  --t-body:  15px;
  --t-small: 13px;
  --t-micro: 10px;

  /* Layout */
  --max:    1280px;
  --gut:    64px;
  --t-ease: 0.22s ease;
}

@media (max-width: 1024px) { :root { --gut: 40px; } }
@media (max-width: 640px)  { :root { --gut: 24px; } .nav { gap: 12px; } }

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--f-sans);
  font-weight: 300;
  font-size: var(--t-body);
  line-height: 1.65;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ── NAVIGATION ──────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gut);
  height: 64px;
  border-bottom: 1px solid var(--rule);
  background: rgba(10,10,10,0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav-logo {
  display: flex;
  align-items: center;
}
.nav-logo .logo-wrap {
  position: relative;
  display: block;
  height: 34px;
}
.nav-logo .logo-wrap img {
  display: block;
  height: 34px;
  width: auto;
}
.nav-logo .logo-base {
  opacity: 0.75;
  transition: opacity 0.9s ease;
}
.nav-logo .logo-light {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.nav-logo:hover .logo-base { opacity: 1; }
.nav-logo:hover .logo-light { opacity: 1; }
.nav-logo-studio {
  font-family: var(--f-cond);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #232323;
  margin-left: 14px;
  position: relative;
  top: -1px;
}
.nav-links {
  display: flex; gap: 40px; align-items: center;
}
.nav-links a {
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: #797979;
  white-space: nowrap;
  transition: color var(--t-ease);
}
.nav-links a:hover,
.nav-links a.active { color: rgba(200,200,200,0.9); }

/* Mobile hamburger + menu */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 5px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 220;
}
.nav-burger span {
  display: block;
  height: 2px;
  width: 100%;
  background: rgba(240,237,232,0.6);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  top: 64px; left: 0; right: 0; bottom: 0;
  z-index: 199;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: rgba(10,10,10,0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--rule);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--t-ease), transform var(--t-ease), visibility var(--t-ease);
}
.mobile-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.mobile-menu a {
  font-family: var(--f-mono);
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #999999;
  padding: 20px var(--gut);
  border-bottom: 1px solid var(--rule);
  transition: color var(--t-ease), background var(--t-ease);
}
.mobile-menu a:last-child { border-bottom: none; }
.mobile-menu a:hover,
.mobile-menu a:active { color: rgba(240,237,232,0.95); background: rgba(255,255,255,0.03); }

.mm-work { border-bottom: 1px solid var(--rule); }
.mm-work-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  background: none; border: none; cursor: pointer;
  font-family: var(--f-mono);
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #999999;
  padding: 20px var(--gut);
}
.mm-caret { font-size: 18px; line-height: 1; transition: transform var(--t-ease); }
.mm-work.open .mm-caret { transform: rotate(90deg); }
.mm-submenu {
  max-height: 0;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
  transition: max-height 0.3s ease;
}
.mm-work.open .mm-submenu { max-height: 640px; }
.mm-submenu a {
  display: block;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px var(--gut) 14px calc(var(--gut) + 16px);
  border-top: 1px solid var(--rule);
  border-bottom: none;
}
.mm-submenu a:hover,
.mm-submenu a:active { color: rgba(240,237,232,0.9); background: rgba(255,255,255,0.03); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }
  .nav-logo .logo-wrap { height: 27px; }
  .nav-logo .logo-wrap img { height: 27px; }
}

/* Work dropdown submenu */
.nav-work { position: relative; align-self: stretch; height: 64px; display: flex; align-items: center; }
.nav-work::before { content: ''; position: absolute; top: 0; bottom: 0; right: 100%; width: 60px; }
.nav-work::after { content: ''; position: absolute; top: 0; bottom: 0; left: 100%; width: 10px; }
.nav-submenu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 300px;
  background: rgba(10,10,10,0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--rule);
  border-top: none;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--t-ease), transform var(--t-ease), visibility var(--t-ease);
  z-index: 210;
}
.nav-work:hover .nav-submenu,
.nav-work:focus-within .nav-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.nav-submenu a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 20px;
  font-family: var(--f-mono);
  font-size: 13px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  transition: color var(--t-ease), background var(--t-ease);
}
.nav-submenu a span { color: var(--dim); font-size: 13px; }
.nav-submenu a:hover {
  color: rgba(200,200,200,0.9);
  background: rgba(255,255,255,0.03);
}
.nav-submenu a:hover span { color: var(--muted); }

@media (max-width: 640px) {
  .nav-submenu { min-width: 240px; left: auto; right: 0; transform: translateY(-6px); }
  .nav-work:hover .nav-submenu, .nav-work:focus-within .nav-submenu { transform: translateY(0); }
}

/* Case page back-link */
.nav-back {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--t-ease);
}
.nav-back:hover { color: var(--text); }

@media (max-width: 640px) {
  .nav-links { gap: 24px; }
  .nav-links a { font-size: 11px; }
}

/* ── FOOTER ──────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--rule);
  padding: 52px var(--gut) 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-mark {
  display: inline-flex;
  align-items: center;
}
.footer-mark .logo-wrap {
  position: relative;
  display: block;
  height: 27px;
}
.footer-mark .logo-wrap img {
  display: block;
  height: 27px;
  width: auto;
}
.footer-mark .logo-base {
  opacity: 0.75;
  transition: opacity 0.9s ease;
}
.footer-mark .logo-light {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.footer-mark:hover .logo-base { opacity: 1; }
.footer-mark:hover .logo-light { opacity: 1; }
.footer-meta {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-top: 12px;
}
.footer-mbr { display: none; }
@media (max-width: 640px) { .footer-mbr { display: block; } }
.footer-right {
  text-align: right;
}
.footer-right a {
  font-family: var(--f-cond);
  font-size: 13px;
  letter-spacing: 0.10em;
  color: var(--mid);
  transition: color var(--t-ease);
  display: block;
  margin-bottom: 4px;
}
.footer-right a:hover { color: var(--text); }
.footer-copy {
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  letter-spacing: 0.10em;
  color: var(--muted);
  display: block;
  margin-top: 12px;
  line-height: 1.7;
}

@media (max-width: 640px) {
  .footer { flex-direction: column; align-items: flex-start; margin-top: 0; }
  .footer-right { text-align: left; }
}

/* ── SECTION LABEL ───────────────────────────────────────── */
.section-eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-micro);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
}

/* ── CASE CARD — shared across index + cases ─────────────── */
.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 36px 32px 13.1px;
  position: relative; overflow: hidden;
  cursor: pointer;
  transition: background var(--t-ease), border-color var(--t-ease);
}
.card:hover {
  background: #0f0f0f;
  border-color: rgba(255,255,255,0.14);
}
.card-num {
  font-family: var(--f-mono);
  font-size: 16px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  display: block;
  margin-bottom: 40px;
  transition: color var(--t-ease);
}
.card:hover .card-num { color: var(--muted); }

/* Ghost number — editorial signature element */
.card-ghost {
  position: absolute;
  top: -20px; right: -8px;
  font-family: var(--f-serif);
  font-weight: 900;
  font-size: 140px;
  line-height: 1;
  color: rgba(255,255,255,0.022);
  user-select: none;
  pointer-events: none;
  transition: color var(--t-ease);
}
.card:hover .card-ghost { color: rgba(255,255,255,0.04); }

.card-name {
  font-family: var(--f-cond);
  font-weight: 500;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: rgba(240,237,232,0.82);
  margin-bottom: 8px;
  transition: color var(--t-ease);
}
.card:hover .card-name { color: var(--text); }

.card-sub {
  font-family: var(--f-cond);
  font-size: 18px;
  font-style: normal;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 40px;
}
.card-tags {
  display: flex; flex-wrap: wrap; align-content: flex-start; align-items: flex-start; gap: 5px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--dim);
  flex: 1;
  transition: border-color var(--t-ease);
}
.card:hover .card-tags { border-color: rgba(255,255,255,0.08); }
.card-tag {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--dim);
  padding: 2px 7px;
  flex: 0 0 auto;
  transition: color var(--t-ease), border-color var(--t-ease);
}
.card:hover .card-tag {
  color: rgba(240,237,232,0.35);
  border-color: rgba(255,255,255,0.1);
}
.card-footer {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding-top: 24px;
  min-height: 60px;
  box-sizing: border-box;
}
.card-period {
  font-family: var(--f-mono);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-cta {
  font-family: var(--f-mono);
  font-size: 11px;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mid);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--t-ease), transform var(--t-ease);
  white-space: nowrap;
  flex-shrink: 0;
}
.card:hover .card-cta { opacity: 1; transform: translateX(0); }

/* Active badge */
.card-badge {
  position: absolute;
  top: 32px; right: 28px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--dim);
  padding: 2px 6px;
  display: flex; align-items: center; gap: 4px;
  transition: color var(--t-ease), border-color var(--t-ease);
}
.card-badge::before {
  content: '·';
  font-size: 13px; line-height: 1;
  color: var(--muted);
}
.card:hover .card-badge {
  color: rgba(240,237,232,0.4);
  border-color: rgba(255,255,255,0.12);
}

/* Card thumbnail — optional image bleed at top of card */
/* .card-thumb carries the negative margins that bleed the image past the card's own
   padding. The 16:9 ratio itself lives on the nested .card-thumb-ratio element rather
   than on .card-thumb directly — percentage padding-top always resolves against the
   containing block's width, and .card-thumb's own containing block is .card's un-bled
   content box (narrower than .card-thumb's final bled-out width), so putting the ratio
   trick directly on .card-thumb computes it against the wrong, smaller width. Nesting
   one level deeper makes .card-thumb-ratio's containing block .card-thumb's own
   (already bled) width, which is the one we actually want the 16:9 to apply to. This
   also sidesteps any cross-browser inconsistency in how the native `aspect-ratio`
   property is resolved on a flex item that also has negative margins. */
.card-thumb {
  margin: -36px -32px 24px;
  overflow: hidden;
}
.card-thumb-ratio {
  position: relative;
  height: 0;
  padding-top: 56.25%; /* 9/16 */
}
.card-thumb-ratio img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.7);
  transition: transform var(--t-ease), filter var(--t-ease);
}
.card:hover .card-thumb img { transform: scale(1.03); filter: brightness(1); }
.card.has-thumb .card-ghost { display: none; }

/* ── WORK GRID ───────────────────────────────────────────── */
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 6px;
  row-gap: 48px;
}
@media (max-width: 1024px) { .work-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .work-grid { grid-template-columns: 1fr; } }

/* ── SCROLL REVEAL ───────────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in { opacity: 1; transform: none; }

/* ── HORIZONTAL RULE ─────────────────────────────────────── */
.rule { border: none; border-top: 1px solid var(--rule); }

/* ── CONTAINER ───────────────────────────────────────────── */
.container {
  max-width: calc(var(--max) + 2 * var(--gut));
  padding: 0 var(--gut);
  margin: 0 auto;
}
