/* ==========================================================================
   Alex Nogle — portfolio
   ========================================================================== */

/* ABC Areal (free): one variable file per family. Axes: wght 400–700,
   slnt 0 to -12 (italics), DRKM 0–1 ("Darkmode", tuned for light text on dark). */
@font-face {
  font-family: "ABC Areal";
  src: url("fonts/ABCAreal-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: oblique 0deg 12deg;
  font-variation-settings: "DRKM" 1;
  font-display: swap;
}
@font-face {
  font-family: "ABC Areal Semi Mono";
  src: url("fonts/ABCArealSemiMono-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: oblique 0deg 12deg;
  font-variation-settings: "DRKM" 1;
  font-display: swap;
}

:root {
  --bg: #191919;
  --bg-soft: #232323;
  --text: #dddddd;      /* name, bio, links, archive label, case study button */
  --muted: #a3a3a3;     /* project titles, descriptions, section labels, rules */
  --line: #303030;      /* divider between the two panes */
  --stroke: #808080;    /* case study button outline */

  --sans: "ABC Areal", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "ABC Areal Semi Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --fs-ui: 17px;        /* name, bio, links, email, archive heading */
  --fs: 14px;           /* everything else, sans or mono */
  --fs-text: 13px;      /* project text tiles */
  --fs-about: 12px;     /* education / work entries */
  --fs-sm: 10px;        /* shelf tabs and year tags */
  --text-tile-bg: #292929;

  --lh: 1.5;
  --pad: 10px;
  --tile-gap: 4px;
  --project-gap: 96px;
  --block-min-h: 460px; /* blocks never get shorter than this, so text tiles can't crush images */
  --intro-width: max(300px, 28vw); /* vw ignores the scrollbar, so the pane never shifts when it comes or goes */
  --intro-h: 0px;       /* mobile: measured height of the pinned intro (set by site.js) */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; background: var(--bg); }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs) / var(--lh) var(--sans);
  font-variation-settings: "DRKM" 1;   /* dark-mode axis on for the whole site */
  font-synthesis: none;                /* never fake a slant or weight */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
picture { display: contents; }
/* <source> paints nothing, but display:contents on the picture would otherwise
   promote it to a grid/flex item of the picture's parent — in .about that gave
   the 125px column to a phantom item and pushed the photo into the text column.
   Hiding it is layout-only; picture still picks its source from the markup. */
picture > source { display: none; }
h1, h2, h3 { font-weight: 400; font-size: inherit; }
em, .entry .dates { font-style: italic; font-variation-settings: "DRKM" 1, "slnt" -12; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* --------------------------------------------------------------------------
   Layout: the intro is pinned and scrolls on its own (scrollbar hidden);
   the work column scrolls with the page.
   -------------------------------------------------------------------------- */

.intro {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--intro-width);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-right: 1px solid var(--line);
  padding: var(--pad);
  background: var(--bg);
  z-index: 10; /* work column slides underneath on mobile */
}
.intro::-webkit-scrollbar { display: none; }
.intro { display: flex; flex-direction: column; }
.intro > * { flex: none; }

/* Copyright / availability / credits, pinned to the bottom of the pane */
.intro-foot {
  margin-top: auto;
  padding-top: 48px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--stroke);
}
.intro-foot--mobile { display: none; }
.intro-foot a { text-decoration: underline; text-underline-offset: 2px; }

.work {
  margin-left: var(--intro-width);
  padding: 0 var(--pad) var(--pad);
}

/* --------------------------------------------------------------------------
   Intro (left)
   -------------------------------------------------------------------------- */

.name {
  font-size: var(--fs-ui);
  margin-bottom: 26px;
}

.tagline {
  font-size: var(--fs-ui);
  line-height: 1.45;
  margin-bottom: 36px;
}

/* Expandable link sections built on <details>: only the arrow changes */
.links details { margin-bottom: 8px; }

.links summary {
  display: inline-block;
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-ui);
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.links summary::-webkit-details-marker { display: none; }
.links summary::after { content: "\00a0\2193"; }                  /* ↓ */
.links details[open] > summary::after { content: "\00a0\2191"; }  /* ↑ */
.links summary:focus-visible { outline: 1px solid var(--text); outline-offset: 4px; }

.panel { padding: 16px 0 28px; }

/* About: photo + education/work ------------------------------------------ */

.about {
  display: grid;
  grid-template-columns: 125px 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 48px;
  font-size: var(--fs-about);
  line-height: 1.4;
}
.photo {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg-soft);
}

/* Mono section labels, e.g. "EDUCATION" */
.label {
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-bottom: 1em;
}
.about-section { margin-bottom: 1.4em; }
.about-section:last-child { margin-bottom: 0; }
.entry .dates { display: block; }

/* Shelves: tabs + horizontal scroll ------------------------------------- */

.tabs {
  display: flex;
  gap: 36px;
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 18px;
}
.tabs input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.tabs label {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 0 10px;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.tabs input:checked + label { color: var(--text); }
.tabs input:checked + label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 8px;
}
.tabs input:checked + label::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--text);
}
.tabs input:focus-visible + label { outline: 1px solid var(--text); outline-offset: 2px; }

.shelf-panel { display: none; }
.shelves:has(#tab-books:checked) .shelf-panel[data-for="books"],
.shelves:has(#tab-objects:checked) .shelf-panel[data-for="objects"],
.shelves:has(#tab-experiments:checked) .shelf-panel[data-for="experiments"] { display: block; }

.shelf {
  --rows: 3;
  --item-w: 76px;
  --item-ratio: 2 / 3;
  --gap: 12px;
  --fade: 56px;
  position: relative;
}
.shelf--objects { --item-w: 98px; --item-ratio: 1; }
.shelf--experiments { --item-w: 120px; --item-ratio: 4 / 3; }

.shelf-track {
  display: flex;
  gap: 32px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.shelf-track::-webkit-scrollbar { display: none; }

.shelf-label {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1;
  margin-bottom: 12px;
}
.shelf-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(var(--rows), auto);
  gap: var(--gap);
}
.shelf-item {
  width: var(--item-w);
  aspect-ratio: var(--item-ratio);
  overflow: hidden;
  background: var(--bg-soft);
}
/* Books and Experiments are full-bleed images; Objects are transparent cutouts
   that sit directly on the shelf, so their tile has no background at all. */
.shelf--objects .shelf-item { background: transparent; }
.shelf-item a { display: block; height: 100%; }
.shelf-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Arrow buttons, top right, aligned with the year tags (shown when scrollable) */
.shelf-nav {
  position: absolute;
  top: -2px;
  right: 0;
  z-index: 2;
  display: flex;
  gap: 10px;
  font-family: var(--mono);
  font-size: var(--fs);
  line-height: 1;
  color: var(--muted);
}
.shelf-btn { padding: 0 2px; }
.shelf-btn:hover { color: var(--text); }
.shelf-btn:disabled { opacity: 0.3; cursor: default; }
.shelf-btn:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }

/* Gradient bands hinting that the shelf scrolls */
.shelf::before,
.shelf::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--fade);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 1;
}
.shelf::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.shelf::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.shelf.fade-left::before,
.shelf.fade-right::after { opacity: 1; }

/* Contact ---------------------------------------------------------------- */

.email { font-size: var(--fs-ui); text-decoration: none; }
.email:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   Work (right) — project blocks
   -------------------------------------------------------------------------- */

.work {
  font-family: var(--mono);
  color: var(--muted);
}

/* "Archive 2020 → 2026": pinned at the top of the column, level with the name */
.work-head {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: var(--pad) 0 14px;
  margin-bottom: 4px;
  background: var(--bg);
  font-family: var(--sans);
  font-size: var(--fs-ui);
  color: var(--text);
}

/* Optional archive studies. The ordinary grid is the no-JS/WebGL fallback. */
.work-head { display: flex; align-items: center; justify-content: space-between; }
.effect-toggle { width: 32px; height: 28px; display: grid; place-items: center; }
.effect-toggle[hidden] { display: none; }
.effect-toggle img { grid-area: 1 / 1; transition: opacity .25s; }
.effect-toggle .icon-grid, .effect-toggle[aria-pressed="true"] .icon-horizontal { opacity: 0; }
.effect-toggle[aria-pressed="true"] .icon-grid { opacity: 1; }
.effect-toggle:hover img { filter: brightness(1.8); }
.effect-status:empty { display: none; }
.effect-status { position: fixed; bottom: 16px; left: 16px; z-index: 20; max-width: calc(100vw - 32px); padding: 8px 12px; background: var(--bg); color: var(--text); }
.effect-toggle:focus-visible { outline: 1px solid var(--text); outline-offset: 4px; }
.archive-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.tile.effect-ready { background: transparent; overflow: visible; }
.tile.effect-ready img { opacity: 0; }
.tile--text { z-index: 3; }
@media (max-width: 900px) {
  html.js .work-head { position: sticky; top: var(--intro-h); padding: 12px 0; margin-bottom: 14px; }
}

/* Every block is the same height: one site-wide aspect ratio (site.json) */
.project { margin-bottom: var(--project-gap); }

/* Tile block: nested flexboxes driven by the layout tree */
.tiles {
  display: flex;
  width: 100%;
  aspect-ratio: var(--grid-aspect, 2.15 / 1);
  min-height: var(--block-min-h);
}
.tiles > * { flex: 1 1 0%; }
.tile-group {
  display: flex;
  gap: var(--tile-gap);
  min-width: 0;
  min-height: 0;
}
.tile-group--v { flex-direction: row; }
.tile-group--h { flex-direction: column; }
.tile {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  background: var(--bg-soft);
}
.tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Text tile: hugs its content, stretches to its column */
.tile--text {
  flex: none;
  padding: 10px 10px 14px;
  font-size: var(--fs-text);
  line-height: 1.45;
  color: var(--muted);
  background: var(--text-tile-bg);
}
.project-head { margin-bottom: 1.45em; }
.project-title { display: inline; }
.project-year::before { content: ", "; }
.project-desc a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 5px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--text);
  line-height: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.pill:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.pill:focus-visible { outline: 1px solid var(--text); outline-offset: 4px; }
/* Focus handed back silently after a modal closes: still focused, no ring */
.pill[data-silent-focus]:focus-visible { outline: none; }
.pill::after {
  content: "\2197";   /* ↗ */
  display: inline-block;
  line-height: 1;
  transform: translateY(0);     /* optical centering against the x-height (Areal) */
}

/* Case study button sits inside the text tile */
.pill--text { margin-top: 1.45em; }

/* --------------------------------------------------------------------------
   Mobile: intro pinned at the top, work scrolls beneath it
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  /* Without JS the intro simply sits above the work in normal flow */
  .intro {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
  }
  html.js .intro {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    max-height: 70dvh;
  }
  .work { margin-left: 0; }
  html.js .work { padding-top: var(--intro-h); }

  .work-head {
    position: static;
    padding: 18px 0 28px;
    margin: 0;
  }

  .name { margin-bottom: 28px; }
  .tagline { margin-bottom: 30px; }
  .intro-foot--desktop { display: none; }
  .intro-foot--mobile { display: block; padding: 0 0 24px; margin-top: 0; }
  html.ribbon-view .intro-foot--mobile { display: none; }
  .links details { margin-bottom: 6px; }
  .panel { padding-bottom: 20px; }

  .about { grid-template-columns: 125px 1fr; }

  .tabs { gap: 28px; }
  .shelf { --rows: 2; --item-w: 100px; --fade: 40px; }
  .shelf--objects { --item-w: 120px; }
  .shelf--experiments { --item-w: 150px; }
  .shelf-nav { display: none; }

  /* Phones: flatten the tree to hero image (square) + text tile */
  .tiles { aspect-ratio: auto; flex-direction: column; gap: var(--tile-gap); }
  .tile-group { display: contents; }
  html:not(.ribbon-view) .tile { flex: none !important; }
  .tile:not(.tile--hero):not(.tile--text) { display: none; }
  .tile--hero { aspect-ratio: 4 / 3; }   /* tablets */
  .tiles { min-height: 0; }
  .project { margin-bottom: 48px; }
}

@media (max-width: 600px) {
  .tile--hero { aspect-ratio: 1; }       /* phones */
}

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

/* The experimental archive is one horizontal surface; the static layout stays
   the default. Whole project grids are captured at this exact layout. */
.ribbon-view, .ribbon-view body { overflow: hidden; }
.ribbon-view .work {
  position: fixed; left: var(--intro-width); right: 0; top: 0; bottom: 0;
  margin: 0; padding: 0 10px;
}
.ribbon-view .work-head { position: relative; z-index: 5; }
/* Hide the track instantly while the layout switches and textures capture;
   the transition is only present once loading ends, so the fade runs one way. */
.ribbon-loading .archive-track, .ribbon-loading .ribbon-navigation { opacity: 0; }
.ribbon-view:not(.ribbon-loading) .archive-track,
.ribbon-view:not(.ribbon-loading) .ribbon-navigation { transition: opacity 0.35s ease; }
.ribbon-view .archive-track {
  position: absolute; left: 0; right: 0; top: 54px; bottom: 60px;
  display: flex; align-items: center; gap: 56px; padding: 0 48px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
  overscroll-behavior: contain; touch-action: pan-x; cursor: grab;
}
.ribbon-view .archive-track img { -webkit-user-drag: none; user-select: none; }
.ribbon-view .archive-track::-webkit-scrollbar { display: none; }
.ribbon-view .archive-track:active { cursor: grabbing; }
.ribbon-view .project { flex: 0 0 var(--ribbon-width, 850px); width: var(--ribbon-width, 850px); margin: 0; user-select: none; }
.ribbon-view .tiles { height: var(--ribbon-height, 420px); min-height: 0; aspect-ratio: auto; }
.ribbon-view .ribbon-ready .project { pointer-events: none; user-select: none; }
.ribbon-view .archive-canvas { z-index: 2; }
.ribbon-view .ribbon-navigation {
  display: flex; align-items: center; justify-content: flex-end;
  position: absolute; left: 22px; right: 22px; bottom: 18px; z-index: 5;
  color: var(--muted); font: 12px/1.5 var(--mono);
}
.ribbon-navigation[hidden] { display: none; }
.ribbon-navigation > div { display: flex; align-items: center; gap: 18px; }
.ribbon-navigation button { width: 30px; height: 30px; font-size: 18px; }
.ribbon-navigation button:disabled { opacity: .25; cursor: default; }
.ribbon-navigation progress { position: absolute; left: 0; bottom: -8px; width: 100%; height: 1px; border: 0; appearance: none; }
.ribbon-navigation progress::-webkit-progress-bar { background: #333; }
.ribbon-navigation progress::-webkit-progress-value { background: #aaa; }
.ribbon-navigation progress::-moz-progress-bar { background: #aaa; }
@media (max-width: 900px) {
  html.ribbon-view .work { left: 0; top: var(--intro-h); padding-top: 0; }
  html.ribbon-view .work-head { position: relative; top: 0; margin-bottom: 0; }
  .ribbon-view .archive-track { gap: 32px; padding: 0 24px; }
  .ribbon-view .tiles { flex-direction: row; gap: 0; }
  .ribbon-view .tile-group { display: flex; }
  .ribbon-view .tile:not(.tile--hero):not(.tile--text) { display: block; }
  .ribbon-view .tile--hero { aspect-ratio: auto; }
  .ribbon-view .tile--text { font-size: 12px; }
}

/* --------------------------------------------------------------------------
   Case study modal

   A centred panel over the blurred page. Same 10px margins as the site, one
   mono size throughout. Content is cloned in from an inert <template> when the
   Case Study pill is clicked.
   -------------------------------------------------------------------------- */

.case {
  --case-pad: var(--pad);
  position: fixed;
  inset: 0;
  margin: auto;                       /* centred in the viewport */
  width: min(1240px, calc(100vw - 48px));
  max-width: none;
  height: fit-content;
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font: var(--fs-text) / 1.45 var(--mono);
  overflow: hidden;                   /* .case-content is the scroller */
}
.case::backdrop {
  background: rgb(25 25 25 / .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.case-content {
  max-height: calc(100dvh - 50px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: var(--case-pad);
}
.case-content::-webkit-scrollbar { display: none; }
.case-content:focus { outline: none; }

/* Header row: title left, close right */
.case-close {
  position: absolute;
  top: var(--case-pad);
  right: var(--case-pad);
  z-index: 2;
  width: 22px;
  height: 22px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1 var(--sans);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.case-close:hover { background: var(--text); border-color: var(--text); color: var(--bg); }
.case-close:focus-visible { outline: 1px solid var(--text); outline-offset: 3px; }

.case-title {
  padding-right: 40px;
  font: inherit;
  color: var(--text);
}
.case-sub { color: var(--muted); }

/* Meta on the left, copy on the right, sharing one row */
.case-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.45em 40px;
  margin-top: 1.45em;
  padding-bottom: 1.45em;
}
.case-meta { display: grid; gap: 0; align-content: start; }
.case-row dt { display: inline; color: var(--muted); }
.case-row dt::after { content: ": "; }
.case-row dd { display: inline; color: var(--muted); }
.case-link { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.case-link::after { content: " \2197"; }

.case-body { font-family: var(--sans); color: var(--muted); }
.case-body p + p { margin-top: 1.45em; }
.case-body a { text-decoration: underline; text-underline-offset: 2px; }

/* The work: two columns, captions beneath, same 4px gap as the tiles */
.case-media {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.45em var(--tile-gap);
}
.case-figure { margin: 0; min-width: 0; }
/* Figures share one proportion so rows line up; media is cover-fit like the tiles */
.case-figure img,
.case-figure video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--bg-soft);
}
.case-figure figcaption { margin-top: 0.5em; color: var(--muted); }
.case-figure--wide { grid-column: 1 / -1; }
.case-figure--wide img,
.case-figure--wide video { aspect-ratio: 2 / 1; }

@media (max-width: 900px) {
  .case { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .case-content { max-height: calc(100dvh - 22px); }
  .case-head { grid-template-columns: 1fr; gap: 1.45em; }
  .case-media { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .case-close { transition: none; }
}
