/* demarest.dev. cool bench grey, ink, one violet accent (a 405 nm laser).
   archivo carries headings and interface text, source serif 4 carries reading text. */

:root {
  --bg: #eceef1;
  --surface: #f7f8fa;
  --ink: #171a21;
  --muted: #596070;
  --rule: #cbd0d8;
  --rule-strong: #9ea5b2;
  --accent: #5530e0;
  --accent-soft: rgba(85, 48, 224, 0.12);
  --fig-grid: rgba(23, 26, 33, 0.07);
  --fig-soft: #e6e9ee;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b;
    --surface: #1b1e25;
    --ink: #e8eaef;
    --muted: #9aa1af;
    --rule: #2c313b;
    --rule-strong: #4a5160;
    --accent: #a08cff;
    --accent-soft: rgba(160, 140, 255, 0.14);
    --fig-grid: rgba(232, 234, 239, 0.06);
    --fig-soft: #232731;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161b;
  --surface: #1b1e25;
  --ink: #e8eaef;
  --muted: #9aa1af;
  --rule: #2c313b;
  --rule-strong: #4a5160;
  --accent: #a08cff;
  --accent-soft: rgba(160, 140, 255, 0.14);
  --fig-grid: rgba(232, 234, 239, 0.06);
  --fig-soft: #232731;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--sans);
  font-weight: 650;
  line-height: 1.1;
  margin: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 50;
  background: var(--ink);
  color: var(--bg);
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.skip:focus {
  left: 8px;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------------- masthead */

.masthead {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  font-family: var(--sans);
  position: relative;
  z-index: 5;
}
.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-stretch: 80%;
  font-size: 1.15rem;
  letter-spacing: 0.005em;
}
.masthead nav {
  display: flex;
  gap: clamp(16px, 3vw, 32px);
  font-size: 0.98rem;
}
.masthead nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1.5px solid transparent;
}
.masthead nav a:hover,
.masthead nav a[aria-current="page"] {
  border-bottom-color: var(--accent);
}

.masthead-over {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  max-width: none;
  padding-left: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
  padding-right: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
}
.masthead-over nav a {
  color: #e9ebf2;
}

/* ---------------- hero: a laser on an optical table */

.hero {
  position: relative;
  min-height: min(92vh, 820px);
  min-height: min(92svh, 820px);
  background: #1b1f27;
  color: #eef0f5;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  touch-action: pan-y;
}
.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 120px var(--gutter) clamp(88px, 14vh, 140px);
  pointer-events: none;
}
.hero h1 {
  font-family: var(--sans);
  font-weight: 800;
  font-stretch: 62%;
  font-size: clamp(4.6rem, 16vw, 13.5rem);
  line-height: 0.82;
  letter-spacing: -0.012em;
  color: #f2f3f7;
  margin: 0 0 0.32em -0.04em;
}
.hero h1 span {
  display: block;
}
.hero-lede {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.6vw, 1.4rem);
  line-height: 1.45;
  max-width: 31ch;
  margin: 0;
  color: rgba(238, 240, 245, 0.84);
  text-wrap: pretty;
}
.hero-hint,
.hero-readout {
  position: absolute;
  z-index: 3;
  bottom: 22px;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: rgba(238, 240, 245, 0.62);
  pointer-events: none;
}
.hero-hint {
  left: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
}
.hint-touch {
  display: none;
}
@media (hover: none) {
  .hint-fine {
    display: none;
  }
  .hint-touch {
    display: inline;
  }
}
.hero-readout {
  right: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter)));
  display: flex;
  align-items: center;
  gap: 8px;
}
.readout-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b4150;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.hero.locked .readout-dot {
  background: #b9a6ff;
  box-shadow: 0 0 10px 2px rgba(150, 120, 255, 0.7);
}

/* ---------------- sections */

.section-title {
  font-size: 1.05rem;
  font-weight: 650;
  font-stretch: 100%;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.about {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 3.2fr) minmax(220px, 1.6fr);
  gap: 24px clamp(24px, 4vw, 56px);
  padding-top: clamp(56px, 9vw, 112px);
  padding-bottom: clamp(56px, 8vw, 96px);
}
.about .section-title {
  padding-top: 0.35em;
}
.about-body p {
  margin: 0 0 1em;
  max-width: 62ch;
  text-wrap: pretty;
}
.about-body p:first-child {
  font-size: 1.28rem;
  line-height: 1.5;
}
.facts {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.4;
  border-top: 1px solid var(--rule);
}
.facts > div {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.facts dt {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.facts dd {
  margin: 0;
}

.work {
  padding-bottom: clamp(64px, 10vw, 128px);
}
.work-head,
.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding-bottom: 18px;
}
.work-head p,
.group-head p {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
}

/* ---------------- catalog: rows on the left, a sticky preview on the right */

.catalog {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1.5px solid var(--ink);
}
.row {
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.row-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title meta"
    "pitch pitch";
  gap: 4px 20px;
  padding: 18px 12px 20px 0;
  color: var(--ink);
  text-decoration: none;
  transition: padding-left 0.18s ease;
}
.row-title {
  grid-area: title;
  font-family: var(--sans);
  font-weight: 650;
  font-stretch: 87%;
  font-size: 1.42rem;
  line-height: 1.15;
}
.row-pitch {
  grid-area: pitch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
  max-width: 60ch;
}
.row-meta {
  grid-area: meta;
  display: flex;
  gap: 14px;
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 0.45em;
}
.row.is-active .row-link,
.row-link:hover {
  padding-left: 14px;
}
.row.is-active::before,
.row:hover::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 20px;
  width: 3px;
  background: var(--accent);
}
.row.is-active .row-title,
.row-link:hover .row-title {
  color: var(--accent);
}
.row-fig {
  display: none;
}

.preview {
  position: sticky;
  top: 24px;
}
.preview-fig {
  background: var(--surface);
  border: 1px solid var(--rule);
  aspect-ratio: 8 / 5;
}
.preview-fig svg {
  display: block;
  width: 100%;
  height: auto;
}
.preview-cap {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 12px 0 0;
  min-height: 3em;
}

@media (max-width: 880px) {
  .catalog {
    grid-template-columns: 1fr;
  }
  .preview {
    display: none;
  }
  .row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 0 16px;
    align-items: start;
  }
  .row-fig {
    display: block;
    margin-top: 20px;
    background: var(--surface);
    border: 1px solid var(--rule);
    aspect-ratio: 8 / 5;
    pointer-events: none;
  }
  .row-fig svg {
    display: block;
    width: 100%;
    height: auto;
  }
  .row-link {
    grid-template-areas:
      "title"
      "meta"
      "pitch";
    grid-template-columns: 1fr;
    padding-right: 0;
  }
  .row-meta {
    padding-top: 0;
  }
  .row.is-active .row-link,
  .row-link:hover {
    padding-left: 0;
  }
  .row.is-active::before,
  .row:hover::before {
    display: none;
  }
  .row.is-active .row-link:not(:hover) .row-title {
    color: var(--ink);
  }
}

/* ---------------- page heads */

.page-head {
  padding-top: clamp(40px, 7vw, 88px);
  padding-bottom: clamp(32px, 5vw, 56px);
}
.page-head h1 {
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  font-weight: 750;
  font-stretch: 70%;
  line-height: 0.95;
  letter-spacing: -0.005em;
}
.page-deck {
  font-size: 1.22rem;
  line-height: 1.5;
  max-width: 58ch;
  margin: 18px 0 0;
  color: var(--ink);
  text-wrap: pretty;
}
.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
  font-family: var(--sans);
  font-size: 0.92rem;
}
.jump a {
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule-strong);
  padding: 6px 12px;
  border-radius: 999px;
}
.jump a:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.jump span {
  color: var(--muted);
  margin-left: 4px;
}
.group {
  padding-bottom: clamp(48px, 7vw, 88px);
  scroll-margin-top: 16px;
}

/* ---------------- project page */

.proj {
  padding-top: clamp(32px, 6vw, 72px);
  padding-bottom: clamp(64px, 9vw, 112px);
}
.crumb {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0 0 18px;
}
.crumb a {
  color: var(--muted);
}
.proj h1 {
  font-size: clamp(2.8rem, 7.5vw, 5.6rem);
  font-weight: 750;
  font-stretch: 70%;
  line-height: 0.95;
}
.proj-deck {
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  line-height: 1.45;
  max-width: 46ch;
  margin: 20px 0 0;
  text-wrap: pretty;
}
.proj-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  justify-content: start;
  gap: 12px clamp(24px, 4vw, 56px);
  margin: 32px 0 0;
  padding: 16px 0;
  border-top: 1.5px solid var(--ink);
  font-family: var(--sans);
  font-size: 0.95rem;
}
.proj-facts dt {
  color: var(--muted);
  font-size: 0.82rem;
}
.proj-facts dd {
  margin: 2px 0 0;
}
.proj-fig {
  margin: 8px 0 clamp(36px, 5vw, 56px);
}
.proj-fig svg {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
}
.proj-fig figcaption {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 10px;
}

.prose {
  max-width: 68ch;
}
.prose p,
.prose ul {
  margin: 0 0 1.1em;
  text-wrap: pretty;
}
.prose h2 {
  font-size: 1.3rem;
  margin: 1.8em 0 0.5em;
}
.prose li {
  margin-bottom: 0.35em;
}
.prose code {
  font-size: 0.9em;
  background: var(--fig-soft);
  padding: 0.05em 0.3em;
  border-radius: 3px;
}

.proj-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: clamp(48px, 7vw, 80px);
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  font-family: var(--sans);
}
.proj-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  font-stretch: 87%;
  font-size: 1.25rem;
}
.proj-nav a:hover {
  color: var(--accent);
}
.proj-nav a + a {
  text-align: right;
}
.proj-nav span {
  display: block;
  font-weight: 400;
  font-stretch: 100%;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2px;
}

@media (max-width: 720px) {
  .proj-facts {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------------- cv */

.cv {
  padding-bottom: clamp(64px, 9vw, 112px);
}
.cv-sec {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(0, 4fr);
  gap: 16px clamp(24px, 4vw, 56px);
  border-top: 1.5px solid var(--ink);
  padding: 18px 0 32px;
}
.cv-item {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 4px 24px;
  padding-bottom: 22px;
}
.cv-item + .cv-item {
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}
.cv-when {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0.2em 0 0;
}
.cv-item h3 {
  font-size: 1.2rem;
  font-stretch: 87%;
}
.cv-item p {
  margin: 4px 0 0;
  max-width: 62ch;
}
.cv-where {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted);
}
.cv-note {
  font-size: 1rem;
  color: var(--muted);
}

/* ---------------- footer */

.foot {
  border-top: 1px solid var(--rule);
}
.foot-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  font-family: var(--sans);
  font-size: 0.92rem;
}
.foot p {
  margin: 0;
}
.foot-sign {
  color: var(--muted);
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: baseline;
}
.foot-links a {
  color: var(--ink);
}
.theme-toggle {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 2px 12px;
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--accent);
}

/* ---------------- responsive: about + cv collapse */

@media (max-width: 980px) {
  .about {
    grid-template-columns: 1fr;
  }
  .about .section-title {
    padding-top: 0;
  }
}
@media (max-width: 640px) {
  body {
    font-size: 1.06rem;
  }
  .cv-sec {
    grid-template-columns: 1fr;
  }
  .cv-item {
    grid-template-columns: 1fr;
  }
  .masthead nav {
    gap: 16px;
  }
  .row-meta {
    gap: 10px;
  }
  .hero-hint {
    bottom: 18px;
  }
  .hero-readout {
    bottom: 18px;
  }
}

/* ---------------- figures
   every project figure is inline svg drawn with these classes, so one pen
   draws them all and they follow the color theme. */

.fig-svg {
  font-family: var(--sans);
}
.fig-svg .ln {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fig-svg .ln2 {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fig-svg .thin {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fig-svg .grid {
  fill: none;
  stroke: var(--fig-grid);
  stroke-width: 1;
}
.fig-svg .ac {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fig-svg .acf {
  fill: var(--accent);
  stroke: none;
}
.fig-svg .acs {
  fill: var(--accent-soft);
  stroke: none;
}
.fig-svg .inkf {
  fill: var(--ink);
  stroke: none;
}
.fig-svg .mutef {
  fill: var(--muted);
  stroke: none;
}
.fig-svg .soft {
  fill: var(--fig-soft);
}
.fig-svg .paper {
  fill: var(--surface);
}
.fig-svg .dash {
  stroke-dasharray: 4 5;
}
.fig-svg .lb {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 450;
}
.fig-svg .lbi {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.fig-svg .lba {
  fill: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

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

/* social card render (local _og page only) */
.og .masthead,
.og .hero-hint,
.og .hero-readout,
.og .foot {
  display: none;
}
.og .hero {
  min-height: 100vh;
}
.og .hero h1 {
  font-size: 168px;
}
.og .hero-inner {
  padding-top: 40px;
  padding-bottom: 64px;
}

