/* A specimen-led portfolio: one generous text column, one continuous image stage. */
@font-face {
  font-family: "Source Sans 3";
  src: url("../../assets/fonts/source-sans-3-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("../../assets/fonts/source-sans-3-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
}

@font-face {
  font-family: "Caveat";
  src: url("./assets/caveat-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Spectral";
  src: url("../../assets/fonts/spectral-400-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  font-synthesis: none;
  color-scheme: light;
  --page: #eef1f3;
  --ink: #273440;
  --muted: #5d6b77;
  --quiet: #5f6b76;
  --link: #30596f;
  --rule: #cdd5db;
  --header: rgba(238, 241, 243, .94);
  --gutter: clamp(28px, 6.5vw, 116px);
  --header-height: 88px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 16px); }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--page);
  color: var(--ink);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-underline-offset: 5px; text-decoration-thickness: 1px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 6px;
}
button:disabled { cursor: default; }
[hidden] { display: none !important; }
::selection { background: #c5dce8; color: #1e3543; }
.skip-link { position: fixed; z-index: 50; top: 12px; left: var(--gutter); padding: 10px 14px; transform: translateY(-160%); background: var(--page); color: var(--ink); font-size: 14px; }
.skip-link:focus { transform: translateY(0); }

/* Navigation stays in one predictable place while the project scenery changes. */
.draft-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: clamp(22px, 3vw, 58px);
  min-height: var(--header-height);
  padding: 12px var(--gutter);
  background: var(--header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.draft-brand {
  flex: none;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.02em;
  text-decoration: none;
}

.draft-brand span, .draft-brand small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

.draft-nav {
  display: flex;
  align-items: center;
  gap: clamp(17px, 2.2vw, 34px);
  min-width: 0;
  margin-left: auto;
}

.draft-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
}

.draft-nav a::after {
  position: absolute;
  inset: auto 0 4px;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0;
  transform: scaleX(.5);
  transform-origin: left;
  transition: opacity 160ms ease, transform 160ms ease;
}

.draft-nav a:hover, .draft-nav a[aria-current], .draft-nav a.is-active { color: var(--ink); }
.draft-nav a[aria-current]::after, .draft-nav a.is-active::after { opacity: 1; transform: scaleX(1); }
.draft-tools { display: flex; flex: none; align-items: center; gap: 12px; }
.draft-tools button {
  min-height: 36px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.draft-tools button:hover { color: var(--ink); }
.draft-tools button[aria-pressed="true"] { border-bottom-color: var(--ink); color: var(--ink); }
.draft-mode { flex: none; color: var(--quiet); font-size: 11px; line-height: 1.4; text-decoration: none; }
a.draft-mode:hover { color: var(--ink); text-decoration: underline; }

/* The images are the page's material, rather than thumbnails in a card grid. */
.project-stage {
  position: absolute;
  z-index: 0;
  top: var(--header-height);
  right: -2vw;
  bottom: auto;
  height: calc(100svh - var(--header-height));
  left: 30%;
  overflow: hidden;
  background: var(--page);
  pointer-events: none;
  isolation: isolate;
}

body[data-enhanced] .project-stage { position: fixed; }

.project-visual {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 520ms ease, visibility 0s 520ms;
}

.project-visual.is-active {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.project-visual img, .project-visual video, .project-visual picture, .project-visual svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
}

.project-visual picture img { width: 100%; height: 100%; }
.project-visual:not([data-visual="fly"]) { mix-blend-mode: multiply; }
.project-visual:not([data-visual="fly"]) img { opacity: .62; }
.project-visual[data-visual="morphbrain"] img { opacity: .3; }
.project-visual[data-visual="fly"] { inset: -11% -6% -9% -12%; }
#ghost-fly { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.project-visual[data-visual="fly"] #ghost-fly { opacity: 0; }
.project-visual[data-visual="fly"].has-model #ghost-fly,
.project-visual[data-visual="fly"] #ghost-fly.has-model { opacity: 1; }
.project-visual.has-model .fly-fallback { opacity: 0; }
.project-visual:has(#ghost-fly.has-model) .fly-fallback { opacity: 0; }
.project-visual .fly-fallback { opacity: 1; }
.project-visual[data-visual="morphbrain"] img {
  /* The source region colours remain intact; luminance makes its dark
     rectangular background transparent in this decorative composition. */
  mask-image: url("../../assets/portfolio/morphbrain-regions.png");
  mask-mode: luminance;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}
.project-visual[data-visual="rare-errors"] { inset: 9% 3% 11% 14%; }
.project-visual[data-visual="morphbrain"] { inset: 3% 0 5% 1%; }
.project-visual[data-visual="model-morpher"] { inset: 5% 0 5% -2%; }
.project-visual[data-visual="morphliner"] { inset: 5% 2% 8% 1%; }

/* Every chapter shares the same reading edge, so scrolling feels continuous. */
.portfolio-story { position: relative; z-index: 1; }
.project-chapter {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-height) + 56px) var(--gutter) 90px;
  scroll-margin-top: 0;
}

.chapter-copy { width: min(100%, 450px); padding: 0; }
.project-kind { max-width: 40ch; margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.project-title {
  position: relative;
  width: max-content;
  max-width: min(70vw, 900px);
  margin: 0 0 25px -6px;
  font-family: "Caveat", cursive;
  font-size: clamp(82px, 8.6vw, 136px);
  font-weight: 500;
  line-height: .92;
  letter-spacing: -.045em;
  text-wrap: balance;
  color: var(--ink);
}

.project-description {
  max-width: 37ch;
  margin: 0;
  color: var(--ink);
  font-size: clamp(18px, 1.55vw, 22px);
  line-height: 1.55;
  text-wrap: pretty;
}

.project-links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 25px; margin: 27px 0 0; }
.project-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--link); font-size: 15px; font-weight: 600; line-height: 1.35; }
.project-links a:hover { text-decoration-thickness: 2px; }
.project-caption { max-width: 48ch; margin: 24px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.project-caption a { color: inherit; }
.draft-intro { max-width: 42ch; margin: 0 0 28px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.draft-intro strong { color: var(--ink); font-weight: 600; }
.scroll-cue { display: flex; align-items: center; gap: 10px; margin: 32px 0 0; color: var(--quiet); font-size: 12px; line-height: 1.4; }
.scroll-cue span { font-size: 18px; }
.draft-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px 28px;
  min-height: 112px;
  padding: 28px var(--gutter);
  border-top: 1px solid var(--rule);
  background: var(--page);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.draft-footer p { max-width: 60ch; margin: 0; }
.draft-footer a { color: var(--ink); }
.draft-footer > div { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.draft-footer small { display: block; flex-basis: 100%; max-width: 100ch; font-size: 11px; }

/* The alternate studies retain the content and pacing, while changing contrast. */
body[data-direction="night"] {
  color-scheme: dark;
  --page: #18232d;
  --ink: #edf1f4;
  --muted: #b2bdc7;
  --quiet: #a6b3bf;
  --link: #bdd6e5;
  --rule: #3b4b59;
  --header: rgba(24, 35, 45, .94);
}
body[data-direction="night"] ::selection { background: #526e81; color: #fff; }
body[data-direction="night"] .project-visual[data-visual="fly"] { opacity: 0; }
body[data-direction="night"] .project-visual[data-visual="fly"].is-active { opacity: 1; }
body[data-direction="night"] .project-visual:not([data-visual="fly"]) { mix-blend-mode: normal; }
body[data-direction="night"] .project-visual:not([data-visual="fly"]) img { mix-blend-mode: normal; opacity: .7; }
body[data-direction="night"] .project-visual[data-visual="morphbrain"] img { opacity: .55; }
body[data-direction="night"] .project-visual[data-visual="rare-errors"],
body[data-direction="night"] .project-visual[data-visual="model-morpher"] { mix-blend-mode: screen; }
body[data-direction="night"] .project-visual[data-visual="rare-errors"] img,
body[data-direction="night"] .project-visual[data-visual="model-morpher"] img {
  filter: invert(1) hue-rotate(180deg);
  opacity: .45;
}
body[data-direction="editorial"] {
  --page: #fbfcfc;
  --ink: #203643;
  --muted: #5d6c76;
  --quiet: #606f79;
  --link: #315f77;
  --rule: #d5dde2;
  --header: rgba(251, 252, 252, .94);
}
body[data-direction="editorial"] .draft-header { border-bottom: 1px solid var(--rule); }
body[data-direction="editorial"] .project-stage { left: 33%; right: 0; }
body[data-direction="editorial"] .project-title {
  font-family: "Spectral", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(64px, 7vw, 110px);
  line-height: 1.05;
  letter-spacing: -.055em;
}
body[data-direction="editorial"] .project-description { max-width: 33ch; }

@media (min-width: 1700px) {
  :root { --gutter: max(116px, calc((100vw - 1480px) / 2)); }
  .project-stage { right: max(0px, calc((100vw - 1800px) / 2)); left: 30%; }
}

@media (max-width: 1200px) {
  :root { --gutter: 42px; }
  .draft-header { gap: 25px; }
  .draft-nav { gap: 20px; }
  .draft-nav a { font-size: 12px; }
  .draft-tools { gap: 9px; }
  .draft-mode { max-width: 84px; }
  .project-stage { left: 30%; right: -6%; }
  .chapter-copy { width: min(100%, 410px); }
  .project-description { max-width: 32ch; font-size: 20px; }
}

@media (max-width: 1100px) {
  :root { --header-height: 110px; --gutter: 32px; }
  .draft-header { flex-wrap: wrap; align-content: center; gap: 2px 22px; padding-top: 10px; padding-bottom: 5px; }
  .draft-brand { margin-right: auto; font-size: 18px; }
  .draft-nav { order: 4; width: 100%; justify-content: space-between; gap: 18px; margin: 0; }
  .draft-nav a { min-height: 38px; font-size: 13px; }
  .draft-nav a::after { bottom: 1px; }
  .draft-tools { margin-left: 0; }
  .draft-mode { max-width: none; }
  .project-stage { left: 31%; right: -12%; }
  .chapter-copy { width: min(100%, 365px); }
  .project-title { font-size: clamp(80px, 10.5vw, 116px); }
  .project-description { max-width: 29ch; font-size: 19px; }
  .project-caption { max-width: 38ch; }
  body[data-direction="editorial"] .project-stage { left: 34%; right: -7%; }
  body[data-direction="editorial"] .project-title { font-size: clamp(64px, 8.1vw, 90px); }
}

@media (max-width: 700px) {
  :root { --gutter: 25px; --header-height: 108px; }
  .draft-header { gap: 3px 16px; min-height: var(--header-height); }
  .draft-brand { font-size: 17px; }
  .draft-brand span, .draft-brand small { margin-top: 2px; font-size: 11px; }
  .draft-tools { gap: 13px; }
  .draft-tools button { min-height: 34px; font-size: 11px; }
  .draft-mode { font-size: 10px; }
  .draft-nav { justify-content: flex-start; gap: 24px; overflow-x: auto; scrollbar-width: none; }
  .draft-nav::-webkit-scrollbar { display: none; }
  .draft-nav a { min-height: 37px; font-size: 12px; }
  .project-stage {
    top: calc(var(--header-height) + 5px);
    left: 7%;
    right: -8%;
    bottom: auto;
    height: 43svh;
    min-height: 240px;
    max-height: 390px;
  }
  body[data-direction="editorial"] .project-stage { left: 9%; right: -7%; }
  .project-visual[data-visual="fly"] { inset: -8% -3% -8% -9%; }
  .project-visual[data-visual="rare-errors"] { inset: 4% 6%; }
  .project-visual[data-visual="morphbrain"],
  .project-visual[data-visual="model-morpher"],
  .project-visual[data-visual="morphliner"] { inset: 1% 0; }
  .project-chapter {
    align-items: flex-start;
    min-height: max(100svh, 820px);
    padding-top: calc(var(--header-height) + clamp(270px, 43svh, 390px));
    padding-bottom: 65px;
  }
  .chapter-copy { width: 100%; max-width: 480px; padding: 24px 0 0; background: var(--page); }
  .project-kind { margin-bottom: 13px; font-size: 12px; }
  .project-title {
    max-width: 100%;
    margin: 0 0 21px -3px;
    font-size: clamp(73px, 15vw, 104px);
    line-height: .92;
    letter-spacing: -.04em;
  }
  body[data-direction="editorial"] .project-title { font-size: clamp(54px, 10.8vw, 74px); line-height: 1.05; }
  .project-description, body[data-direction="editorial"] .project-description { max-width: 40ch; font-size: 18px; line-height: 1.55; }
  .project-links { gap: 7px 23px; margin-top: 19px; }
  .project-links a { min-height: 38px; font-size: 14px; }
  .project-caption { max-width: 47ch; margin-top: 16px; font-size: 11px; }
  .draft-intro { margin-bottom: 18px; max-width: 43ch; font-size: 13px; }
  .draft-footer { min-height: 140px; padding-top: 24px; padding-bottom: 32px; font-size: 12px; }
}

@media (max-width: 390px) {
  :root { --gutter: 21px; }
  .draft-header { gap: 1px 11px; }
  .draft-tools { gap: 10px; }
  .draft-mode { max-width: 66px; }
  .draft-nav { gap: 21px; }
  .project-title { font-size: 73px; }
  body[data-direction="editorial"] .project-title { font-size: 52px; }
  .project-description { font-size: 17px; }
}

@media (max-height: 620px) and (min-width: 701px) {
  :root { --header-height: 74px; }
  .project-chapter { min-height: 660px; padding-top: 115px; padding-bottom: 65px; }
  .project-title { font-size: clamp(78px, 9vw, 126px); }
  .project-stage { top: var(--header-height); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  body { color: #203643; background: #fff; }
  .draft-header { position: static; padding: 16px 0; background: transparent; }
  .draft-nav, .draft-tools, .draft-mode, .project-stage { display: none; }
  .project-chapter { min-height: auto; padding: 28px 0; break-inside: avoid; }
  .chapter-copy { width: 100%; max-width: none; }
  .project-title { max-width: none; font-size: 62px; }
  .project-description { max-width: 70ch; font-size: 14px; }
  .draft-footer { padding: 20px 0; background: transparent; }
}
