/* billjalouk.com Projects page. Plain CSS, no build step. Tokens and background are the homepage's (home.css).
   Decided by Bill on 2026-11-11 and 2026-11-12: a stage. A small title with the intro on the same line, a shelf
   of five wire objects right under it, and the picked project as one large frame that plays at once, the text
   beside it. All in one window on a desktop. On a phone: shelf, frame, text below.
   Only transform and opacity move. Without JavaScript the page is a plain list of the five projects. */

@font-face { font-family: "Fraunces"; src: url(/assets/fonts/fraunces-latin.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #0b0a12;
  --bg-2: #15132a;
  --ink: #f1eef9;
  --muted: rgba(241, 238, 249, 0.56);
  --faint: rgba(241, 238, 249, 0.5);   /* text: 4.8:1 on --bg, the minimum is 4.5:1 */
  --line: rgba(241, 238, 249, 0.1);
  --accent: #ff5c8a;
  --font: "Fraunces";
  --w-thin: 300;
  --w-black: 900;
  --track-tight: -0.02em;
  --pad: clamp(18px, 4vw, 56px);
  --radius: 5px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0; min-height: 100svh; color: var(--ink); background: var(--bg);
  font-family: var(--font), serif; font-weight: var(--w-thin); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  /* a phone held sideways: the content stays clear of the notch (viewport-fit=cover lets the page reach under it) */
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }   /* read by screen readers, not shown */

.bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg::before {
  content: ""; position: absolute; inset: -10%;
  background:
    radial-gradient(55% 45% at 22% 28%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(45% 55% at 84% 78%, color-mix(in oklab, var(--accent) 9%, transparent), transparent 70%),
    radial-gradient(120% 90% at 50% 110%, rgba(0, 0, 0, 0.55), transparent 60%),
    linear-gradient(170deg, var(--bg-2), var(--bg) 70%);
}
.bg::after {
  content: ""; position: absolute; inset: 0; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* the home link scrolls away with the page: nothing is pinned under it */
.home {
  position: absolute; top: 8px; left: calc(var(--pad) - 10px + env(safe-area-inset-left, 0px)); z-index: 30;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  font-weight: var(--w-black); font-size: 15px; letter-spacing: var(--track-tight);
  color: var(--muted); transition: color 0.2s;
}
.home:hover, .home:focus-visible { color: var(--ink); }

/* ---------- page head: a small title, the intro on the same line ---------- */
.projects { max-width: 1760px; margin: 0 auto; padding: 0 var(--pad); }
.head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 22px; padding: 62px 0 14px; }
.title { margin: 0; font-weight: var(--w-black); font-size: clamp(32px, 3.4vw, 50px); line-height: 0.95; letter-spacing: var(--track-tight); }
.intro { margin: 0; max-width: 52ch; color: var(--muted); font-size: 16px; line-height: 1.55; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin: clamp(56px, 10vh, 120px) 0 56px; color: var(--accent); border-bottom: 1px solid currentColor; }
.back:hover { color: var(--ink); }

/* ---------- the shelf: five small wire objects, picking one puts its project on stage.
   projects.css is laid out for exactly five. Change the column count with the number of projects. ---------- */
.shelf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0 8px; margin: 0 0 clamp(18px, 3.2vh, 30px); border-bottom: 1px solid rgba(241, 238, 249, 0.22); }
.shelf-item {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 2px; min-height: 48px; padding: 4px 2px 14px;
  text-align: center; font-size: 13.5px; line-height: 1.25; color: var(--muted); cursor: pointer; transition: color 0.3s;
}
.shelf-obj { display: block; width: min(100%, 92px); aspect-ratio: 1; }
/* the line under the object of the project on stage. During the tour it fills while the loop runs. */
.shelf-item::after {
  content: ""; position: absolute; left: 14%; right: 14%; bottom: -1px; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.4s var(--ease-out);
}
.shelf-item[aria-current]::after { transform: scaleX(var(--prog, 1)); transition: none; }
.shelf-item[aria-current], .shelf-item:hover { color: var(--ink); }
.n-short { display: none; }

/* ---------- the projects. Without scripts: one project per row, the frame beside the text ---------- */
.plist { display: grid; gap: clamp(72px, 14vh, 150px); }
.project { display: grid; gap: 20px; scroll-margin-top: 84px; }
@media (min-width: 900px) {
  .project { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); column-gap: clamp(32px, 5vw, 88px); align-items: center; }
}
/* Where scripts run, the list is drawn from the start in the columns of the stage below, so the first project stays
   where it is when projects.js sets .has-stage. Before, its text moved up and to the side once the stage started: a
   layout shift of 0.15 at 1920 px (2026-12-01). Without scripts the list keeps its own columns. */
@media (min-width: 900px) and (scripting: enabled) {
  .project { grid-template-columns: minmax(0, min(60%, max(420px, calc((100svh - 330px) * 1.6)))) minmax(0, 1fr); column-gap: clamp(28px, 4vw, 72px); align-items: start; }
  .p-text { padding-top: 4px; }
}

/* ---------- the stage (projects.js sets .has-stage): the five projects lie on top of each other, one shows ---------- */
.has-stage .plist { display: grid; gap: 0; touch-action: pan-y pinch-zoom; }   /* the sideways swipe is the stage's, the two-finger zoom stays the reader's */
.has-stage .project { grid-area: 1 / 1; align-self: start; align-content: start; align-items: start; visibility: hidden; opacity: 0; transition: opacity 0.16s linear, visibility 0s linear 0.16s; }
.has-stage .project.sel { visibility: visible; opacity: 1; transition: opacity 0.4s var(--ease-out) 0.14s, visibility 0s; }
/* On arrival the stage takes over from the list without a fade (projects.js sets .stage-in for the first frame the
   stage draws). The list has just shown all five projects. With the fade, the other four lay on top of the first
   for a moment. */
.has-stage.stage-in .project, .has-stage.stage-in .project.sel { transition: none; }
@media (min-width: 900px) {
  /* the frame is as large as the window allows: 60 percent of the width, and never taller than what is left under the shelf */
  .has-stage .project { grid-template-columns: minmax(0, min(60%, max(420px, calc((100svh - 330px) * 1.6)))) minmax(0, 1fr); column-gap: clamp(28px, 4vw, 72px); }
  .has-stage .p-text { padding-top: 4px; }
}

/* ---------- one project: the text ---------- */
.p-title { margin: 0; font-weight: var(--w-black); font-size: clamp(26px, 2.5vw, 38px); line-height: 1.05; letter-spacing: var(--track-tight); text-wrap: balance; }
.p-where { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.p-what { margin: 16px 0 0; max-width: 56ch; font-size: clamp(16px, 1.2vw, 18px); line-height: 1.55; color: color-mix(in oklab, var(--ink) 90%, transparent); }
.p-facts { margin: 18px 0 0; display: grid; gap: 12px; max-width: 60ch; }
.p-fact { display: grid; grid-template-columns: 62px minmax(0, 1fr); column-gap: 14px; align-items: baseline; }
.p-fact dt { font-size: 13px; color: var(--muted); }
.p-fact dd { margin: 0; font-size: 15.5px; line-height: 1.5; color: color-mix(in oklab, var(--ink) 88%, transparent); }
.p-result dd { padding-left: 12px; border-left: 2px solid var(--accent); }
.p-tools { margin: 18px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.p-tools li { padding: 3px 10px; border: 1px solid rgba(241, 238, 249, 0.16); border-radius: 999px; font-size: 12.5px; line-height: 1.5; color: color-mix(in oklab, var(--ink) 74%, transparent); }
/* the link to the project's public code, where there is one. It leaves the site, so it carries a small arrow. */
.p-code { margin: 14px 0 0; }
.p-code a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--accent); font-size: 14px;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px;
}
.p-code a:hover { color: var(--ink); }
.p-code-out { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .p-code-out { transform: scaleX(-1); }

/* ---------- one preview: a frame with a canvas. Asleep it is a dim still, awake it plays. ---------- */
.peek { position: relative; margin: 0; }
.peek-open {
  position: relative; display: block; width: 100%; padding: 0; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(241, 238, 249, 0.035), rgba(241, 238, 249, 0.012));
  transition: border-color 0.4s var(--ease-out);
}
.peek-open::before {
  content: ""; position: absolute; left: -1px; top: 20px; width: 2px; height: 28px; background: var(--accent);
  opacity: 0; transition: opacity 0.4s var(--ease-out);
}
.peek-canvas { display: block; width: 100%; aspect-ratio: 16 / 10; opacity: 0.38; transition: opacity 0.5s var(--ease-out); }
.peek.awake .peek-canvas { opacity: 1; }
.peek.awake .peek-open { border-color: color-mix(in oklab, var(--accent) 34%, var(--line)); }
.peek.awake .peek-open::before { opacity: 1; }
.peek-grow {
  position: absolute; right: 0; bottom: 0; width: 44px; height: 44px; padding: 15px; fill: none; stroke: var(--ink); stroke-width: 1.3;
  stroke-linecap: round; stroke-linejoin: round; opacity: 0.32; transition: opacity 0.2s;
}
.peek-open:hover .peek-grow, .peek-open:focus-visible .peek-grow { opacity: 0.95; }
.peek-note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
/* without scripts there is nothing to play: the frames and the small objects step aside, the text is complete */
@media (scripting: none) { .peek, .shelf .shelf-obj { display: none; } }

/* ---------- open larger ---------- */
.peek-dialog {
  display: none; place-items: center; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; color: var(--ink); overflow: hidden;
}
.peek-dialog[open] { display: grid; }
.peek-dialog::backdrop { background: rgba(11, 10, 18, 0.97); }
.pd-box { width: min(92vw, calc((100dvh - 110px) * 1.6), 1240px); }
.pd-fig .peek-canvas { opacity: 1; border: 1px solid color-mix(in oklab, var(--accent) 34%, var(--line)); border-radius: var(--radius); background: var(--bg); }
.pd-bar { display: flex; align-items: center; gap: 4px 16px; margin-top: 10px; }
.pd-title { margin: 0; font-weight: var(--w-black); font-size: 18px; letter-spacing: var(--track-tight); white-space: nowrap; }
.pd-note { flex: 1; margin: 0; font-size: 13px; color: var(--muted); }
.pd-close { min-width: 44px; min-height: 44px; padding: 0 18px; border: 1px solid rgba(241, 238, 249, 0.2); border-radius: 999px; background: transparent; cursor: pointer; }
.pd-close:hover { border-color: var(--accent); }
@media (max-width: 719px) and (orientation: portrait) {   /* a phone held upright: the large view lies on its side */
  .pd-box { position: absolute; left: 50%; top: 50%; width: min(calc(100dvh - 32px), calc((100vw - 84px) * 1.6)); transform: translate(-50%, -50%) rotate(90deg); }
  .pd-note { font-size: 12px; }
}

/* ---------- pause: two small bars in the bottom corner (Bill, 2026-11-20, from three live variants). They stop the
   previews, and the pause holds from page to page (projects.js). They stay away under reduced motion, where nothing
   moves. ---------- */
.pause {
  position: fixed; left: calc(6px + env(safe-area-inset-left, 0px)); bottom: calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: 44px; height: 44px; padding: 16px; border: 0; background: transparent; cursor: pointer;
  color: rgba(241, 238, 249, 0.4);              /* about 3.4:1 on --bg, a control needs 3:1 */
  transition: color 0.2s;
}
.pause:hover, .pause:focus-visible { color: var(--ink); }
.pause svg { display: block; width: 100%; height: 100%; overflow: visible; fill: currentColor; }
.pause-play, html.paused .pause-bars { display: none; }
html.paused .pause-play { display: inline; }
@media (prefers-reduced-motion: reduce) { .pause { display: none; } }

@media (max-width: 719px) {       /* a phone: five objects in one row, with short names under them */
  .head { padding: 58px 0 12px; row-gap: 6px; }
  .shelf { gap: 0 2px; margin-bottom: 18px; }
  .shelf-item { padding: 0 0 9px; gap: 0; }
  .shelf-obj { width: min(100%, 58px); }
  .shelf-name { font-size: 11.5px; line-height: 1.2; }
  .n-full { display: none; }
  .n-short { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  .peek-canvas, .peek-open, .peek-open::before, .shelf-item::after { transition: none !important; }
  .peek-canvas { opacity: 1; }
  .has-stage .project, .has-stage .project.sel { transition: none; }
}
