/* Orvane, a fictional battery-cell company: a Loomwest example site (2026-10-19). One screen: the cell drawn in ink
   dots (js/halftone.js, the lwkit halftone engine), four corner controls, and the lab log as an in-page state.
   Palette: warm paper, cool ink, and one charge green that only the dots and the text highlight use. */
:root {
  color-scheme: light only;
  --paper: #f3f2ee;
  --ink: #15181c;
  --slate: #4b5259;          /* 7.07:1 on paper */
  --rule: rgba(21, 24, 28, .14);
  --card: rgba(243, 242, 238, .93);
  --charge: #17985a;         /* ink on it 4.81:1; 3.3:1 against paper */
  --edge: clamp(18px, 2.8vw, 40px);
  --base: 0px;               /* room for the sample bar on phones */
  --sans: 'Host Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --dot: 'Doto', 'Host Grotesk', ui-monospace, 'Courier New', monospace;
  --mono: 'Azeret Mono', ui-monospace, 'Courier New', monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background-color: var(--paper); }
/* lab-notebook ground: a faint 24 px graph grid, a bolder line every fifth square, and ruler ticks on the left and top edges */
body {
  background-image:
    linear-gradient(rgba(21,24,28,.085) 1px, transparent 1px), linear-gradient(90deg, rgba(21,24,28,.085) 1px, transparent 1px),
    linear-gradient(rgba(21,24,28,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(21,24,28,.05) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px; background-position: -1px -1px;
}
body::before, body::after { content: ''; position: fixed; z-index: 0; pointer-events: none; }
body::before { top: 0; left: 0; right: 0; height: 9px; background: repeating-linear-gradient(90deg, rgba(21,24,28,.38) 0 1px, transparent 1px 12px); }
body::after { top: 0; left: 0; bottom: 0; width: 9px; background: repeating-linear-gradient(180deg, rgba(21,24,28,.38) 0 1px, transparent 1px 12px); }
.notes { position: fixed; inset: 0; z-index: 1; pointer-events: none; transition: opacity .8s ease; }
body.revealing .notes, body.log-open .notes { opacity: 0; }
.readout { white-space: nowrap; position: fixed; top: calc(var(--edge) + 6px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 2; margin: 0; font: 400 11px/1 'Azeret Mono', ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); transition: color .3s; pointer-events: none; }
.readout.on { color: #0f6b3e; }
body.revealing .readout, body.log-open .readout { opacity: 0; }
@media (max-width: 640px) { .readout { top: calc(var(--edge) + 48px + env(safe-area-inset-top)); } }
body { font: 400 13px/1.5 var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased; }
::selection { background: var(--charge); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* the dots */
.field { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; transition: opacity .8s ease; }
@media (pointer: fine) { .field { cursor: crosshair; } }

/* turn the cell (js/turn.js): a 3D cell of the same dots, with dimension marks that follow it */
.c3 { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; display: block; touch-action: none; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .6s ease, visibility 0s .6s; }
.live { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .6s ease; }
body.turning .c3 { opacity: 1; visibility: visible; pointer-events: auto; cursor: grab; transition: opacity .6s ease; }
body.turning .c3.grab { cursor: grabbing; }
body.turning .live { opacity: 1; }
body.turning .field, body.turning .notes { opacity: 0; }
body.revealing .c3, body.revealing .live, body.log-open .c3, body.log-open .live { opacity: 0; visibility: hidden; pointer-events: none; }
.turnwrap { position: absolute; top: calc(var(--edge) + 20px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
.turn {
  display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0 8px; background: none; border: 0; cursor: pointer;
  font: 400 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--slate); white-space: nowrap; pointer-events: auto;
}
.turn:hover, body.turning .turn { color: var(--ink); }
body.turning .turn { text-decoration: underline; text-underline-offset: 4px; }
body.revealing .turnwrap, body.log-open .turnwrap { opacity: 0; visibility: hidden; }
@media (max-width: 640px) { .turnwrap { top: calc(var(--edge) + 58px + env(safe-area-inset-top)); } }

/* the photo the dots resolve into while "The cell" is open; site.js sizes it to the exact box the dots fill */
.reveal img {
  position: fixed; left: 50%; top: 50%; z-index: 1;
  width: var(--rw, 60vw); height: var(--rh, auto); transform: translate(-50%, -50%);
  opacity: 0; pointer-events: none;
  transition: opacity .8s ease, transform .9s cubic-bezier(.2, .7, .2, 1), top .4s ease, height .4s ease, width .4s ease;
}
body.revealing .field { opacity: 0; }
body.revealing .reveal img { opacity: 1; }
/* on a computer the photo steps left and settles a little smaller, clear of the card at the top right */
@media (min-width: 641px) and (orientation: landscape) {
  body.revealing .reveal img { transform: translate(calc(-50% - 13vw), -50%) scale(.84); }
}

/* corner controls */
.ui { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.ui a, .ui button { pointer-events: auto; }
.brand {
  position: absolute; top: calc(var(--edge) + env(safe-area-inset-top)); left: calc(var(--edge) + env(safe-area-inset-left));
  display: inline-flex; align-items: center; min-height: 44px; margin-top: -8px;
  color: var(--ink); text-decoration: none;
}
.brand-word { font: 900 28px/1 var(--dot); letter-spacing: .01em; }
.pop, .logbtn { position: absolute; }
.pop--cell { top: calc(var(--edge) - 8px + env(safe-area-inset-top)); right: calc(var(--edge) + env(safe-area-inset-right)); }
.pop--join { bottom: calc(var(--edge) - 15px + var(--base) + env(safe-area-inset-bottom)); left: calc(var(--edge) + env(safe-area-inset-left)); }
.logbtn { bottom: calc(var(--edge) - 15px + var(--base) + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); }
.pop--contact { bottom: calc(var(--edge) - 15px + var(--base) + env(safe-area-inset-bottom)); right: calc(var(--edge) + env(safe-area-inset-right)); }
.pop-btn {
  display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 0 2px;
  font: 500 13px/1 var(--sans); letter-spacing: .01em; color: var(--slate);
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.pop-btn span { padding-bottom: 3px; border-bottom: 1px solid transparent; transition: border-color .18s, color .18s; }
.pop-btn:hover, .pop.open .pop-btn, .pop:focus-within .pop-btn, .pop-btn[aria-expanded="true"] { color: var(--ink); }
.pop-btn:hover span, .pop.open .pop-btn span, .pop:focus-within .pop-btn span, .pop-btn[aria-expanded="true"] span { border-color: var(--ink); }

/* the small paper cards the controls open */
.pop-card {
  position: absolute; width: max-content; max-width: min(360px, calc(100vw - 2 * var(--edge)));
  padding: 16px 18px; color: var(--slate); font-size: 13.5px; line-height: 1.55; text-align: left;
  background: var(--card); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 14px 40px rgba(21, 24, 28, .08);
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.pop--cell .pop-card { top: 100%; right: 0; transform: translateY(-4px); }
.pop--join .pop-card { bottom: 100%; left: 0; }
.pop--contact .pop-card { bottom: 100%; right: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pop.open .pop-card { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .pop:hover .pop-card, .pop:focus-within .pop-card { opacity: 1; visibility: visible; transform: none; }
}
.pop-card p { margin: 0 0 .7em; text-wrap: pretty; }
.pop-card .fiction { margin: 0; font-size: 12px; }
.pop-link {
  display: inline-flex; align-items: center; min-height: 32px; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid transparent; transition: border-color .18s;
}
.pop-link:hover { border-color: var(--ink); }
.spec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 4px 0 14px; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.spec div { min-width: 0; }
.spec dt { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); }
.spec dd { margin: 2px 0 0; font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

/* the lab log, an in-page state: the dots fade and the log comes up in their place */
.log {
  position: fixed; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; overflow: auto;
  padding: 96px max(20px, env(safe-area-inset-right)) calc(110px + var(--base)) max(20px, env(safe-area-inset-left));
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
}
body.log-open .log { opacity: 1; visibility: visible; transition: opacity .6s ease .2s, visibility 0s; }
body.log-open .field, body.log-open .reveal img { opacity: 0; }
.log-in { width: 100%; max-width: 680px; }
.log-title { margin: 0 0 22px; font: 900 40px/1 var(--dot); color: var(--ink); outline-offset: 6px; }
.log-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.log-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; gap: 20px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--rule);
  opacity: 0; transform: translateY(8px); transition: opacity .3s ease, transform .3s ease;
}
body.log-open .log-row { opacity: 1; transform: none; transition: opacity .9s cubic-bezier(.2, .6, .2, 1) .35s, transform .9s cubic-bezier(.2, .6, .2, 1) .35s; }
body.log-open .log-row:nth-child(2) { transition-delay: .47s; }
body.log-open .log-row:nth-child(3) { transition-delay: .59s; }
body.log-open .log-row:nth-child(4) { transition-delay: .71s; }
.log-row time { font-family: var(--mono); font-size: 12px; color: var(--slate); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-row p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.log-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); }

/* "Sample site" note for the made-up addresses */
.sample-mail {
  position: fixed; left: 50%; bottom: calc(var(--edge) + 44px + var(--base) + env(safe-area-inset-bottom)); z-index: 5;
  width: max-content; max-width: min(92vw, 420px); margin: 0; padding: 12px 16px; transform: translateX(-50%);
  border-radius: 8px; background: var(--ink); color: var(--paper); font-size: 13.5px; line-height: 1.45;
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s;
}
.sample-mail.on { opacity: 1; visibility: visible; }

.fade { opacity: 0; animation: fade-in .9s ease .45s forwards; }
@keyframes fade-in { to { opacity: 1; } }

@media (max-width: 820px) { body:has(.sample-tab) { --base: 30px; } }

/* phones: the cards open full width at reading size; the cell stands upright (js) */
@media (max-width: 640px) {
  .pop-card {
    position: fixed; left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right));
    width: auto; max-width: none; padding: 20px; font-size: 15px; line-height: 1.6;
  }
  .pop--cell .pop-card { top: calc(var(--edge) + 44px + env(safe-area-inset-top)); }
  .pop--join .pop-card, .pop--contact .pop-card { top: auto; bottom: calc(var(--edge) + 36px + var(--base) + env(safe-area-inset-bottom)); }
  .pop--contact .pop-card { align-items: flex-start; }
  .pop-link { min-height: 44px; }
  .spec dd { font-size: 16px; }
  .log-title { font-size: 34px; }
  .log-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .log-row p { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .pop--cell .pop-card { max-height: calc(100vh - 80px); overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .fade { animation: none; opacity: 1; }
  .field, .reveal img, .pop-card, .log, .log-row, body.log-open .log, body.log-open .log-row, .sample-mail { transition: none; }
}
