/* ---------------------------------------------------------------
   John Roche — portfolio
   --------------------------------------------------------------- */

/* Tokens ------------------------------------------------------- */
:root {
  --paper:      #f7f6f3;
  --paper-2:    #ffffff;
  --ink:        #171614;
  --ink-2:      #3d3a35;
  --muted:      #78736b;
  --line:       #e0ddd6;
  --line-soft:  #ebe8e2;
  --accent:     #d1451f;
  --accent-ink: #ffffff;
  --shadow:     0 1px 2px rgba(23,22,20,.05), 0 12px 32px -12px rgba(23,22,20,.14);
  --shadow-lg:  0 2px 4px rgba(23,22,20,.06), 0 28px 60px -24px rgba(23,22,20,.28);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: clamp(1.25rem, 4vw, 4rem);
  --max: 1440px;
  --measure: 62ch;
  --radius: 14px;
  --radius-lg: 20px;

  --ease: cubic-bezier(.22,.61,.36,1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper:      #121211;
  --paper-2:    #1b1a18;
  --ink:        #f2f0eb;
  --ink-2:      #cbc7bf;
  --muted:      #8f8a81;
  --line:       #2e2c29;
  --line-soft:  #242220;
  --accent:     #ff6a3d;
  --accent-ink: #171614;
  --shadow:     0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.6);
  --shadow-lg:  0 2px 4px rgba(0,0,0,.45), 0 28px 60px -24px rgba(0,0,0,.8);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #121211;
    --paper-2:    #1b1a18;
    --ink:        #f2f0eb;
    --ink-2:      #cbc7bf;
    --muted:      #8f8a81;
    --line:       #2e2c29;
    --line-soft:  #242220;
    --accent:     #ff6a3d;
    --accent-ink: #171614;
    --shadow:     0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.6);
    --shadow-lg:  0 2px 4px rgba(0,0,0,.45), 0 28px 60px -24px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

/* Base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "cv05" 1, "cv11" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video, iframe { max-width: 100%; display: block; }
img { height: auto; }

a { color: inherit; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -.022em;
  line-height: 1.1;
  text-wrap: balance;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper);
  padding: .7rem 1rem; border-radius: 0 0 8px 0; font-size: .875rem;
}
.skip:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Layout helpers ----------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--narrow { max-width: 980px; }

.eyebrow {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

.inline-link {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 1px;
  transition: background-size .25s var(--ease), color .2s var(--ease);
}
.inline-link:hover { color: var(--accent); background-size: 100% 2px; }

/* Header ------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--line); }

.site-header__inner {
  display: flex; align-items: center; gap: 1.5rem;
  height: 68px;
}

.wordmark {
  font-weight: 600; font-size: 1rem; letter-spacing: -.02em;
  text-decoration: none; display: inline-flex; align-items: center; gap: .55rem;
  margin-right: auto; white-space: nowrap; flex: none;
}
.wordmark .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.wordmark__role {
  font-family: var(--mono); font-size: .6875rem; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase; font-weight: 400;
}
@media (max-width: 560px) { .wordmark__role { display: none; } }

.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav a {
  text-decoration: none; font-size: .875rem; font-weight: 500; color: var(--ink-2);
  position: relative; padding-block: .25rem;
  transition: color .2s var(--ease);
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1.5px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .3s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 560px) {
  .site-header__inner { gap: .75rem; }
  .nav { gap: .9rem; }
  .nav a { font-size: .8125rem; }
}
@media (max-width: 400px) {
  .site-header__inner { gap: .5rem; }
  .nav { gap: .7rem; }
  .nav a { font-size: .75rem; }
  .theme-toggle { width: 30px; height: 30px; }
}

.theme-toggle {
  appearance: none; border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; flex: none;
  transition: border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { border-color: var(--ink-2); color: var(--ink); transform: rotate(-20deg); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

/* Home hero ---------------------------------------------------- */
.hero {
  position: relative;
  min-height: min(84svh, 780px);
  display: flex; align-items: flex-end;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  isolation: isolate;
}
.hero__media {
  position: absolute; inset: 0; z-index: -2;
  overflow: hidden;
  background: radial-gradient(120% 90% at 20% 10%, #2c2a26 0%, #0e0d0c 70%);
}
/* Over-scaled so the YouTube title bar and controls sit outside the frame. */
.hero__media iframe {
  position: absolute; top: 50%; left: 50%;
  width: 266svh; height: 84svw;
  min-width: 150%; min-height: 150%;
  transform: translate(-50%, -50%);
  border: 0; pointer-events: none;
  opacity: .4;
}
.hero__scrim {
  position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(to top, rgba(10,10,9,.94) 0%, rgba(10,10,9,.55) 45%, rgba(10,10,9,.5) 100%);
}
.hero__inner { padding-block: clamp(3rem, 9vw, 6rem); width: 100%; }

.hero__statement {
  font-size: clamp(1.75rem, 4.1vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -.03em;
  font-weight: 600;
  max-width: 21ch;
  margin: 1.25rem 0 0;
  color: #fff;
}
.hero .eyebrow { color: rgba(255,255,255,.62); }

.hero__brands {
  margin-top: 1.75rem;
  font-family: var(--mono);
  font-size: .8125rem;
  color: rgba(255,255,255,.7);
  letter-spacing: .01em;
}

.hero__cta {
  display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.25rem;
}
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .875rem; font-weight: 500; text-decoration: none;
  padding: .7rem 1.15rem; border-radius: 999px;
  border: 1px solid transparent;
  transition: background .2s var(--ease), border-color .2s var(--ease),
              color .2s var(--ease), transform .2s var(--ease);
}
.btn svg { width: 14px; height: 14px; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn--ghost { border-color: rgba(255,255,255,.28); color: #fff; }
.btn--ghost:hover { border-color: #fff; background: rgba(255,255,255,.08); }
.btn--quiet { border-color: var(--line); color: var(--ink); }
.btn--quiet:hover { border-color: var(--ink-2); background: var(--paper-2); }

.scroll-hint {
  position: absolute; right: var(--gutter); bottom: 2rem;
  font-family: var(--mono); font-size: .625rem; letter-spacing: .16em;
  text-transform: uppercase; color: rgba(255,255,255,.5);
  writing-mode: vertical-rl; display: flex; align-items: center; gap: .6rem;
}
.scroll-hint::after {
  content: ""; width: 1px; height: 42px;
  background: linear-gradient(rgba(255,255,255,.5), transparent);
}
@media (max-width: 900px) { .scroll-hint { display: none; } }

/* Work index --------------------------------------------------- */
.section { padding-block: clamp(3.5rem, 8vw, 7rem); }

.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 2.5rem;
  border-top: 1px solid var(--line); padding-top: 1.25rem;
}
.section__head h2 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  letter-spacing: -.02em;
}
.section__count { font-family: var(--mono); font-size: .75rem; color: var(--muted); }

.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 4vw, 3.25rem) clamp(1.25rem, 2.4vw, 2rem);
}
@media (min-width: 680px)  { .work-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1120px) { .work-grid { grid-template-columns: repeat(3, 1fr); } }

.work-card { text-decoration: none; display: block; position: relative; }

.work-card__frame {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  background: #fbfbfa;
  border: 1px solid var(--line-soft);
  aspect-ratio: 16 / 11;
  box-shadow: var(--shadow);
  transition: box-shadow .35s var(--ease), border-color .35s var(--ease),
              transform .35s var(--ease);
}

.work-card__frame img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  transition: transform .7s var(--ease), filter .4s var(--ease);
}
.work-card:hover .work-card__frame {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line);
}
.work-card:hover .work-card__frame img { transform: scale(1.035); }

.work-card__index {
  position: absolute; top: .85rem; left: .95rem; z-index: 2;
  font-family: var(--mono); font-size: .6875rem; font-weight: 500;
  color: #fff; letter-spacing: .06em;
  background: rgba(15,14,13,.55);
  backdrop-filter: blur(8px);
  padding: .2rem .5rem; border-radius: 999px;
}

.work-card__body { margin-top: 1rem; }
.work-card__title {
  font-size: 1.125rem; font-weight: 600; letter-spacing: -.02em;
  display: inline-flex; align-items: center; gap: .45rem;
  text-wrap: nowrap; white-space: nowrap;
}
.work-card__title .arrow {
  color: var(--accent); opacity: 0; transform: translateX(-4px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.work-card:hover .work-card__title .arrow { opacity: 1; transform: translateX(0); }
.work-card__meta {
  display: block; margin-top: .3rem;
  font-family: var(--mono); font-size: .6875rem; color: var(--muted);
  letter-spacing: .01em;
}
.work-card__tagline {
  margin-top: .55rem; color: var(--ink-2); font-size: .9375rem;
  line-height: 1.5; max-width: 40ch;
}

/* Project page ------------------------------------------------- */
.project-head {
  padding-block: clamp(2rem, 4vw, 3.25rem) clamp(1.5rem, 3vw, 2.5rem);
  border-top: 1px solid var(--line);
}
.project-head h1 {
  font-size: clamp(2rem, 5vw, 3.75rem);
  letter-spacing: -.035em;
  margin-top: .75rem;
}
.project-head__meta {
  margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem .75rem;
  align-items: center;
}
.tag {
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .04em;
  color: var(--ink-2); border: 1px solid var(--line);
  padding: .3rem .625rem; border-radius: 999px;
}
.project-intro {
  font-size: clamp(1.0625rem, 1.6vw, 1.3125rem);
  line-height: 1.5; letter-spacing: -.012em;
  color: var(--ink-2); max-width: var(--measure);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}
.project-intro p + p { margin-top: .85em; }

/* Figure blocks: sticky caption beside a tall image */
.block {
  display: grid;
  gap: 1rem 3rem;
  padding-block: clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--line-soft);
  align-items: start;
}
@media (min-width: 1000px) {
  .block { grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 3.5rem; }
  .block__caption { position: sticky; top: 108px; }
}
.block__caption {
  color: var(--ink-2); font-size: .9375rem; line-height: 1.62;
  max-width: 44ch;
}
.block__caption p + p { margin-top: .8em; }
.block__caption .eyebrow { display: block; margin-bottom: .75rem; }

/* The case-study composites carry their own diagonal slices and shadows, so
   they sit straight on the page: no card, no border, nothing to clip them. */
.shot { background: none; border: 0; box-shadow: none; border-radius: 0; }
.shot img { width: 100%; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
  align-items: start;
}
.gallery figure { margin: 0; }
/* Uniform tiles so mixed aspect ratios still line up. */
.gallery .shot {
  margin-bottom: .6rem; aspect-ratio: 3 / 4;
  display: grid; place-items: center;
}
.gallery .shot img { width: 100%; height: 100%; object-fit: contain; }
.gallery figcaption {
  font-family: var(--mono); font-size: .6875rem; color: var(--muted);
  letter-spacing: .04em;
}

/* Fallback link under an embedded video */
.video-fallback {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--mono); font-size: .6875rem; letter-spacing: .04em;
  color: var(--muted); text-decoration: none; margin-top: .4rem;
}
.video-fallback:hover { color: var(--accent); }
.video-fallback svg { width: 11px; height: 11px; }

/* Numbered list (AI page) */
.numbered { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.numbered li {
  display: grid; grid-template-columns: 2rem 1fr; gap: .25rem 1rem;
  padding-block: 1.1rem;
  border-top: 1px solid var(--line-soft);
}
.numbered li:first-child { border-top: 0; padding-top: .25rem; }
.numbered .n {
  font-family: var(--mono); font-size: .75rem; color: var(--accent);
  font-weight: 500; padding-top: .18rem;
}
.numbered strong { display: block; font-weight: 600; color: var(--ink); }
.numbered p { color: var(--ink-2); font-size: .9375rem; margin: .25rem 0 .55rem; }

/* Video facade ------------------------------------------------- */
.video {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--line-soft); background: #0d0d0c;
  aspect-ratio: 16 / 9; box-shadow: var(--shadow);
  width: 100%; padding: 0; cursor: pointer; display: block;
}
.video img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: .82; transition: opacity .35s var(--ease), transform .7s var(--ease);
}
.video:hover img { opacity: .62; transform: scale(1.025); }
.video__play {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none;
}
.video__play span {
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255,255,255,.92); color: #111;
  display: grid; place-items: center;
  box-shadow: 0 8px 30px -8px rgba(0,0,0,.6);
  transition: transform .3s var(--ease), background .3s var(--ease);
}
.video:hover .video__play span { transform: scale(1.08); background: #fff; }
.video__play svg { width: 22px; height: 22px; margin-left: 3px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Awards / outro ----------------------------------------------- */
.note {
  border-left: 2px solid var(--accent);
  padding: .1rem 0 .1rem 1.15rem;
  color: var(--ink-2); max-width: var(--measure);
  font-size: .9375rem;
}
.awards { margin: 0; padding: 0; list-style: none; }
.awards li { font-size: .9375rem; color: var(--ink-2); }

/* Prev / next -------------------------------------------------- */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border-top: 1px solid var(--line);
  margin-top: clamp(3rem, 6vw, 5rem);
}
@media (max-width: 640px) { .pager { grid-template-columns: 1fr; } }
.pager a {
  background: var(--paper); text-decoration: none;
  padding: clamp(1.5rem, 4vw, 2.75rem) var(--gutter);
  display: flex; flex-direction: column; gap: .4rem;
  transition: background .25s var(--ease);
}
.pager a:hover { background: var(--paper-2); }
.pager a.next { text-align: right; align-items: flex-end; }
.pager__title { font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
.pager a:hover .pager__title { color: var(--accent); }

/* Experience --------------------------------------------------- */
.exp-hero {
  display: grid; gap: clamp(2rem, 4vw, 3.5rem);
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3rem);
  align-items: center;
}
@media (min-width: 880px) { .exp-hero { grid-template-columns: 1.05fr .95fr; } }
.exp-hero__portrait {
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--line-soft); box-shadow: var(--shadow);
}
.exp-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -.035em; margin-top: .75rem;
}
.exp-hero__lede {
  margin-top: 1.5rem; font-size: clamp(1rem, 1.5vw, 1.1875rem);
  color: var(--ink-2); line-height: 1.55; max-width: 48ch;
}

.timeline { border-top: 1px solid var(--line); }
.role {
  display: grid; gap: .75rem 3rem;
  padding-block: clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}
@media (min-width: 900px) {
  .role { grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); }
  .role__head { position: sticky; top: 104px; }
}
.role__org { font-size: 1.375rem; font-weight: 600; letter-spacing: -.024em; }
.role__title { font-size: .9375rem; color: var(--ink-2); margin-top: .35rem; }
.role__when {
  font-family: var(--mono); font-size: .6875rem; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase; margin-top: .55rem;
}
.role__body { max-width: var(--measure); color: var(--ink-2); }
.role__body ul { margin: 0 0 1em; padding-left: 1.1rem; }
.role__body li { margin-bottom: .4em; }
.role__awards {
  margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--line);
  font-size: .875rem; color: var(--muted);
}
.role__awards .eyebrow { display: block; margin-bottom: .4rem; color: var(--accent); }

.interests {
  padding-block: clamp(2.5rem, 5vw, 4rem);
  display: grid; gap: 1rem;
}
.interests p {
  max-width: 68ch; color: var(--ink-2);
  font-size: clamp(1rem, 1.5vw, 1.125rem); line-height: 1.6;
}

/* Contact / footer --------------------------------------------- */
.contact {
  border-top: 1px solid var(--line);
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
}
.contact h2 {
  font-size: clamp(1.75rem, 4.5vw, 3rem); letter-spacing: -.035em;
  max-width: 18ch;
}
.contact__mail {
  display: inline-block; margin-top: 1.5rem;
  font-size: clamp(1.0625rem, 2.2vw, 1.5rem); letter-spacing: -.02em;
  text-decoration: none; color: var(--ink);
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0 2px;
  transition: background-size .35s var(--ease), color .2s var(--ease);
}
.contact__mail:hover { background-size: 100% 2px; color: var(--accent); }

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem 2.5rem;
}
.site-footer__inner {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem;
  align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: .75rem; color: var(--muted);
}
.site-footer a { text-decoration: none; transition: color .2s var(--ease); }
.site-footer a:hover { color: var(--accent); }
.site-footer nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* Reveal on scroll --------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); }
  .reveal.is-in {
    opacity: 1; transform: none;
    transition: opacity .7s var(--ease), transform .7s var(--ease);
  }
}
