/* =========================================================
   Alix Drummond — Portfolio styles
   ========================================================= */

:root {
  --ground: #FCF8F5;
  --paper: #FFFFFF;
  --ink: #141414;
  --muted: #5E5752;
  --line: #E9E1DB;
  --accent: #B83E6C;      /* raspberry — 5:1 on --ground */
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(20px, 4vw, 64px);
  --header-h: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(1.0625rem, .35vw + 1rem, 1.25rem);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
main:focus { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -100px; z-index: 200;
  background: var(--ink); color: var(--ground); padding: 12px 18px; border-radius: 999px;
  text-decoration: none; font-family: var(--mono); font-size: .9rem;
}
.skip-link:focus { top: 12px; }
.wrap { width: min(100% - 2 * var(--gutter), 1240px); margin-inline: auto; }
.eyebrow {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  margin: 0 0 1rem; color: var(--muted);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner {
  height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding-inline: var(--gutter); max-width: 1600px; margin-inline: auto;
}
.wordmark { font-size: clamp(1.35rem, 1.2vw + 1rem, 1.75rem); font-weight: 500; letter-spacing: -.015em; text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 40px); }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(12px, 2.2vw, 36px); align-items: center; }
.nav-link {
  font: inherit; font-size: clamp(1.1rem, .6vw + .9rem, 1.4rem); letter-spacing: -.01em;
  background: none; border: 0; color: inherit; text-decoration: none; cursor: pointer;
  padding: 8px 2px; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; position: relative;
}
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 1.5px; background: currentColor;
  transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease);
}
.nav-link:hover::after, .nav-link[aria-current="page"]::after { transform: scaleX(1); }
.sub-toggle svg { transition: transform .25s var(--ease); }
.sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.has-sub { position: relative; }
.sub-menu {
  position: absolute; top: calc(100% + 8px); left: -14px; min-width: 270px;
  list-style: none; margin: 0; padding: 8px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 48px -24px rgba(20, 20, 20, .3);
}
.sub-menu a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
  border-radius: 8px; text-decoration: none; font-size: 1.05rem;
}
.sub-menu a:hover { background: var(--ground); }
.swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--frame); flex: none; }
.sub-menu small { margin-left: auto; font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.social { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--ground);
  display: grid; place-items: center; text-decoration: none;
  transition: transform .25s var(--ease), background-color .25s;
}
.icon-btn:hover { transform: translateY(-2px); background: var(--accent); }
.icon-btn .in { font-weight: 700; font-size: 1.2rem; line-height: 1; transform: translateY(-1px); }
.menu-toggle {
  display: none; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  font: inherit; font-size: 1.05rem; color: var(--ink); background: transparent;
  border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer;
}

@media (max-width: 820px) {
  .menu-toggle { display: inline-flex; }
  .site-nav {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 16px;
    background: var(--ground); border-bottom: 1px solid var(--line);
    padding: 12px var(--gutter) 24px;
  }
  .site-nav.open { display: flex; }
  .nav-list { flex-direction: column; align-items: flex-start; gap: 0; width: 100%; }
  .nav-link { font-size: 1.5rem; }
  .sub-menu { position: static; box-shadow: none; border: 0; background: transparent; padding: 0 0 8px 4px; min-width: 0; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(28px, 5vh, 64px) var(--gutter) clamp(8px, 2vh, 24px);
  max-width: 1600px; margin-inline: auto;
}
.hero-title {
  font-size: clamp(2.6rem, 5.2vw, 4.9rem); line-height: 1.02; letter-spacing: -.028em;
  font-weight: 600; margin: 0 0 .55em;
}
.hero-title:focus { outline: none; }
.hero-title em { color: var(--accent); font-style: italic; font-weight: 500; }
.hero-intro {
  font-size: clamp(1.25rem, 1.3vw + .8rem, 1.8rem); line-height: 1.35; letter-spacing: -.01em;
  max-width: 34ch; margin: 0 0 1em;
}
.text-link {
  display: inline-flex; align-items: center; gap: .35em; min-height: 44px;
  font-size: 1.2rem; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px;
}
.text-link span { transition: transform .25s var(--ease); }
.text-link:hover span { transform: translateX(4px); }
.stage-wrap { display: flex; flex-direction: column; gap: 8px; }
.stage { position: relative; height: clamp(300px, 38vw, 560px); }
.stage-hint {
  margin: 0; text-align: center; font-family: var(--mono); font-size: .75rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.hint-touch { display: none; }
@media (hover: none) { .hint-hover { display: none; } .hint-touch { display: inline; } }
.fallback-svg { width: 100%; height: 100%; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .stage { height: min(80vw, 380px); }
}

/* ---------- Work / carousel ---------- */
.work { padding: clamp(16px, 4vh, 48px) 0 clamp(56px, 10vh, 120px); }
.work-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding-inline: var(--gutter); max-width: 1600px; margin: 0 auto;
}
.work-head h2 { font-size: clamp(1.8rem, 2.4vw, 2.5rem); margin: 0; font-weight: 600; letter-spacing: -.02em; }
.work-sub { margin: .15em 0 0; color: var(--muted); font-size: 1.05rem; }
.carousel-controls { display: flex; gap: 10px; }
.ctrl {
  width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--ink);
  background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer;
  transition: background-color .2s, color .2s, transform .2s;
}
.ctrl:hover { background: var(--ink); color: var(--ground); }
.ctrl:active { transform: scale(.94); }
#autoplay-toggle .i-play { display: none; }
#autoplay-toggle.is-paused .i-play { display: block; }
#autoplay-toggle.is-paused .i-pause { display: none; }

.carousel {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
}
.track {
  position: relative; list-style: none; margin: 0;
  display: flex; gap: clamp(20px, 2.4vw, 36px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  padding: 28px var(--gutter) 20px;
  scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 clamp(250px, 26vw, 380px); scroll-snap-align: start; }

/* The cartridge case */
.case-link { display: block; text-decoration: none; color: inherit; border-radius: 14px; }
.case-link:focus-visible { outline: none; }
.case-link:focus-visible .case { outline: 3px solid var(--ink); outline-offset: 5px; }
.case {
  display: grid; grid-template-columns: 1fr 13%; aspect-ratio: 1.12; padding: 7px;
  background: var(--frame); border-radius: 12px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    inset 0 -2px 0 rgba(0, 0, 0, .18),
    0 1px 2px rgba(20, 20, 20, .12),
    0 16px 30px -16px rgba(20, 20, 20, .38);
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
}
.case-link:hover .case, .case-link:focus-visible .case {
  transform: translateY(-8px) rotate(-1.2deg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .28),
    inset 0 -2px 0 rgba(0, 0, 0, .18),
    0 2px 4px rgba(20, 20, 20, .1),
    0 30px 44px -22px rgba(20, 20, 20, .45);
}
.case-cover {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink); border-radius: 5px 0 0 5px;
  padding: clamp(14px, 1.5vw, 22px);
}
.case-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-title {
  position: relative; z-index: 1; font-size: clamp(2rem, 3vw, 3rem); font-weight: 600;
  letter-spacing: -.03em; line-height: .95;
}
.cover-tag {
  position: relative; z-index: 1; margin-top: .9em; max-width: 15ch;
  font-family: var(--mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; line-height: 1.5;
}
.cover-art {
  position: absolute; right: -20%; bottom: -24%; width: 78%; aspect-ratio: 1;
  border-radius: 50%; background: var(--frame); opacity: .92;
}
.cover-art::after {
  content: ""; position: absolute; inset: -14%; border-radius: 50%;
  border: 1.5px solid var(--frame); opacity: .5;
}
.cover-badge {
  position: absolute; left: 10px; bottom: 10px; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  background: #fff; color: #141414; border: 2px solid #141414; border-radius: 3px;
  font-family: var(--mono); font-weight: 500; font-size: .78rem; line-height: 1; padding: 4px 5px 3px;
}
.cover-badge small { font-size: .55rem; margin-top: 2px; }
.case-spine {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 0;
  writing-mode: vertical-rl; transform: rotate(180deg);
  background: #fff; color: #141414; border-radius: 5px 0 0 5px;
  font-family: var(--mono); font-size: clamp(.5rem, .55vw, .62rem); letter-spacing: .22em;
}
.case-spine b { font-family: var(--serif); font-size: clamp(.9rem, 1.1vw, 1.2rem); letter-spacing: 0; color: var(--frame); }
.case-caption { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 16px; padding-inline: 2px; }
.case-name { font-size: 1.25rem; font-weight: 500; letter-spacing: -.01em; }
.case-meta { font-family: var(--mono); font-size: .74rem; color: var(--muted); letter-spacing: .04em; white-space: nowrap; }
.case-link:hover .case-name { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }

/* ---------- Transition layers ---------- */
#gl { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
#gl.on-top { z-index: 110; }
.wipe { position: fixed; inset: 0; z-index: 115; pointer-events: none; opacity: 0; background: var(--ground); }
.wipe.on { pointer-events: auto; }
.ghost { position: fixed; margin: 0; z-index: 120; pointer-events: none; transform-origin: 50% 50%; }
.skip-anim {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 130;
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px;
  font: inherit; font-size: 1rem; color: var(--ink); background: var(--ground);
  border: 1.5px solid var(--ink); border-radius: 999px; cursor: pointer;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .35);
}
.skip-anim kbd { font-family: var(--mono); font-size: .72rem; border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; }

.view.entering { animation: viewIn .55s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- Project page ---------- */
.p-hero {
  position: relative; overflow: hidden; background: var(--bg); color: var(--ink);
  padding: clamp(28px, 5vh, 56px) 0 clamp(56px, 9vh, 104px);
}
.p-hero::after {
  content: ""; position: absolute; right: -8vw; bottom: -22vw; width: 46vw; aspect-ratio: 1;
  border-radius: 50%; background: var(--frame); opacity: .92; pointer-events: none;
}
.p-hero .wrap { position: relative; z-index: 1; }
.back-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: clamp(24px, 5vh, 56px);
  font-family: var(--mono); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
}
.back-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.p-hero .eyebrow { color: inherit; opacity: .85; }
.p-hero h1 {
  font-size: clamp(3rem, 9vw, 7.5rem); line-height: .95; letter-spacing: -.035em; font-weight: 600;
  margin: 0 0 .2em; max-width: 12ch;
}
.p-hero h1:focus { outline: none; }
.p-tagline { font-size: clamp(1.4rem, 2vw + .6rem, 2.2rem); font-style: italic; margin: 0 0 clamp(28px, 5vh, 56px); max-width: 26ch; }
.p-meta {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin: 0; max-width: 820px;
  padding-top: 24px; border-top: 1.5px solid currentColor;
}
.p-meta dt { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.p-meta dd { margin: 0; font-size: 1.05rem; line-height: 1.35; }
@media (max-width: 720px) { .p-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.p-body { padding: clamp(40px, 8vh, 88px) 0; }
.tldr {
  background: var(--paper); border: 1px solid var(--line); border-radius: 18px;
  padding: clamp(22px, 3vw, 36px); margin-bottom: clamp(40px, 7vh, 72px);
}
.tldr h2 { font-family: var(--mono); font-weight: 500; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 12px; color: var(--muted); }
.tldr p { font-size: clamp(1.3rem, 1vw + 1rem, 1.7rem); line-height: 1.35; margin: 0; max-width: 46ch; }

.p-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a {
  display: flex; gap: 10px; align-items: baseline; min-height: 40px; padding: 8px 0;
  text-decoration: none; color: var(--muted); font-size: 1rem;
}
.toc a span { font-family: var(--mono); font-size: .7rem; }
.toc a:hover { color: var(--ink); }
@media (max-width: 900px) {
  .p-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 4px 18px; }
}
.p-section { margin-bottom: clamp(48px, 8vh, 88px); scroll-margin-top: calc(var(--header-h) + 16px); }
.p-section h2 { font-size: clamp(1.8rem, 2.5vw, 2.6rem); letter-spacing: -.02em; font-weight: 600; margin: 0 0 .5em; }
.p-section p { max-width: 64ch; margin: 0 0 1em; }
.p-fig { margin: clamp(24px, 4vh, 40px) 0 0; }
.p-fig img { width: 100%; border-radius: 14px; }
.p-fig figcaption { margin-top: 10px; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.ph {
  display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 14px;
  border: 1.5px dashed #C9BEB5; background: #F6F0EA; color: var(--muted);
  font-family: var(--mono); font-size: .85rem; text-align: center; padding: 16px;
}
.p-cover { margin: 0 0 clamp(40px, 7vh, 72px); }

.p-pager { border-top: 1px solid var(--line); }
.p-pager ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; }
.p-pager a {
  display: flex; flex-direction: column; gap: 6px; min-height: 140px; justify-content: center;
  padding: 32px var(--gutter); text-decoration: none; transition: background-color .25s;
}
.p-pager li + li a { text-align: right; align-items: flex-end; border-left: 1px solid var(--line); }
.p-pager a:hover { background: var(--paper); }
.p-pager small { font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.p-pager strong { font-size: clamp(1.5rem, 2.4vw, 2.4rem); font-weight: 600; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 12px; }
.p-pager .swatch { width: 18px; height: 18px; }

/* ---------- About ---------- */
.about { padding: clamp(40px, 8vh, 96px) 0; }
.about-head h1 { font-size: clamp(3rem, 7vw, 6rem); line-height: .98; letter-spacing: -.035em; font-weight: 600; margin: 0 0 .3em; }
.about-head h1:focus { outline: none; }
.lead { font-size: clamp(1.3rem, 1.4vw + .8rem, 1.9rem); line-height: 1.35; max-width: 38ch; margin: 0 0 clamp(32px, 6vh, 64px); }
.about-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.about-photo { margin: 0; }
.about-photo .ph { aspect-ratio: 4 / 5; }
.about-body h2 { font-size: 1.6rem; margin: 0 0 .5em; letter-spacing: -.01em; }
.about-body h2:not(:first-child) { margin-top: 1.8em; }
.pill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pill-list li { border: 1.5px solid var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 1rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.t-years { font-family: var(--mono); font-size: .82rem; color: var(--muted); padding-top: 4px; }
.button {
  display: inline-flex; align-items: center; min-height: 48px; margin-top: 32px; padding: 0 24px;
  background: var(--ink); color: var(--ground); border-radius: 999px; text-decoration: none; font-size: 1.1rem;
  transition: background-color .25s;
}
.button:hover { background: var(--accent); }
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } .about-photo { max-width: 420px; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--ground); padding: clamp(56px, 10vh, 120px) 0 40px; }
.site-footer:focus { outline: none; }
.site-footer .eyebrow { color: #BDB5AF; }
.site-footer :focus-visible { outline-color: var(--ground); }
.site-footer h2 { font-size: clamp(2.4rem, 6vw, 5rem); line-height: 1; letter-spacing: -.03em; font-weight: 600; margin: 0 0 .4em; }
.footer-email {
  display: inline-block; font-size: clamp(1.4rem, 2.5vw, 2.4rem); font-style: italic;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 8px;
}
.footer-email:hover { color: #F2A9C6; }
.footer-links { list-style: none; margin: 32px 0 0; padding: 0; display: flex; gap: 28px; flex-wrap: wrap; }
.footer-links a { display: inline-flex; min-height: 44px; align-items: center; font-size: 1.1rem; }
.footer-small { margin: 56px 0 0; font-family: var(--mono); font-size: .76rem; color: #BDB5AF; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
