/* ============================================================
   Drew Vaughan — Portfolio Landing
   Advertising (light) / Directing (dark) — palette inverts by mode
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* visually hidden, readable by crawlers and screen readers */
.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;
}

/* custom X cursor, site-wide */
* {
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3E%3Cg%20fill='none'%20stroke='%23B5892E'%20stroke-width='2.4'%20stroke-linecap='round'%3E%3Cpath%20d='M6%206L18%2018'/%3E%3Cpath%20d='M18%206L6%2018'/%3E%3C/g%3E%3C/svg%3E") 12 12, auto !important;
}
/* over anything clickable, the X rotates into a gold + */
a, button, [role="tab"], .title, .dial-dot, .dial-core {
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3E%3Cg%20fill='none'%20stroke='%23B5892E'%20stroke-width='2.4'%20stroke-linecap='round'%3E%3Cpath%20d='M12%204v16'/%3E%3Cpath%20d='M4%2012h16'/%3E%3C/g%3E%3C/svg%3E") 12 12, pointer !important;
}

/* ---- theme tokens ---- */
:root {
  --bg:     #E7E7E7;
  --ink:    #1A1A1A;
  --sub:    #6b6a67;
  --accent: #B5892E;
  --hair:   rgba(26, 26, 26, 0.2);
  --halo-ad:  0.12;
  --halo-dir: 0;

  --edge: 64px;          /* desktop horizontal inset */
  --mark: min(540px, 47vh, 66vmin);
}

body[data-mode="dir"] {
  --bg:     #1A1A1A;
  --ink:    #E7E7E7;
  --sub:    #9a968d;
  --accent: #B5892E;
  --hair:   rgba(231, 231, 231, 0.2);
  --halo-ad:  0;
  --halo-dir: 0.12;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', sans-serif;
  transition: background 0.5s ease, color 0.5s ease;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #B5892E; color: #fff; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a:hover, .ctrl-arrow:hover, .toggle-btn:hover { opacity: 0.6; }

/* ============================================================
   Layout — single centered column (both artboards collapse here)
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px var(--edge) 48px;
  overflow: hidden;
}

/* ---- nav ---- */
.nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 14px; }
.corner-mark { width: 58px; height: 58px; display: block; flex: 0 0 auto; }
.corner-mark svg { display: block; }
.wordmark {
  font-family: 'Manufacturing Consent', serif;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.nav-links {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ---- hairline ---- */
.hairline {
  width: 100%;
  height: 1px;
  margin-top: 18px;
  background: var(--hair);
}

/* ---- mode toggle: two halves, each label centered in its half ---- */
.toggle {
  width: 100%;
  max-width: 720px;
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.toggle-cell { text-align: center; }
.toggle-btn {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sub);
  padding: 8px 22px 6px;
  border-bottom: 2px solid transparent;
  transition: color 0.4s ease, border-color 0.4s ease;
}
.toggle-btn.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---- stage: mark + halo ---- */
.stage {
  position: relative;
  width: var(--mark);
  height: var(--mark);
  margin-top: clamp(18px, 4vh, 40px);
  flex: 0 0 auto;
}
.halo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
/* animated grain that streams into the black-hole core */
.gravity {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.halo-ad  { opacity: var(--halo-ad); }
.halo-dir { opacity: var(--halo-dir); }

.mark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s ease-out;
  will-change: transform;
}
.mark svg { width: 100%; height: 100%; overflow: visible; }
.mark-mobile { display: none; }

/* ---- connector ---- */
.connector {
  width: 1px;
  height: 32px;
  margin-top: 6px;
  background: var(--accent);
  flex: 0 0 auto;
}

/* ---- active title + meta ---- */
.active { text-align: center; margin-top: clamp(14px, 2vh, 22px); }
/* project change — title block slides up as the wheel settles */
.active.swap-in { animation: swapIn 0.5s cubic-bezier(.2,.7,.2,1); }
@keyframes swapIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.title {
  font-family: 'Manufacturing Consent', serif;
  font-weight: 400;
  font-size: clamp(52px, 8vw, 78px);
  line-height: 0.95;
  margin: 0;
  min-height: 76px;
}
.meta {
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-top: 14px;
}
.work-brand {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sub);
  margin-top: 8px;
}
.work-brand:empty { display: none; }

/* ---- controls ---- */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-top: clamp(24px, 5vh, 40px);
  flex-wrap: wrap;
}
.ctrl-arrow {
  font-family: 'Space Mono', monospace;
  font-size: 20px;
  line-height: 1;
  user-select: none;
}
.index {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--sub);
  min-width: 64px;
  text-align: center;
}
.ctrl-divider { width: 1px; height: 20px; background: var(--hair); }
.view-project {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
}

/* ---- project lightbox ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(16px, 5vh, 64px) clamp(12px, 4vw, 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.lightbox[hidden] { display: none; }
/* overlay entrances — panel rises, backdrop fades */
.lightbox:not([hidden]) .lightbox-panel,
.contact:not([hidden]) .contact-panel { animation: panelIn 0.5s cubic-bezier(.2,.7,.2,1); }
.lightbox:not([hidden]) .lightbox-backdrop,
.contact:not([hidden]) .contact-backdrop { animation: fadeIn 0.45s ease; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(26px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.lightbox-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  margin: auto;
  background: var(--bg);
  border: 1px solid var(--hair);
  padding: clamp(24px, 4vw, 48px);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  line-height: 1;
  color: var(--sub);
}
.lightbox-head { text-align: center; }
.lightbox-title {
  font-family: 'Manufacturing Consent', serif;
  font-weight: 400;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 0.95;
  margin: 0;
  padding: 0 40px;
}
.lightbox-brand {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sub);
  margin-top: 12px;
}
.lightbox-brand:empty { display: none; }
.lightbox-copy {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(18px, 2.4vw, 24px);
  line-height: 1.3;
  color: var(--sub);
  margin: 16px auto 0;
  max-width: 54ch;
  text-wrap: pretty;
}
.lightbox-copy:empty { display: none; }
.lightbox-body { margin-top: 60px; display: flex; flex-direction: column; gap: 64px; }

/* scatter-grain frame hugging each player's edge (canvas, drawn in JS) */
.lb-stage {
  position: relative;
  padding: clamp(24px, 4.5vw, 48px);
}
.lb-grain {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.lb-video {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-top: 56.25%;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.lb-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.lb-stills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.lb-stills img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 5;
  display: block;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.lb-section-label {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--sub);
  margin-bottom: 2px;
}

/* ============================================================
   Ghost thumbnails — the active project's footage surfaces as an
   apparition centred on the dial, bleeding out from the wheel and
   feathering to nothing (multiply on light / screen on dark).
   Plays twice, then fades. Lives inside .stage so it tracks the
   wheel on every layout; the gravity grain draws over it.
   ============================================================ */
.ghost {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 210%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle, #000 28%, rgba(0,0,0,0.45) 46%, transparent 68%);
  mask-image: radial-gradient(circle, #000 28%, rgba(0,0,0,0.45) 46%, transparent 68%);
}
.ghost img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.12);
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.ghost img.on { opacity: 0.3; }
body[data-mode="dir"] .ghost img { mix-blend-mode: screen; }
body[data-mode="dir"] .ghost img.on { opacity: 0.26; }

/* ---- ambient grain scattered across the page (behind content) ---- */
#ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ---- grain cursor trail ---- */
#trail {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

/* ---- entry splash (CREATIVE / DIRECTOR) ---- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.6s ease;
}
.splash[hidden] { display: none; }
.splash.dismiss { opacity: 0; pointer-events: none; }

.splash-half {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  border: 0;
  margin: 0;
  padding: 0;
}
.splash-creative { left: 0;   background: #E7E7E7; }
.splash-director { left: 50%; background: #1A1A1A; }

.splash-grain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.splash-content { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

/* DREW VAUGHAN in the top corners — right one upside down */
.splash-corner {
  position: absolute;
  top: clamp(22px, 3vw, 46px);
  font-family: 'Manufacturing Consent', serif;
  font-size: clamp(20px, 2.3vw, 34px);
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.splash-tl { left: clamp(24px, 4vw, 56px); color: #1A1A1A; }
.splash-tr { right: clamp(24px, 4vw, 56px); color: #E7E7E7; transform: rotate(180deg); }

/* big CREATIVE / DIRECTOR, one centred in each half */
.splash-word {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50%;
  text-align: center;
  font-family: 'Manufacturing Consent', serif;
  font-size: clamp(46px, 7.5vw, 118px);
  line-height: 0.9;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.35s ease, letter-spacing 0.5s ease;
}
.sw-creative { left: 0;   color: #1A1A1A; }
.sw-director { left: 50%; color: #E7E7E7; }
.splash.hover-ad  .sw-creative,
.splash.hover-dir .sw-director { color: #B5892E; letter-spacing: 0.045em; }

@media (max-width: 640px) {
  .splash-corner { font-size: clamp(15px, 4.5vw, 22px); }
  .splash-word { font-size: clamp(30px, 11vw, 58px); }
}

/* ---- contact overlay ---- */
.contact {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 5vh, 64px) clamp(12px, 4vw, 48px);
  overflow-y: auto;
}
.contact[hidden] { display: none; }
.contact-backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.contact-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  margin: auto;
  background: var(--bg);
  border: 1px solid var(--hair);
  padding: clamp(24px, 4vw, 56px);
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(220px, 42%) 1fr;
  gap: clamp(28px, 5vw, 56px);
  align-items: start;   /* photo flush with the top line of the name */
}
.contact-photo {
  margin: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  filter: grayscale(1) contrast(1.02);
}
.contact-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.contact-photo.noimg { display: flex; align-items: center; justify-content: center; }
.contact-photo.noimg::after {
  content: 'PORTRAIT';
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--sub);
}
.contact-head {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2vw, 30px);
  margin: 0 0 22px;
}
.contact-mark {
  width: clamp(46px, 5vw, 60px);
  height: clamp(46px, 5vw, 60px);
  flex: 0 0 auto;
  color: var(--ink);
}
.contact-mark svg { width: 100%; height: 100%; display: block; }
.contact-title {
  font-family: 'Manufacturing Consent', serif;
  font-weight: 400;
  font-size: clamp(40px, 6vw, 60px);
  line-height: 0.95;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 0;
}
.contact-bio {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(19px, 2.3vw, 25px);
  line-height: 1.32;
  margin: 0 0 30px;
  color: var(--ink);
  text-wrap: pretty;
}
/* availability note — its own line, tucked under the bio */
.contact-avail { margin-top: -14px; }

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-family: 'Space Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.contact-links a { border-bottom: 1px solid var(--hair); padding-bottom: 6px; width: fit-content; }

@media (max-width: 680px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-photo { max-width: 300px; }
}

/* ============================================================
   Mobile artboard (#8m) — single column, swap to mobile mark
   ============================================================ */
@media (max-width: 760px) {
  :root { --edge: 26px; --mark: min(300px, 82vw); }

  .hero { padding: 58px var(--edge) 40px; }

  .wordmark { font-size: 22px; }
  .nav-links { font-size: 11px; letter-spacing: 0.2em; }
  .corner-mark { display: none; }

  .hairline { margin-top: 14px; }
  .toggle { margin-top: 20px; }
  .toggle-btn { font-size: 11px; letter-spacing: 0.22em; padding: 6px 4px 5px; }

  .mark-desktop { display: none; }
  .mark-mobile  { display: flex; }
  .halo { opacity: 0; }
  .halo-ad  { opacity: var(--halo-ad); }
  .halo-dir { opacity: var(--halo-dir); }

  .connector { height: 26px; }
  .title { min-height: 52px; }
  .meta { font-size: 11px; letter-spacing: 0.14em; }
  .index { font-size: 11px; min-width: 60px; }

  /* mobile controls: arrows + index only; view-project drops below */
  .controls { gap: 24px; }
  .ctrl-divider { display: none; }
  .view-project { flex-basis: 100%; text-align: center; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
