/* Conrique portfolio, lights on / lights off */

:root {
  --paper: #F3F1EC;
  --paper-cover: #DED7CC;
  --paper-2: #E9E5DD;
  --ink: #1D1B18;
  --muted: #6B665E;
  --rule: #CFC9BF;
  --accent: #F2B45A;      /* the line of light */
  --accent-ink: #8F530A;  /* accent as text on paper, 5.4:1 */
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter Tight", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 56px);
  --line-x: calc(var(--gutter) / 2);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

[data-theme="dark"] .cover { --muted: #9A948A; }
[data-theme="dark"] {
  --paper: #0E0D0C;
  --paper-cover: #0E0D0C;
  --paper-2: #171513;
  --ink: #ECE7DE;
  --muted: #9A948A;
  --rule: #2B2825;
  --accent-ink: #F2B45A;
  color-scheme: dark;
}

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

html {
  scroll-snap-type: y proximity;
  -webkit-text-size-adjust: 100%;
}
html.has-open { scroll-snap-type: none; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15.5px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .6s var(--ease), color .6s var(--ease);
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
p { margin: 0 0 1em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
ol, ul { list-style: none; margin: 0; padding: 0; }

:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }
::selection { background: var(--accent); color: #1D1B18; }
html { scrollbar-color: var(--rule) var(--paper); caret-color: var(--accent-ink); }

/* drawn icons */
.ic-plus { position: relative; display: inline-block; width: 10px; height: 10px; transition: rotate .35s var(--ease); }
.ic-plus::before, .ic-plus::after { content: ""; position: absolute; background: currentColor; }
.ic-plus::before { left: 0; right: 0; top: 50%; height: 1px; translate: 0 -.5px; }
.ic-plus::after { top: 0; bottom: 0; left: 50%; width: 1px; translate: -.5px 0; }
[aria-expanded="true"] .ic-plus, .ic-plus.x { rotate: 45deg; }
.ic-plus.x { width: 14px; height: 14px; }
.ic-arrow { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.ic-arrow.down { rotate: 90deg; }

.visually-hidden, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--ink); color: var(--paper); padding: 8px 12px; }

/* ---------- bar ---------- */

.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  font: 500 11.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  background: linear-gradient(var(--paper) 55%, transparent);
  transition: background .6s var(--ease);
}
.brand { text-decoration: none; font-family: var(--serif); font-weight: 400; font-size: 15px; letter-spacing: .32em; }

.toc { position: relative; }
.toc-toggle, .lights {
  background: none; border: 1px solid var(--rule); border-radius: 999px;
  padding: 11px 16px; cursor: pointer; text-transform: inherit; letter-spacing: inherit; font-size: inherit;
  display: inline-flex; align-items: center; gap: 8px;
}
.toc-toggle:hover, .lights:hover { border-color: var(--ink); }
.toc ol {
  position: absolute; top: calc(100% + 8px); left: 50%; translate: -50% 0;
  min-width: 260px; padding: 10px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 14px;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.toc.open ol, .toc:focus-within ol { opacity: 1; visibility: visible; }
@media (hover: hover) { .toc:hover ol { opacity: 1; visibility: visible; } }
.toc ol a { display: flex; gap: 14px; padding: 8px 10px; border-radius: 8px; text-decoration: none; text-transform: none; letter-spacing: .02em; font-size: 14px; font-weight: 400; }
.toc ol a:hover, .toc ol a[aria-current="true"] { background: var(--paper-2); }
.toc .n, .num, .toc-row .n { color: var(--accent-ink); font-variant-numeric: tabular-nums; }

.lights .dot {
  width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--ink);
  transition: background .4s, box-shadow .4s, border-color .4s;
}
[data-theme="dark"] .lights .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px 2px var(--accent); }

/* ---------- line of light ---------- */

.line {
  position: fixed; top: 0; left: 0; width: calc(var(--line-x) + 24px); height: 100vh;
  z-index: 10; pointer-events: none; overflow: visible;
}
.line path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; }
[data-theme="dark"] .line path { filter: drop-shadow(0 0 4px var(--accent)); }
.progress { display: none; }

/* ---------- spreads ---------- */

.spread {
  position: relative; min-height: 100svh;
  scroll-snap-align: start; overflow-x: clip;
}
.frame {
  position: relative; isolation: isolate;
  max-width: 1440px; margin: 0 auto;
  padding: clamp(84px, 11vh, 128px) var(--gutter) clamp(48px, 8vh, 96px) calc(var(--gutter) + 20px);
}
.label {
  font: 500 11.5px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  border-top: 1px solid var(--rule); padding-top: 14px; margin: 0 0 28px;
}

.js .fade { color: var(--muted); transition: color 1.4s var(--ease); }
.js .fade.in { color: var(--ink); }

figcaption, .caption { font-size: 12px; line-height: 1.45; color: var(--muted); margin-top: 10px; }
figcaption .n { color: var(--accent-ink); margin-right: 4px; }

/* ---------- cover ---------- */

.cover {
  --muted: #57524B;
  background: var(--paper-cover);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto 1fr auto auto;
  padding: 88px var(--gutter) 20px calc(var(--gutter) + 20px);
  transition: background .6s var(--ease);
}
.cover-name { display: contents; }
.cover-first, .cover-last {
  font: 300 clamp(44px, 10.5vw, 188px)/.95 var(--serif);
  letter-spacing: .14em; text-transform: uppercase;
  grid-column: 1 / 4; position: relative; z-index: 2;
}
.cover-first { grid-row: 1; justify-self: start; }
.cover-last { grid-row: 3; justify-self: end; margin-right: -.14em; }
.cover-hero {
  grid-row: 2; grid-column: 2; align-self: center;
  width: clamp(220px, 30vw, 520px); margin: clamp(12px, 3vh, 32px) 0;
  transform-origin: 50% 30%;
}
.cover-hero img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.cover-tag { grid-row: 2; grid-column: 1; align-self: end; font: 400 clamp(18px, 1.6vw, 24px)/1.3 var(--serif); margin: 0; }
.vert {
  position: absolute; top: 96px; right: var(--gutter); margin: 0;
  writing-mode: vertical-rl; font: 400 11px/1 var(--serif); letter-spacing: .6em; text-transform: uppercase;
}
.cover-foot {
  grid-row: 4; grid-column: 1 / 4; display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); padding-top: 16px;
}
.cover-foot a { color: var(--ink); text-decoration: none; }
.cue { position: absolute; left: 50%; bottom: 18px; width: 1px; height: 40px; overflow: hidden; }
.cue span { display: block; width: 1px; height: 100%; background: var(--ink); animation: cue 2.4s var(--ease) infinite; }
@keyframes cue { from { translate: 0 -100%; } to { translate: 0 100%; } }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .cover-hero { animation: grow linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
    @keyframes grow { to { scale: 1.7; } }
    .gallery figure, .wide { overflow: clip; }
    .gallery figure img, .wide img {
      animation: drift linear both; animation-timeline: view(); scale: 1.06;
    }
    @keyframes drift { from { translate: 0 24px; } to { translate: 0 -24px; } }
  }
}

/* ---------- contents ---------- */

.contents .frame { display: grid; grid-template-columns: 7fr 5fr; column-gap: clamp(24px, 4vw, 64px); align-content: center; min-height: 100svh; }
.lede { grid-column: 1 / -1; font: 400 clamp(24px, 2.7vw, 38px)/1.28 var(--serif); max-width: 24em; margin-bottom: clamp(40px, 8vh, 96px); }
.contents .label { grid-column: 1 / -1; }
.toc-rows { grid-column: 1; }
.toc-row {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--rule); text-decoration: none;
}
.toc-row .t { font: 400 clamp(20px, 2vw, 28px)/1.2 var(--serif); transition: translate .4s var(--ease), color .3s; }
.toc-row .k { font-size: 12px; color: var(--muted); }
.toc-row:hover .t, .toc-row:focus-visible .t { translate: 10px 0; color: var(--accent-ink); }
.toc-preview {
  grid-column: 2; grid-row: 3; align-self: center;
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
  opacity: 0; scale: .97; transition: opacity .45s var(--ease), scale .6s var(--ease);
  pointer-events: none;
}
.toc-preview.show { opacity: 1; scale: 1; }

/* ---------- about ---------- */

.about-grid { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(24px, 4vw, 72px); align-items: start; margin-bottom: 56px; }
.display { font: 400 clamp(30px, 3.6vw, 54px)/1.1 var(--serif); margin: 0 0 32px; }
.about-text p:not(.display) { max-width: 36em; }
.rows > div { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; border-top: 1px solid var(--rule); padding: 16px 0 8px; }
.rows dt { font-size: 12px; color: var(--muted); }
.rows dd { margin: 0; }
.when { font-weight: 500; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; border-top: 1px solid var(--rule); margin-top: 40px; padding-top: 16px; }
.stat { display: block; font: 300 clamp(56px, 7vw, 108px)/1 var(--serif); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--muted); }

/* ---------- project spreads ---------- */

.proj-head { border-bottom: 1px solid var(--rule); padding-bottom: 18px; margin-bottom: 32px; }
.proj-head { display: grid; grid-template-columns: clamp(36px, 4vw, 64px) 1fr; column-gap: 8px; align-items: baseline; }
.proj-head .num { font-size: 12px; letter-spacing: .1em; }
.proj-head .meta { grid-column: 2; }
.title {
  font: 300 clamp(34px, 5.4vw, 84px)/1.05 var(--serif);
  letter-spacing: .3em; text-transform: uppercase; margin: 0 0 14px;
}
.title.lower { text-transform: none; letter-spacing: .18em; }
.meta { font-size: 12.5px; color: var(--muted); margin: 0; }

/* lights off: giant outlined title behind the work */
.project .title::before {
  content: attr(data-title);
  position: absolute; z-index: -1; left: calc(var(--gutter) + 8px); top: clamp(120px, 18vh, 200px);
  font-size: clamp(120px, 19vw, 340px); line-height: .9; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px var(--ink);
  opacity: 0; transition: opacity .8s var(--ease); pointer-events: none;
}
[data-theme="dark"] .project .title::before { opacity: .16; }

.proj-grid { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(24px, 3.2vw, 56px); align-items: start; }
.hero img { width: 100%; max-height: calc(100svh - 300px); min-height: 280px; object-fit: cover; }
.body p { max-width: 34em; }
.role { margin-top: 28px; font-size: 13px; color: var(--muted); }
.role span { display: block; color: var(--ink); font-weight: 500; font-size: 14px; }

.open, .cta {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 20px;
  padding: 12px 20px; border-radius: 999px; border: 1px solid var(--ink);
  background: none; cursor: pointer; text-decoration: none;
  font: 500 12px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  transition: background .25s, color .25s, border-color .25s;
}
.open:hover { background: var(--ink); color: var(--paper); }
.cta { background: var(--accent); border-color: var(--accent); color: #1D1B18; margin-right: 8px; }
.cta:hover { background: #1D1B18; border-color: #1D1B18; color: var(--accent); }
.no-js .open { display: none; }

/* opened content */
.js .spread:not(.is-open) > .more,
.js .half:not(.is-open) > .more { display: none; }
.more > .frame { padding-top: 24px; }
.is-open > .more { animation: unfold .7s var(--ease) both; }
@keyframes unfold { from { opacity: 0; translate: 0 24px; } }

.gallery { display: grid; gap: 16px; margin: 0 0 56px; align-items: start; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.gallery .span { grid-column: 1 / -1; margin-top: 0; }
.gallery img { width: 100%; }
.g-4 img { aspect-ratio: 3 / 4; object-fit: cover; }
.wide { margin-bottom: 40px; }
.wide img { width: 100%; max-height: 82svh; object-fit: cover; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 64px); align-items: center; margin-bottom: 56px; }
.stack { display: grid; gap: 12px; }
.quote { font: italic 400 clamp(26px, 2.6vw, 38px)/1.2 var(--serif); margin-bottom: 12px; }
.muted { color: var(--muted); }
.big { font: 400 clamp(20px, 1.9vw, 27px)/1.38 var(--serif); }
.patent { font: italic 400 clamp(18px, 1.6vw, 22px)/1.4 var(--serif); color: var(--muted); max-width: 40em; }

.drawing-block { margin: 0 0 56px; }
.drawing-note { font: 400 clamp(20px, 1.8vw, 26px)/1.35 var(--serif); max-width: 34em; }
.drawing {
  position: relative; display: block; width: 100%; padding: 0; cursor: zoom-in; text-decoration: none;
  border: 1px solid var(--rule); background: #fff;
}
.drawing img { width: 100%; }
.zoom-hint {
  position: absolute; right: 12px; bottom: 12px; padding: 7px 12px; border-radius: 999px;
  background: #1D1B18; color: #F3F1EC; font: 500 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  transition: background .25s, color .25s;
}
.drawing:hover .zoom-hint { background: var(--accent); color: #1D1B18; }

/* process scrubber */
.scrubber { margin: 0 0 56px; }
.scrub-stage { position: relative; aspect-ratio: 16 / 10; background: var(--paper-2); }
.scrub-stage figure {
  position: absolute; inset: 0; display: grid; grid-template-rows: 1fr auto;
  opacity: 0; transition: opacity .5s var(--ease);
}
.scrub-stage figure.active { opacity: 1; }
.scrub-stage img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.scrub-stage figcaption {
  display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 16px;
  margin: 0; padding: 14px 18px; font-size: 13.5px; color: var(--ink); background: var(--paper);
}
.step-n { font: 300 36px/1 var(--serif); }
.step-k { font-size: 12px; color: var(--muted); }
.scrub-control { display: block; padding: 18px 0 6px; }
.scrub-control input { width: 100%; appearance: none; background: none; height: 24px; cursor: pointer; margin: 0; }
.scrub-control input::-webkit-slider-runnable-track { height: 1px; background: var(--rule); }
.scrub-control input::-moz-range-track { height: 1px; background: var(--rule); }
.scrub-control input::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); margin-top: -9px; border: 0; }
.scrub-control input::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 0; }
.scrub-note { font: italic 400 clamp(20px, 1.8vw, 26px)/1.3 var(--serif); margin-top: 12px; }
.no-js .scrub-stage { aspect-ratio: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; background: none; }
.no-js .scrub-stage figure { position: static; opacity: 1; }
.no-js .scrub-control { display: none; }

/* ---------- studio ---------- */

.halves { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 64px); }
.half .hero img { max-height: 52svh; }
.title.small { font-size: clamp(22px, 2.5vw, 36px); letter-spacing: .26em; margin-top: 24px; }
.half .meta { margin-bottom: 16px; }
.half > .more { margin-top: 24px; }

/* ---------- writing ---------- */

.pull { margin: 0 0 56px; }
.pull p { font: italic 400 clamp(34px, 5vw, 76px)/1.08 var(--serif); margin: 0 0 16px; }
.pull cite { font: normal 12px/1 var(--sans); color: var(--muted); }
.essays { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 24px; padding-bottom: 12px; }
.big-n { display: block; font: 300 56px/1 var(--serif); margin-bottom: 6px; }
.course { font: italic 400 24px/1.25 var(--serif); margin-bottom: 4px; }

/* ---------- contact ---------- */

.contact .frame { display: flex; flex-direction: column; min-height: 100svh; }
.awards { width: 100%; border-collapse: collapse; margin-bottom: 56px; }
.awards td { padding: 11px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.awards td:first-child { width: 120px; color: var(--muted); }
.awards td:last-child { text-align: right; color: var(--muted); }
.contact-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; border-top: 1px solid var(--rule); padding-top: 14px; }
.contact-links .k { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.contact-links a { font: 400 clamp(18px, 1.8vw, 26px)/1.3 var(--serif); text-decoration: none; overflow-wrap: anywhere; }
.contact-links a:hover { color: var(--accent-ink); }
.email {
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  transition: background-size 1.6s var(--ease);
}
.email.in { background-size: 100% 2px; }
[data-theme="dark"] .email.in { filter: drop-shadow(0 2px 6px rgba(242, 180, 90, .55)); }
.download { align-self: flex-start; margin-top: 40px; }
.closing {
  margin: auto 0 0; padding-top: 64px;
  font: 300 clamp(48px, 10.5vw, 196px)/.9 var(--serif); letter-spacing: .26em; text-transform: uppercase; margin-right: -.26em;
  white-space: nowrap;
}
.foot { display: flex; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--muted); padding-top: 20px; }
.foot span:last-child { color: var(--ink); }

/* ---------- drawing viewer ---------- */

.viewer {
  width: 100vw; height: 100svh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: rgba(14, 13, 12, .97); color: #ECE7DE;
}
.viewer::backdrop { background: rgba(14, 13, 12, .6); }
.viewer-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.viewer-stage.dragging { cursor: grabbing; }
.viewer-stage img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: contain; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; max-width: none;
}
.viewer .close {
  position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid #4A4540; background: rgba(14, 13, 12, .8); color: inherit; cursor: pointer; font-size: 16px;
}
.viewer .close:hover { border-color: var(--accent); color: var(--accent); }
.viewer-hint {
  position: absolute; bottom: 16px; left: 50%; translate: -50% 0; margin: 0;
  font-size: 12px; color: #CFC9BF; white-space: nowrap; pointer-events: none;
  background: rgba(14, 13, 12, .85); padding: 8px 14px; border-radius: 999px;
}

/* ---------- small screens ---------- */

@media (max-width: 1023px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  html { scroll-snap-type: none; }
  .spread { min-height: 0; }
  .frame { padding: 88px var(--gutter) 56px; }
  .line { display: none; }
  .progress {
    display: block; position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30;
    background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0));
  }
  .bar { padding: 12px var(--gutter); }
  .brand { font-size: 13px; letter-spacing: .24em; }
  .toc ol { position: fixed; top: 56px; left: var(--gutter); right: var(--gutter); translate: none; min-width: 0; }
  .lights-label { display: none; }

  .cover { min-height: 100svh; padding: 76px var(--gutter) 16px; grid-template-columns: 1fr; grid-template-rows: repeat(5, auto); align-content: space-between; }
  .cover-first, .cover-last { grid-column: 1; font-size: 12.5vw; letter-spacing: .12em; }
  .cover-hero { grid-column: 1; justify-self: center; width: 72vw; }
  .cover-tag { grid-row: 4; grid-column: 1; margin-top: 16px; }
  .cover-foot { grid-row: 5; grid-column: 1; }
  .vert { display: none; }

  .contents .frame, .about-grid, .proj-grid, .split, .halves, .rows > div, .contact-links { grid-template-columns: 1fr; }
  .contents .frame { min-height: 0; }
  .toc-preview { display: none; }
  .toc-row { grid-template-columns: 40px 1fr auto; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .stat-label { font-size: 11.5px; }
  .hero img { max-height: 70svh; min-height: 0; }
  .g-3 { grid-template-columns: 1fr; }
  .rows > div { gap: 6px; }
  .awards td:first-child { width: 56px; }
  .awards td:last-child { display: none; }
  .project .title::before { display: none; }
  .title { font-size: clamp(26px, 8.4vw, 34px); }
  .title.lower { letter-spacing: .1em; }
  .title { overflow-wrap: anywhere; }
  .scrub-stage { aspect-ratio: 4 / 5; }
  .scrub-stage figcaption { grid-template-columns: auto 1fr; }
  .scrub-stage figcaption .step-k { grid-column: 2; grid-row: 1; }
  .scrub-stage figcaption { font-size: 13px; }
  .closing { letter-spacing: .2em; }
  .foot { flex-direction: column; }
}

/* ---------- reduced motion ---------- */

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