/* ==========================================================
   Media Essentials — shared design tokens & components
   Used by every page except index.html (which is the source
   of truth for the tokens below — keep both in sync).
   ========================================================== */

/* Round 15: site-wide font system — Endless (custom, self-hosted) for
   body text, Instrument Serif (Google Fonts) for headlines. Replaces
   Helvetica everywhere, including the legal text that was briefly on
   Inter (round 14) — this is one single new direction superseding
   that, not a per-page exception anymore. */
@font-face {
  font-family: 'Endless';
  src: url('fonts/EndlessRegular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --white: #ffffff;
  --black: #000000;
  --grey: #a2a2a2;
  --grey-text: #585858;
  --placeholder: #d9d9d9;
  --line: #e9e9e9;
  --surface: #f5f5f7;
  --accent: #FF8F3D;

  --font-body: 'Endless', "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;

  --pad: 55px;
  --container: 1330px;
  --track: -0.07em;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { background: var(--white); }

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--black);
  letter-spacing: var(--track);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-weight: 400; }
h1, h2 { font-family: var(--font-display); }
a { color: inherit; text-decoration: none; }

/* Selection + focus use the new accent color instead of the browser
   default blue — one more "accent opportunity" per the brief. */
::selection { background: var(--accent); color: var(--white); }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline-color: var(--accent);
}
img, video, iframe { display: block; max-width: 100%; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--pad) * 2);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* ---------- Grain ---------- */
.grain {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
/* Round 13-14: matched the homepage's .page width (75%) so header/
   footer sat at the same distance from the edge across every page
   type. Round 15: widened further to 90% specifically for these
   header/footer bars (not .page, not the content column) — explicit
   request to push them closer to the true left/right edges than the
   homepage's own hero/content width. .container's own narrower
   max-width is meant for the legal/project reading column, not the
   header/footer bar. */
.site-header .container {
  width: 90%;
  max-width: 1920px;
  padding-left: 0;
  padding-right: 0;
}
.site-header { padding-top: clamp(20px, 1.9vw, 36px); padding-bottom: clamp(20px, 1.9vw, 36px); }
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: clamp(17px, 1.56vw, 30px);
  letter-spacing: var(--track);
  line-height: 1;
}
.nav .logo { white-space: nowrap; transition: opacity 0.2s ease; }
.nav .logo:hover { color: var(--accent); opacity: 1; }
.back-link { position: relative; white-space: nowrap; transition: opacity 0.2s ease; }
.back-link:hover { color: var(--accent); opacity: 1; }

/* ---------- Legal content (pages/legal.html) ---------- */
/* Round 15: mirrors the project-page sidebar layout (see .proj-layout
   below) but with the nav column on the RIGHT instead of the left —
   content stays centered/clean in the middle, nav is a quiet sticky
   rail next to it rather than the page's main focus. Same tablist/
   tab/tabpanel interaction as round 14 (click swaps the active panel,
   one visible at a time), just re-oriented vertically. */
.legal-main { padding-top: 70px; padding-bottom: 160px; }
.legal-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(40px, 6vw, 96px);
  max-width: 960px;
  margin: 0 auto;
}
.legal-col { width: 100%; max-width: 640px; }

/* ---- Side nav (was a top tab bar in round 14) ---- */
.legal-tabs {
  position: sticky;
  top: 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 150px;
  flex-shrink: 0;
}
.legal-tab {
  background: none;
  border: none;
  font: inherit;
  font-size: clamp(14px, 1.1vw, 16px);
  letter-spacing: var(--track);
  color: var(--grey);
  padding: 0;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.legal-tab:hover { color: var(--accent); }
.legal-tab[aria-selected="true"] { color: var(--accent); }

/* No-JS fallback: every panel is visible (display:block, the default)
   until JS actually runs and marks the tab list "is-enhanced" — only
   then do the inactive panels get hidden. A page with JS disabled
   just shows all three documents stacked, which is the explicit
   fallback requirement, not a bug. */
.legal-tabs.is-enhanced ~ .legal-panel { display: none; }
.legal-tabs.is-enhanced ~ .legal-panel.is-active { display: block; }
.legal-panel + .legal-panel { margin-top: 64px; padding-top: 64px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .legal-layout { flex-direction: column-reverse; gap: 32px; }
  .legal-tabs {
    position: static;
    flex-direction: row;
    width: auto;
    gap: clamp(20px, 4vw, 32px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--line);
  }
  .legal-tabs::-webkit-scrollbar { display: none; }
  .legal-tab { padding-bottom: 12px; }
}

.legal-eyebrow {
  display: block;
  color: var(--grey);
  font-size: 15px;
  margin-bottom: 20px;
}
.legal-title {
  font-weight: 500;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  margin-bottom: 24px;
}
.legal-meta {
  color: var(--grey-text);
  font-size: 15px;
  line-height: 1.5;
  max-width: 600px;
}

.legal-section {
  border-top: 1px solid var(--line);
  padding-top: 40px;
  margin-top: 40px;
}
.legal-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 56px;
}
.legal-section h2 {
  font-weight: 500;
  font-size: clamp(19px, 1.8vw, 22px);
  line-height: 1.3;
  margin-bottom: 16px;
}
.legal-section p {
  color: var(--grey-text);
  font-size: clamp(16px, 1vw, 17px);
  line-height: 1.6;
  max-width: 72ch;
}
.legal-section p + p { margin-top: 14px; }
.legal-section strong { font-weight: 500; color: var(--black); }
.legal-section a { text-decoration: underline; text-underline-offset: 3px; color: inherit; }
.legal-section a:hover { color: var(--black); }

/* ---------- Project page (clean white case-study layout) ---------- */
/* Round 13: used to be the same fixed photo + glass-card language as
   the homepage (white text on a blurred backdrop over a sky/grass
   photo). Replaced with the same white-background, dark-text system
   the legal pages already use (--black/--grey/--grey-text/--line) —
   the two page types are visually one family now instead of two, and
   there's no more photo/parallax JS weight on these pages at all. */
.proj-header {
  position: relative;
  width: 90%;
  max-width: 1920px;
  padding-left: 0;
  padding-right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: clamp(20px, 1.9vw, 36px);
  padding-bottom: clamp(20px, 1.9vw, 36px);
  font-size: clamp(17px, 1.56vw, 30px);
  letter-spacing: var(--track);
  color: var(--black);
}
.proj-header .logo,
.proj-header .back-link { color: var(--black); transition: opacity 0.2s ease; }
.proj-header .logo:hover,
.proj-header .back-link:hover { color: var(--accent); opacity: 1; }

.proj-main { position: relative; padding-top: clamp(20px, 3vw, 48px); padding-bottom: clamp(60px, 8vw, 120px); }

/* Round 15: left sticky section-jump sidebar, mirroring a reference
   case-study layout — general structure only (a sidebar TOC next to a
   centered content column), not that reference's own section names or
   copy. Sidebar collapses away below 900px; mobile just scrolls
   through the sections in order same as before, no jump-nav. */
.proj-container {
  display: flex;
  align-items: flex-start;
  gap: clamp(40px, 5vw, 80px);
  max-width: 1100px;
  margin: 0 auto;
}
.proj-sidebar {
  position: sticky;
  top: 48px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 170px;
  flex-shrink: 0;
}
.proj-sidebar a {
  font-size: 14px;
  color: var(--grey);
  transition: color 0.2s ease;
}
.proj-sidebar a:hover { color: var(--accent); }
.proj-sidebar a.is-active { color: var(--accent); }
.proj-content { flex: 1; min-width: 0; max-width: 860px; }
@media (max-width: 900px) {
  .proj-sidebar { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

.proj-eyebrow {
  display: block;
  color: var(--grey);
  font-size: clamp(12px, 1.1vw, 14px);
  letter-spacing: var(--track);
}
.proj-title {
  color: var(--black);
  font-size: clamp(34px, 5.2vw, 64px);
  line-height: 1.08;
  letter-spacing: var(--track);
  margin-top: 10px;
}

/* Video leads right under the title — it's the actual work being
   shown, so it gets the same prominence a hero image would in a
   design-portfolio case study, rather than sitting below a stats row. */
.proj-video-card {
  margin-top: clamp(28px, 3.4vw, 44px);
  border-radius: clamp(14px, 1.7vw, 28px);
  background: var(--surface);
  padding: clamp(8px, 1vw, 14px);
}
.video-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: clamp(8px, 1.05vw, 20px);
  background: #000;
  overflow: hidden;
}
.video-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.video-placeholder {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: var(--track);
  text-align: center;
  padding: 24px;
}

.proj-meta {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 3vw, 40px);
  padding: clamp(18px, 2.2vw, 26px) 0;
  margin-top: clamp(28px, 3.4vw, 44px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.proj-meta-item { display: flex; flex-direction: column; gap: 4px; }
.proj-meta-item .label {
  color: var(--grey);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.proj-meta-item .value {
  color: var(--black);
  font-size: clamp(14px, 1.2vw, 17px);
}

.proj-desc {
  margin-top: clamp(28px, 3.4vw, 44px);
  color: var(--grey-text);
  font-size: clamp(15px, 1.3vw, 19px);
  line-height: 1.6;
  max-width: 62ch;
}
.proj-desc p + p { margin-top: 0.7em; }

/* Small CTA under the description, replacing the screenshots grid the
   project pages used to end with (removed — deemed unnecessary). */
.proj-cta {
  margin-top: clamp(28px, 3.4vw, 44px);
  color: var(--grey-text);
  font-size: clamp(14px, 1.15vw, 17px);
}
.proj-cta a {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease;
}
.proj-cta a:hover { opacity: 0.65; }

/* ---------- Case-study sections (Round 14) ---------- */
/* One line right under the video: customer, format, length — the
   only "meta" a case study needs before the story starts. */
.proj-meta-line {
  margin-top: clamp(16px, 2vw, 22px);
  color: var(--grey);
  font-size: clamp(13px, 1vw, 15px);
  letter-spacing: var(--track);
}
.proj-meta-line strong { color: var(--black); font-weight: 400; }

/* Generic case-study section: a small kicker label, then content.
   Reuses the same top-border rhythm as .proj-meta/.legal-section so
   the whole page still reads as one consistent vertical scan. */
.proj-section {
  margin-top: clamp(40px, 4.4vw, 64px);
  padding-top: clamp(28px, 3vw, 40px);
  border-top: 1px solid var(--line);
}
.proj-section-label {
  display: block;
  color: var(--grey);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.proj-section p {
  color: var(--grey-text);
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.6;
  max-width: 68ch;
}
.proj-section p + p { margin-top: 0.8em; }

/* Process artifacts: script/styleframes/storyboard, each with a short
   caption. Grid collapses to one column on narrow viewports. */
.proj-artifacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(16px, 2vw, 24px);
  margin-top: clamp(20px, 2.4vw, 28px);
}
.proj-artifact figure { margin: 0; }
.proj-artifact img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: clamp(8px, 1vw, 14px);
  background: var(--surface);
}
.proj-artifact figcaption {
  margin-top: 10px;
  color: var(--grey);
  font-size: 13px;
  line-height: 1.4;
}

/* Decisions: 3–5 short "why we did X" blocks. */
.proj-decisions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(24px, 3vw, 36px);
  margin-top: clamp(20px, 2.4vw, 28px);
}
.proj-decision h3 {
  font-size: clamp(15px, 1.2vw, 17px);
  font-weight: 400;
  color: var(--black);
  margin-bottom: 8px;
}
.proj-decision p {
  color: var(--grey-text);
  font-size: clamp(14px, 1.1vw, 16px);
  line-height: 1.55;
}

/* Scope & deliverables list — plain rows, no bullets/boxes. */
.proj-scope-list {
  margin-top: clamp(16px, 2vw, 22px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.proj-scope-list li {
  display: flex;
  gap: 12px;
  color: var(--grey-text);
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.5;
}
.proj-scope-list li::before { content: "—"; color: var(--grey); flex-shrink: 0; }

/* Testimonial: slightly larger, quieter than a heading. */
.proj-testimonial blockquote {
  margin: 0;
  color: var(--black);
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.45;
  max-width: 60ch;
}
.proj-testimonial cite {
  display: block;
  margin-top: 14px;
  color: var(--grey);
  font-size: 14px;
  font-style: normal;
}

.proj-cta-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(24px, 2.6vw, 32px);
  background: var(--black);
  color: var(--white);
  border-radius: 999px;
  padding: 12px 22px;
  font-size: clamp(14px, 1.1vw, 16px);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.proj-cta-button:hover { opacity: 0.8; }

/* Clearly marked "not filled in yet" content — dashed border, italic,
   quiet enough not to look like a design element, obvious enough not
   to be mistaken for finished copy. Never invented content; this is
   what stands in for it until real information is provided. */
.proj-placeholder {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--grey);
  font-size: clamp(13px, 1vw, 15px);
  font-style: italic;
  line-height: 1.5;
}
/* Same marker, no box — for a gap inside a single line (e.g. the
   customer/format/length line) where a dashed box would be too heavy. */
.proj-placeholder-inline { color: var(--grey); font-style: italic; }

.proj-footer {
  position: relative;
  width: 90%;
  max-width: 1920px;
  padding-left: 0;
  padding-right: 0;
  padding-top: clamp(28px, 3.4vw, 44px);
  padding-bottom: clamp(30px, 3vw, 44px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  border-top: 1px solid var(--line);
}
.proj-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  font-size: clamp(13px, 0.9vw, 15px);
  color: var(--grey);
}
.proj-footer .footer-links a,
.proj-footer .footer-links button {
  background: none;
  border: none;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s ease;
}
.proj-footer .footer-links a:hover,
.proj-footer .footer-links button:hover { color: var(--accent); opacity: 1; }
.proj-footer .footer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: clamp(13px, 0.9vw, 15px);
  color: var(--grey);
}
.proj-footer .footer-meta button { background: none; border: none; font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; padding: 0; transition: opacity 0.2s ease; }
.proj-footer .footer-meta button:hover { color: var(--accent); opacity: 1; }

/* ---------- Footer ---------- */
.site-footer .container {
  width: 90%;
  max-width: 1920px;
  padding-left: 0;
  padding-right: 0;
}
.site-footer { padding-top: 20px; padding-bottom: 20px; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.footer-links a,
.footer-links button,
.email-copy {
  color: var(--grey);
  font-size: clamp(13px, 0.83vw, 16px);
  letter-spacing: -0.0375em;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}
.footer-links a:hover,
.footer-links button:hover,
.email-copy:hover { color: var(--accent); opacity: 1; }
.footer-meta { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.copy-label { font-size: 11px; letter-spacing: 0.05em; color: var(--grey); margin-left: 6px; }
.copyright { color: var(--grey); font-size: clamp(13px, 0.83vw, 16px); letter-spacing: -0.0375em; }

/* ---------- Custom cursor (see assets/custom-cursor.js) ---------- */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--accent);
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transform: translate(-50%, -50%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 13px;
  white-space: nowrap;
  transition: opacity 0.2s ease, width 0.3s cubic-bezier(0.16,1,0.3,1), height 0.3s cubic-bezier(0.16,1,0.3,1);
}
.custom-cursor.is-active { opacity: 1; }
.custom-cursor.is-project,
.custom-cursor.is-email { width: 134px; height: 42px; }
.custom-cursor.is-link { width: 34px; height: 34px; }
.custom-cursor-text { opacity: 0; transition: opacity 0.15s ease; }
.custom-cursor.is-project .custom-cursor-text,
.custom-cursor.is-email .custom-cursor-text { opacity: 1; transition-delay: 0.1s; }
.custom-cursor-arrow {
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.custom-cursor.is-link .custom-cursor-arrow { opacity: 1; transition-delay: 0.1s; }

/* Interactive elements carry their own default cursor from the
   browser's UA stylesheet, which wins over an inherited value from
   body — override those explicitly too, or the native pointer stays
   visibly stacked on the custom circle over links/buttons/inputs. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body,
  a, button, input, textarea, select, label, [role="button"] {
    cursor: none;
  }
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16,1,0.3,1);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root { --pad: 32px; }
  .legal-main { padding-top: 60px; padding-bottom: 120px; }
}
@media (max-width: 720px) {
  :root { --pad: 22px; }
  .nav { font-size: 15px; }
  .legal-title { font-size: clamp(32px, 9vw, 44px); }
  .legal-section { padding-top: 30px; margin-top: 30px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }

  /* These never got the same 75%->88% mobile widening index.html's
     .page gets, so the wordmark/back-link/footer content sat with a
     visibly wider margin than the homepage on a phone — not flush to
     the edges like everywhere else. */
  .site-header .container,
  .site-footer .container,
  .proj-header,
  .proj-footer {
    width: 88%;
  }
}
