/* sadeqi.me, new top of the page (test). Black and white only; the one colour is his right eye, drawn by the shader. */
:root {
  --ink: #0b0b0e;
  --ink-2: #56565e;
  --rule: #b4b4bb;
  --paper: #ffffff;
  --display: 'Archivo', system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .1, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--body); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: 10px 14px; text-decoration: none; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------------------------------------------------------------- hero: layers from the back
   0 floating ones and zeros, 1 gears and their drawing, 2 the photo, 4 the liquid, 8 words */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 620px; overflow: hidden; background: var(--paper); touch-action: pan-y; isolation: isolate; }
.hero-field { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; pointer-events: none; }
.hero-photo { position: absolute; z-index: 2; display: block; left: var(--ph-x); top: var(--ph-y); width: var(--ph-w); height: var(--ph-h); pointer-events: none; user-select: none; -webkit-user-drag: none; }
.hero:not(.is-laid) .hero-photo { left: 50%; top: auto; bottom: 0; width: auto; height: 90%; transform: translateX(-50%); }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 4; pointer-events: none; }

/* words sit on top and turn white wherever the liquid has turned the page black */
.hero-name, .hero-nav, .readout p, .gears.is-ready .g-main { color: #fff; mix-blend-mode: difference; }
.hero-name a:focus-visible, .hero-nav a:focus-visible, .gears-list .g-main:focus-visible { outline-color: #fff; }

.hero-name { position: absolute; z-index: 8; top: 22px; left: 26px; margin: 0; font-family: var(--display); font-stretch: 118%; font-weight: 900; font-size: clamp(30px, 4.3vw, 66px); line-height: .9; letter-spacing: -0.01em; }
.hero-name a { text-decoration: none; display: block; }
.hero-name .braille { font-family: var(--mono); font-weight: 400; display: inline-block; width: .62em; text-align: center; }
.hero-nav { position: absolute; z-index: 8; top: 22px; right: 26px; display: flex; flex-direction: column; align-items: flex-end; font-family: var(--display); font-stretch: 112%; font-weight: 800; font-size: clamp(16px, 1.55vw, 24px); line-height: 1.08; text-transform: uppercase; }
.hero-nav a { text-decoration: none; padding: 2px 0; }
.hero-nav a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }

/* ---------------------------------------------------------------- gears, drawn like an engineering drawing */
.gears { position: absolute; inset: 0; pointer-events: none; }
.gear { position: absolute; z-index: 1; display: block; overflow: visible; transform-origin: 50% 50%; will-change: transform; pointer-events: none; }
.gear .gear-body { fill: var(--paper); stroke: var(--ink); stroke-width: 1.15; stroke-linejoin: round; pointer-events: visiblePainted; cursor: pointer; transition: fill .25s ease; }
.gear .gear-line, .gear .gear-bore { fill: none; stroke: var(--ink); stroke-width: 1; transition: stroke .25s ease; }
.gear .gear-pitch { fill: none; stroke: var(--rule); stroke-width: .7; stroke-dasharray: 9 3 1.5 3; }
.gear .wafer { fill: #f2f2f4; stroke: var(--ink); stroke-width: 1.1; pointer-events: visiblePainted; cursor: pointer; transition: fill .25s ease; }
.gear .dies { fill: none; stroke: #8f8f97; stroke-width: .6; transition: stroke .25s ease; }
.gear.is-on .gear-body, .gear.is-on .wafer { fill: var(--ink); }
.gear.is-on .gear-line, .gear.is-on .gear-bore { stroke: var(--paper); }
.gear.is-on .dies { stroke: rgba(255, 255, 255, .6); }
.gear.is-on .gear-pitch { stroke: rgba(255, 255, 255, .45); }

.gears-lines { position: absolute; left: 0; top: 0; z-index: 1; overflow: visible; pointer-events: none; }
.centre-lines path { fill: none; stroke: var(--rule); stroke-width: .7; stroke-dasharray: 12 3 2 3; }
.centre-lines .centres { stroke-dasharray: 2 4; }
.leaders path { fill: none; stroke: var(--ink); stroke-width: .9; transition: stroke-width .2s ease; }
.leaders circle { fill: var(--ink); }
.leaders path.is-on { stroke-width: 1.8; }

/* on a phone the train runs in front of his black shirt, so the drawing turns to white lines on black */
.gears-row .gear, .gears-row .gears-lines { z-index: 3; }
.gears-row .gear .gear-body { fill: var(--ink); stroke: #fff; }
.gears-row .gear .gear-line, .gears-row .gear .gear-bore { stroke: #fff; }
.gears-row .gear .gear-pitch { stroke: rgba(255, 255, 255, .45); }
.gears-row .gear .wafer { fill: #1d1d22; stroke: #fff; }
.gears-row .gear .dies { stroke: rgba(255, 255, 255, .5); }
.gears-row .gear.is-on .gear-body, .gears-row .gear.is-on .wafer { fill: #fff; }
.gears-row .gear.is-on .gear-line, .gears-row .gear.is-on .gear-bore { stroke: var(--ink); }
.gears-row .gear.is-on .dies { stroke: rgba(11, 11, 14, .5); }
.gears-row .centre-lines path { stroke: rgba(255, 255, 255, .3); }

/* the small gears: lighter, so the five parts lead */
.gear.sat .gear-body { stroke-width: .95; }
.gear.sat .gear-line { stroke-width: .9; }

/* the callouts: a plain list until the gears are drawn, then each one beside its gear */
.gears-list, .g-items { list-style: none; margin: 0; padding: 0; }
.gears-list { position: absolute; left: 26px; top: 30%; pointer-events: auto; }
.g-items { padding-left: 22px; font-size: 14px; }
.gears.is-ready .gears-list, .gears.is-ready .g-items, .gears.is-ready .g-part { position: static; padding: 0; }
.g-main { display: flex; align-items: baseline; gap: 9px; padding: 5px 9px; text-decoration: none; white-space: nowrap; }
.gears.is-ready .g-main { position: absolute; z-index: 8; pointer-events: auto; transform: translate(-100%, -50%); }
.gears.is-ready .g-main[data-side="right"] { transform: translate(0, -50%); }
.gears.is-ready .g-main[data-side="below"] { transform: translate(-50%, 0); flex-direction: column; align-items: center; gap: 0; }
.gears.is-ready .g-main[data-side="above"] { transform: translate(-50%, -100%); flex-direction: column; align-items: center; gap: 0; }
.g-n { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.g-name { font-family: var(--display); font-stretch: 112%; font-weight: 800; font-size: 16px; letter-spacing: .03em; text-transform: uppercase; }
/* white box and black letters, which the blend turns into a black box on the white page */
.gears.is-ready .g-main.is-on { background: #fff; color: #000; }

/* name tags of the small gears: hidden until their gear is pointed at; the rest stay for screen readers */
.gears.is-ready .g-items a { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; }
.gears.is-ready .g-items a.has-gear { width: auto; height: auto; overflow: visible; clip: auto; z-index: 9; padding: 3px 7px; background: var(--ink); color: var(--paper); font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; opacity: 0; pointer-events: none; transition: opacity .15s ease; transform: translate(0, -50%); }
.gears.is-ready .g-items a.has-gear[data-side="left"] { transform: translate(-100%, -50%); }
.gears.is-ready .g-items a.has-gear[data-side="above"] { transform: translate(-50%, -100%); }
.gears.is-ready .g-items a.has-gear[data-side="below"] { transform: translate(-50%, 0); }
.gears.is-ready .g-items a.has-gear.is-on, .gears.is-ready .g-items a.has-gear:focus-visible { opacity: 1; }
.gears-row .g-items a.has-gear { background: var(--paper); color: var(--ink); }

/* ---------------------------------------------------------------- corner readouts */
/* no z-index on the boxes themselves, so each line can blend with the page and the liquid under it */
.readout { position: absolute; bottom: 22px; font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.readout p, .machine-toggle { position: relative; z-index: 8; }
.readout p { margin: 0 0 3px; }
.readout-left { left: 26px; max-width: clamp(200px, calc(var(--ph-x, 400px) + var(--ph-w, 600px) * .04 - 46px), 360px); }
.readout-left .ro-top { font-weight: 600; text-transform: none; letter-spacing: .02em; }
.readout-left .ro-line { font-family: var(--body); text-transform: none; letter-spacing: 0; font-size: 15px; line-height: 1.4; margin: 6px 0 8px; }
.readout-left .ro-state, .readout-right p { color: #a2a2aa; }
.readout-right { right: 26px; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.machine-toggle { font: inherit; text-transform: uppercase; letter-spacing: .06em; min-height: 44px; padding: 0 18px; margin-bottom: 10px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); cursor: pointer; }
.machine-toggle:hover { background: var(--ink); color: var(--paper); }
.machine-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); box-shadow: 0 0 0 1px var(--paper); }
.hero[data-state="nogl"] .machine-toggle { display: none; }

@media (max-width: 759px), (max-aspect-ratio: 4/5) {
  .hero { min-height: 560px; }
  .hero-name { top: 16px; left: 16px; font-size: clamp(22px, 6.6vw, 54px); }
  .hero-nav { top: 16px; right: 16px; font-size: clamp(14px, 2.6vw, 24px); line-height: 1.15; }
  .readout-left { display: none; }
  /* under the name, whatever size the name is drawn at */
  .readout-right { top: calc(30px + 1.8 * clamp(22px, 6.6vw, 54px)); bottom: auto; left: 16px; right: auto; align-items: flex-start; }
  .readout-right p { display: none; }
  .machine-toggle { min-height: 40px; font-size: 10.5px; padding: 0 14px; }
  .gears.is-ready .g-main { padding: 2px 4px; }
  .g-n { font-size: 9.5px; }
  .g-name { font-size: 11px; font-stretch: 96%; letter-spacing: .02em; }
}

/* ---------------------------------------------------------------- after the hero (test note) */
.after { padding: 72px 26px 96px; border-top: 1px solid var(--ink); }
.note { max-width: 760px; margin: 0 auto; }
.note h2 { font-family: var(--display); font-stretch: 112%; font-weight: 900; font-size: clamp(28px, 4vw, 44px); line-height: 1; text-transform: uppercase; margin: 0 0 18px; }
.note .credits { color: var(--ink-2); font-size: 14px; margin-top: 28px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .gear .gear-body, .gear .wafer, .leaders path, .g-items a { transition: none; }
}

/* ---------------------------------------------------------------- the machine: the name of the part under the pointer */
.hud { position: absolute; z-index: 6; left: 0; top: 0; pointer-events: none; opacity: 0; transition: opacity .25s ease, transform .18s var(--ease); transform: translate(var(--hx, -99px), var(--hy, -99px)); font-family: var(--mono); color: #fff; }
.hud.is-on { opacity: 1; }
.hud-ring { position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; }
.hud-ring::after { content: ''; position: absolute; left: 8px; top: 8px; width: 2px; height: 2px; background: currentColor; }
.hud-line { position: absolute; left: 7px; top: -7px; width: 62px; height: 1px; background: currentColor; transform-origin: 0 0; transform: rotate(-34deg); }
.hud-text { position: absolute; left: 62px; top: -62px; white-space: nowrap; text-shadow: 0 0 6px #000, 0 0 2px #000; }
.hud[data-side="left"] .hud-line { left: -7px; transform: rotate(214deg); }
.hud[data-side="left"] .hud-text { left: auto; right: 62px; text-align: right; }
.hud b { display: block; font-weight: 600; font-size: 11px; letter-spacing: .14em; }
.hud i { display: block; font-style: normal; font-size: 10px; letter-spacing: .14em; color: #b9b9c0; margin-top: 3px; }
.hud.is-red .hud-ring, .hud.is-red .hud-line { color: #ff3a44; }
@media (hover: none) { .hud { display: none; } }

/* the dive into his head: everything but the machine steps aside */
.hero .gears, .hero-name, .hero-nav, .readout { transition: opacity .35s ease; }
.hero.is-diving .gears, .hero.is-diving .hero-name, .hero.is-diving .hero-nav, .hero.is-diving .readout, .hero.is-diving .hud { opacity: 0; pointer-events: none; }


/* the dive: the part's name comes toward you down the tunnel */
.dive-name { position: absolute; z-index: 6; left: 50%; top: 40%; margin: 0; opacity: 0; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap; font-family: var(--display); font-stretch: 125%; font-weight: 900; font-size: clamp(34px, 5vw, 72px); text-transform: uppercase; color: #fff; }
