/* ElijahOS Lab. Day (paper and cobalt) and Night (ink and signal orange)
   share one layout: tokens switch on [data-theme], or on the system setting
   until the theme script runs. Type follows the portfolio: Instrument Serif
   for display, Geist for reading, JetBrains Mono for system details. */

:root {
  color-scheme: light;
  --bg: #f1f2f4; --fg: #0b0c0e; --fg-2: rgba(11,12,14,.74); --fg-3: rgba(11,12,14,.62);
  --line: rgba(11,12,14,.14); --rule: #0b0c0e; --plate: #e1e3e7; --plate-edge: rgba(11,12,14,.08);
  --mark: rgba(11,12,14,.38); --sig: #2b44ff;
  --serif: 'Instrument Serif', Georgia, serif; --sans: 'Geist', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.22,1,.36,1); --tm-len: 16px; --tm-gap: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0e0d; --fg: #f1efe9; --fg-2: rgba(241,239,233,.70); --fg-3: rgba(241,239,233,.52);
    --line: rgba(241,239,233,.12); --rule: #f1efe9; --plate: #1a1a18; --plate-edge: rgba(241,239,233,.06);
    --mark: rgba(241,239,233,.36); --sig: #ff5a1f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e0d; --fg: #f1efe9; --fg-2: rgba(241,239,233,.70); --fg-3: rgba(241,239,233,.52);
  --line: rgba(241,239,233,.12); --rule: #f1efe9; --plate: #1a1a18; --plate-edge: rgba(241,239,233,.06);
  --mark: rgba(241,239,233,.36); --sig: #ff5a1f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sig); outline-offset: 4px; }
.page { max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 4.5vw, 64px); }
.sig { color: var(--sig); }

/* Mono voice: labels, dates, counts. */
.eyebrow, .index-bar, .latest, .kind, footer { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.wordmark-path, .back-link, .theme-switch, .intro-meta, .entry-meta, .entry-num time, .cta { font-family: var(--mono); font-size: 12px; }

.masthead { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: baseline; gap: 14px; padding: 8px 0; }
.wordmark-name { font-family: var(--serif); font-style: italic; font-size: 22px; letter-spacing: -.01em; }
.wordmark-path { color: var(--fg-3); }
.masthead-actions { display: flex; align-items: center; gap: clamp(12px, 3vw, 32px); }
.back-link { color: var(--fg-2); padding: 14px 0; transition: color .2s; }
.back-link:hover { color: var(--fg); }
.theme-switch { display: flex; align-items: center; color: var(--fg-3); }
.theme-switch[hidden] { display: none; }
.theme-switch button { min-height: 44px; padding: 0 6px; border: 0; background: none; cursor: pointer; color: var(--fg-3); text-decoration: underline 1px transparent; text-underline-offset: 6px; transition: color .2s, text-decoration-color .2s; }
.theme-switch button:hover { color: var(--fg-2); }
.theme-switch button[aria-pressed="true"] { color: var(--fg); text-decoration-color: var(--sig); cursor: default; }

.intro { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 40px 72px; padding: clamp(72px, 10vw, 144px) 0 clamp(56px, 7vw, 104px); }
.intro-title { flex: 999 1 520px; min-width: 0; }
.eyebrow { margin: 0 0 28px; font-size: 11px; letter-spacing: .16em; }
h1 { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(72px, 12vw, 176px); line-height: .84; letter-spacing: -.03em; }
.intro-aside { flex: 1 1 280px; max-width: 340px; display: flex; flex-direction: column; gap: 20px; padding-bottom: 12px; }
.intro-note { margin: 0; font-size: 17px; line-height: 1.55; color: var(--fg-2); text-wrap: pretty; }
.intro-meta { margin: 0; color: var(--fg-3); font-variant-numeric: tabular-nums; }

.index-bar { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; border-top: 2px solid var(--rule); }
.index-bar span:first-child { color: var(--fg); }
.index-bar--minor { border-top: 1px solid var(--line); }

/* Entries: one link per experiment, stretched over the whole record. */
.entry { position: relative; }
.stretch::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.entry-title .stretch { display: inline-block; }
.stretch:focus-visible { outline-offset: 6px; }
.entry:has(.stretch:focus-visible) :is(.tm, .num, .cta) { color: var(--sig); }
.entry-num { display: flex; flex-direction: column; gap: 12px; }
.num { font-family: var(--serif); font-size: 72px; line-height: .8; letter-spacing: -.02em; font-variant-numeric: tabular-nums; transition: color .4s ease; }
.latest { color: var(--sig); }
.entry-title { margin: 0; font-family: var(--serif); font-style: italic; font-weight: 400; line-height: 1.04; letter-spacing: -.015em; text-wrap: balance; }
.description { margin: 0; font-size: 15px; line-height: 1.65; color: var(--fg-2); max-width: 48ch; text-wrap: pretty; }
.note { margin: 0; font-size: 11.5px; line-height: 1.6; color: var(--fg-3); max-width: 56ch; }
.cta { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; color: var(--fg); transition: color .4s ease; }
.arr { display: inline-block; transition: transform .4s var(--ease); }

/* Plates: the preview framed by printer's trim marks, like a test print. */
.plate { position: relative; }
.plate-img { position: relative; overflow: hidden; aspect-ratio: 16 / 10; background: var(--plate); }
.plate-img::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px var(--plate-edge); pointer-events: none; }
/* Cover for the scroll "print" reveal. It sits over the image rather than
   clipping it, because a clipped lazy image never starts loading early. */
.plate-img::before { content: ""; position: absolute; inset: 0; z-index: 1; background: var(--plate); transform: scaleY(0); transform-origin: bottom; pointer-events: none; }
.plate-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.placeholder { display: grid; place-items: center; height: 100%; font-size: clamp(64px, 10vw, 120px); color: var(--sig); }
.marks { position: absolute; inset: 0; pointer-events: none; }
.tm { position: absolute; color: var(--mark); transition: color .4s ease; }
.tm::before, .tm::after { content: ""; position: absolute; background: currentColor; transition: transform .7s var(--ease); }
.tm::before { width: var(--tm-len); height: 1px; }
.tm::after { width: 1px; height: var(--tm-len); }
.tl { top: 0; left: 0; } .tl::before { top: 0; right: var(--tm-gap); } .tl::after { bottom: var(--tm-gap); left: 0; }
.tr { top: 0; right: 0; } .tr::before { top: 0; left: var(--tm-gap); } .tr::after { bottom: var(--tm-gap); left: 0; }
.bl { bottom: 0; left: 0; } .bl::before { top: 0; right: var(--tm-gap); } .bl::after { top: var(--tm-gap); left: 0; }
.br { bottom: 0; right: 0; } .br::before { top: 0; left: var(--tm-gap); } .br::after { top: var(--tm-gap); left: 0; }

/* The newest experiment: a full-width plate with its record beneath. */
.entry--lead { padding: 56px 0 clamp(80px, 10vw, 136px); }
.entry--lead .plate-img { aspect-ratio: 16 / 9; }
.lead-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 28px 56px; padding-top: 52px; }
.lead-body .entry-num { flex: 0 0 132px; }
.entry--lead .num { font-size: 88px; color: var(--sig); }
.lead-body .entry-title { flex: 1 1 320px; min-width: 0; font-size: clamp(34px, 3.3vw, 46px); line-height: 1.02; }
.entry-text { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.entry-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.entry-text .cta { margin-top: 4px; }

/* Earlier experiments: notebook rows of number and date, plate, record. */
.entry--row { display: flex; flex-wrap: wrap; gap: 36px 64px; padding: 72px 0 88px; border-bottom: 1px solid var(--line); }
.entry--row .entry-num { flex: 0 0 132px; gap: 18px; }
.entry--row time { color: var(--fg-3); font-variant-numeric: tabular-nums; }
.entry--row .plate { flex: 1 1 440px; min-width: 0; align-self: flex-start; }
.entry-body { flex: 1.2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.kind { margin: 0; }
.entry--row .entry-title { font-size: clamp(28px, 2.6vw, 36px); }
.entry-body .cta { margin-top: 10px; }
.empty { margin: 0; padding: 64px 0; font-size: 18px; color: var(--fg-2); }

/* Hovering a record registers it, quietly: marks close on the corners, the
   number and call to action take the signal color, and the preview eases in. */
@media (hover: hover) {
  .entry:hover .plate-img img { transform: scale(1.012); }
  .entry:hover .tm, .entry:hover .num, .entry:hover .cta { color: var(--sig); }
  .entry:hover .tl::before, .entry:hover .bl::before { transform: translateX(calc(var(--tm-gap) - 2px)); }
  .entry:hover .tr::before, .entry:hover .br::before { transform: translateX(calc(2px - var(--tm-gap))); }
  .entry:hover .tl::after, .entry:hover .tr::after { transform: translateY(calc(var(--tm-gap) - 2px)); }
  .entry:hover .bl::after, .entry:hover .br::after { transform: translateY(calc(2px - var(--tm-gap))); }
  .entry:hover .arr, .back-link:hover .arr, footer a:hover .arr { transform: translate(2px, -2px); }
}

footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 32px 0 56px; letter-spacing: .12em; }
footer a { padding: 14px 0; transition: color .2s; }
footer a:hover { color: var(--fg); }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 10; padding: 14px 16px; background: var(--fg); color: var(--bg); font: 12px var(--mono); }
.skip-link:focus { top: 16px; }
.notfound { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 24px; }
.notfound .eyebrow { margin: 0; }

/* Motion: the header rises in once; earlier entries rise, and their plates
   print top to bottom, as they scroll into view. */
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
@keyframes print { from { transform: scaleY(1); } }
@media (prefers-reduced-motion: no-preference) {
  .intro .eyebrow, .intro h1, .intro-aside, .entry--lead .plate { animation: rise .9s var(--ease) both; }
  .intro h1 { animation-delay: .08s; }
  .intro-aside { animation-delay: .18s; }
  .entry--lead .plate { animation-delay: .3s; }
  @supports (animation-timeline: view()) {
    .entry--row { animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
    .entry--row .plate-img { view-timeline-name: --plate; }
    .entry--row .plate-img::before { animation: print linear both; animation-timeline: --plate; animation-range: entry 5% entry 80%; }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* Tablet widths: too narrow for three columns, so the number keeps its own
   column and the record stacks beside it instead of wrapping under it. */
@media (min-width: 761px) and (max-width: 1180px) {
  .lead-body, .entry--row { display: grid; grid-template-columns: 132px minmax(0, 1fr); column-gap: 48px; }
  .lead-body { row-gap: 24px; }
  .entry--row { row-gap: 40px; }
  .lead-body .entry-num, .entry--row .entry-num { grid-row: span 2; }
}
@media (max-width: 760px) {
  :root { --tm-len: 10px; --tm-gap: 5px; }
  .masthead { padding: 10px 0; }
  .wordmark-name { font-size: 20px; }
  .intro { padding: 64px 0 48px; gap: 28px; }
  .intro-note { font-size: 16px; }
  .num { font-size: 52px; }
  .entry--lead .num { font-size: 60px; }
  .lead-body .entry-num, .entry--row .entry-num { flex-basis: 100%; flex-direction: row; align-items: baseline; gap: 14px; }
  .entry--lead { padding: 32px 0 64px; }
  .lead-body { padding-top: 32px; gap: 20px; }
  .entry--row { padding: 48px 0 56px; gap: 24px; }
}
@media (max-width: 560px) {
  .masthead .back-link { display: none; }
}
