/* ==========================================================================
   Mostyn Griffith — portfolio
   ========================================================================== */
:root {
  --paper: #f6f4ef;
  --paper-2: #edeae2;
  --card: #ffffff;
  --ink: #15161a;
  --ink-2: #3b3d44;
  --muted: #6b6c72;
  --line: #dcd8cd;
  --accent: #1d4ed8;
  --accent-ink: #1e3a8a;
  --accent-soft: #e3e9fb;
  --good: #15803d;
  --on-accent: #ffffff;
  --media-bg: #ffffff;
  --footer-bg: #15161a;
  --footer-ink: #f6f4ef;
  color-scheme: light;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 14px;
  --radius-sm: 8px;
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121316;
    --paper-2: #1c1e22;
    --card: #1a1c20;
    --ink: #ecebe6;
    --ink-2: #c3c2bc;
    --muted: #8f8e89;
    --line: #2d2f34;
    --accent: #8aa6ff;
    --accent-ink: #cdd8ff;
    --accent-soft: #1b2342;
    --good: #4ade80;
    --on-accent: #0c1124;
    --media-bg: #f2f0eb;
    --footer-bg: #0a0b0d;
    --footer-ink: #ecebe6;
    color-scheme: dark;
  }
  .site-footer { border-top: 1px solid var(--line); }
  .case__media img, .tile__media img, .case-cover img { filter: brightness(.94); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 8px; }

.eyebrow {
  margin: 0 0 14px;
  font: 500 12px/1.2 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(21,128,61,.15); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
  font: 500 15px/1 var(--sans); text-decoration: none;
  transition: transform .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--light { background: var(--footer-ink); color: var(--footer-bg); border-color: var(--footer-ink); }
.btn--light:hover { background: #fff; color: #15161a; border-color: #fff; }
.site-footer .btn--ghost { color: var(--footer-ink); border-color: rgba(246,244,239,.4); }
.site-footer .btn--ghost:hover { background: transparent; color: var(--footer-ink); border-color: var(--footer-ink); }

.link-arrow { font-weight: 500; font-size: 15px; text-decoration: none; display: inline-flex; gap: 8px; color: var(--ink); }
.link-arrow::after { content: "→"; transition: transform .2s ease; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 30px); font-size: 15px; }
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a:hover { color: var(--ink); }
.nav__cta { padding: 9px 16px; border-radius: 999px; background: var(--ink); color: var(--paper) !important; }
.nav__cta:hover { background: var(--accent); color: var(--on-accent) !important; }
@media (max-width: 640px) {
  .brand span { display: none; }
  .nav { gap: 16px; font-size: 14px; }
  .nav a[href*="linkedin"] { display: none; }
}

/* ---------------------------------------------------------------- hero */
.hero { padding-top: clamp(56px, 10vw, 128px); padding-bottom: clamp(40px, 6vw, 72px); }
.hero__title {
  margin: 0;
  font: 400 clamp(44px, 7.4vw, 104px)/0.98 var(--serif);
  letter-spacing: -.02em;
  max-width: 17ch;
  text-wrap: balance;
}
.hero__title em { font-style: italic; color: var(--accent); }
.hero__foot { margin-top: clamp(32px, 5vw, 56px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; }
.hero__lede { margin: 0; max-width: 46ch; font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-2); }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 760px) { .hero__foot { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- highlights */
.highlights ul {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.highlights li + li { border-left: 1px solid var(--line); }
.highlights a { display: block; padding: 28px 24px 28px 0; text-decoration: none; height: 100%; }
.highlights li + li a { padding-left: 24px; }
.highlights strong { display: block; font: 400 clamp(28px, 2.7vw, 40px)/1.05 var(--serif); letter-spacing: -.01em; margin-bottom: 10px; white-space: nowrap; }
.highlights span { display: block; font-size: 14px; line-height: 1.45; color: var(--muted); max-width: 24ch; }
.highlights a:hover strong { color: var(--accent); }
@media (max-width: 480px) { .highlights strong { white-space: normal; } }
@media (max-width: 900px) {
  .highlights ul { grid-template-columns: repeat(2, 1fr); }
  .highlights li:nth-child(3) { border-left: 0; }
  .highlights li:nth-child(3) a { padding-left: 0; }
  .highlights li:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------------------------------------------------------------- sections */
.section-head { margin-bottom: clamp(28px, 4vw, 48px); }
.section-title { margin: 0; font: 400 clamp(34px, 4.4vw, 56px)/1.05 var(--serif); letter-spacing: -.015em; max-width: 22ch; text-wrap: balance; }
.work, .more, .about { padding-top: clamp(72px, 10vw, 128px); }

.tags { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font: 500 12px/1 var(--sans); padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); background: color-mix(in srgb, var(--card) 50%, transparent); }

/* featured cases */
.case {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px);
  align-items: center; padding: clamp(28px, 4vw, 44px) 0; border-top: 1px solid var(--line);
}
.case:nth-of-type(even) .case__media { order: 2; }
.case__media { display: block; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); aspect-ratio: 16 / 10; }
.case__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.case:hover .case__media img { transform: scale(1.025); }
.case:hover .link-arrow::after { transform: translateX(4px); }
.case__index { margin: 0 0 18px; font: 400 15px/1 var(--serif); font-style: italic; color: var(--muted); }
.case__title { margin: 0 0 12px; font: 400 clamp(30px, 3.2vw, 42px)/1.05 var(--serif); letter-spacing: -.01em; }
.case__title a { text-decoration: none; }
.case__title a::after { content: ""; position: absolute; inset: 0; }
.case { position: relative; }
.case__summary { margin: 0 0 18px; color: var(--ink-2); }
.case__teaser { margin: 0 0 22px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-ink); font-size: 15px; line-height: 1.5; }
.case__teaser span { display: block; font: 600 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 6px; opacity: .8; }
@media (max-width: 860px) {
  .case { grid-template-columns: 1fr; }
  .case:nth-of-type(even) .case__media { order: 0; }
}

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px) clamp(20px, 3vw, 32px); }
.tile a { display: block; text-decoration: none; }
.tile__media { overflow: hidden; border-radius: var(--radius); background: var(--paper-2); aspect-ratio: 4 / 3; margin-bottom: 18px; }
.tile__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.tile a:hover img { transform: scale(1.03); }
.tile__title { margin: 0 0 6px; font: 400 28px/1.1 var(--serif); }
.tile__teaser { margin: 0; color: var(--muted); font-size: 15px; max-width: 48ch; }
.tile a:hover .tile__title { color: var(--accent); }
@media (max-width: 680px) { .tiles { grid-template-columns: 1fr; } }

/* about */
.about__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); }
.about__text p { margin: 0 0 1.1em; font-size: clamp(18px, 1.5vw, 20px); color: var(--ink-2); max-width: 58ch; }
.about__text p:first-child { color: var(--ink); }
.about__label { margin: 0 0 10px; font: 500 12px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.exp { list-style: none; margin: 0 0 36px; padding: 0; border-top: 1px solid var(--line); }
.exp li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.exp li span:last-child { color: var(--muted); text-align: right; white-space: nowrap; }
.exp li strong { display: block; font-weight: 500; }
.exp li em { display: block; font-style: normal; color: var(--muted); font-size: 14px; }
.tile__year { font: 400 15px/1 var(--sans); color: var(--muted); margin-left: 6px; }
@media (max-width: 640px) { .nav a[href*="resume"] { display: none; } }
.exp--links a { text-decoration: none; }
.exp--links a:hover { color: var(--accent); }
@media (max-width: 860px) { .about__grid { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- footer */
.site-footer { margin-top: clamp(96px, 12vw, 160px); background: var(--footer-bg); color: var(--footer-ink); padding: clamp(64px, 9vw, 112px) 0 32px; }
.site-footer .eyebrow { color: rgba(246,244,239,.6); }
.site-footer__title { margin: 0 0 36px; font: 400 clamp(40px, 6vw, 80px)/1.02 var(--serif); letter-spacing: -.02em; }
.site-footer__title em { color: #9db4ff; }
.site-footer__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.site-footer__meta { margin-top: clamp(56px, 8vw, 96px); padding-top: 20px; border-top: 1px solid rgba(246,244,239,.15); display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: rgba(246,244,239,.6); }

/* ---------------------------------------------------------------- case study */
.case-hero { padding-top: clamp(32px, 5vw, 56px); padding-bottom: clamp(32px, 4vw, 48px); }
.back { display: inline-block; margin-bottom: clamp(28px, 4vw, 48px); font-size: 15px; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--ink); }
.case-hero__title { margin: 0 0 22px; font: 400 clamp(40px, 6.2vw, 84px)/1.0 var(--serif); letter-spacing: -.02em; max-width: 18ch; text-wrap: balance; }
.case-hero__summary { margin: 0 0 36px; font-size: clamp(19px, 1.7vw, 23px); line-height: 1.5; color: var(--ink-2); max-width: 52ch; }
.meta { margin: 0 0 32px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px 40px; max-width: 900px; padding-top: 22px; border-top: 1px solid var(--line); }
.meta dt { font: 500 12px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.meta dd { margin: 0; font-size: 16px; }
@media (max-width: 640px) { .meta { grid-template-columns: 1fr; } }
.stats { list-style: none; margin: 0 0 28px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; max-width: 980px; }
.stats li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.stats strong { display: block; font: 400 clamp(30px, 3vw, 40px)/1 var(--serif); color: var(--accent); margin-bottom: 8px; }
.stats span { font-size: 14px; color: var(--muted); line-height: 1.4; display: block; }

.case-cover img { width: 100%; border-radius: var(--radius); background: var(--paper-2); max-height: 78vh; object-fit: cover; }

.case-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); padding-top: clamp(48px, 7vw, 96px); }
.toc { position: sticky; top: calc(var(--header-h) + 32px); align-self: start; max-height: calc(100vh - var(--header-h) - 64px); overflow: auto; }
.toc__label { margin: 0 0 12px; font: 500 12px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li a { display: block; padding: 6px 0 6px 14px; margin-left: -1px; border-left: 2px solid transparent; font-size: 14px; line-height: 1.35; color: var(--muted); text-decoration: none; }
.toc li a:hover { color: var(--ink); }
.toc li a.is-active { color: var(--ink); border-left-color: var(--accent); }
.toc li.toc__part a { margin-top: 12px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 980px) {
  .case-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}

/* prose */
.prose { max-width: 720px; min-width: 0; }
.prose > p, .prose li { color: var(--ink-2); }
.prose p { margin: 0 0 1.15em; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose h2 { margin: 2.4em 0 .6em; font: 400 clamp(30px, 3vw, 40px)/1.1 var(--serif); letter-spacing: -.01em; color: var(--ink); }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { margin: 2em 0 .5em; font: 600 21px/1.35 var(--sans); letter-spacing: -.01em; }
.prose h4 { margin: 2em 0 .6em; font: 600 18px/1.4 var(--sans); }
.prose h3.hmw { margin: 2.2em 0 1em; padding: 28px 30px; border-radius: var(--radius); background: var(--ink); color: var(--paper); font: 400 clamp(24px, 2.4vw, 30px)/1.25 var(--serif); }
.prose ul { margin: 0 0 1.3em; padding: 0; list-style: none; }
.prose ul li { position: relative; padding-left: 26px; margin-bottom: .6em; }
.prose ul li::before { content: ""; position: absolute; left: 4px; top: .7em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); opacity: .85; }
.prose blockquote { margin: 1.8em 0; padding: 4px 0 4px 26px; border-left: 3px solid var(--accent); }
.prose blockquote p { margin: 0; font: 400 clamp(22px, 2.1vw, 27px)/1.35 var(--serif); color: var(--ink); }
.prose blockquote p::before { content: "“"; } .prose blockquote p::after { content: "”"; }
.prose blockquote cite { display: block; margin-top: 12px; font: 500 14px/1.4 var(--sans); font-style: normal; color: var(--muted); }

.part { margin: clamp(72px, 9vw, 112px) 0 8px; }
.part__rule { display: block; width: 48px; height: 3px; background: var(--accent); margin-bottom: 20px; }
.prose .part__title { margin: 0; font: 400 clamp(36px, 4.4vw, 56px)/1.02 var(--serif); letter-spacing: -.02em; }

/* media: breaks out wider than the text column on large screens */
.media { margin: 2em 0 2.2em; }
@media (min-width: 1180px) { .media { margin-right: -180px; } }
.media figure { margin: 0; }
.media img, .media video { width: 100%; height: auto; border-radius: var(--radius); background: var(--media-bg); border: 1px solid var(--line); }
.media figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }
.media--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.media--stack { display: grid; gap: 16px; }
@media (max-width: 600px) { .media--grid { grid-template-columns: 1fr; } }
.video { position: relative; }
.video__toggle {
  position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgba(21,22,26,.72); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.video__toggle span { width: 10px; height: 12px; border-left: 3px solid #fff; border-right: 3px solid #fff; }
.video__toggle.is-paused span { width: 0; height: 0; border: 0; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* next */
.next a { display: block; margin-top: clamp(80px, 10vw, 128px); padding: clamp(28px, 4vw, 44px) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none; }
.next__title { display: block; font: 400 clamp(36px, 5vw, 64px)/1.05 var(--serif); letter-spacing: -.02em; }
.next a:hover .next__title { color: var(--accent); }
.is-case .site-footer { margin-top: 0; }

.notfound { padding-top: 120px; min-height: 50vh; }

/* reveal */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
  .js .reveal.is-in { opacity: 1; transform: none; }
}
