/* Fredux, floppy prototype: a modern page dressed as a phosphor-green DOS
   screen. Rounded screen edge on tablet and desktop, flat on phones.
   Shared by the home (index.html) and the project pages.
   Viewports: mobile <=767, tablet 768-1199, desktop >=1200 (blocks at the end). */
:root {
  --bg: #030805;
  --bezel: #0b0d0c;
  --phos: #4dff9a;
  --phos-soft: #3ccf7e;
  --phos-dim: #30a163; /* 4.5:1 or more (WCAG 2.2 AA) even on the brightest green of the screen */
  --phos-faint: rgba(77, 255, 154, .16);
  --phos-wash: rgba(77, 255, 154, .06);
  --glow: 0 0 10px rgba(77, 255, 154, .35);
  --tip: #e9fff1;
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-dos: 'VT323', 'Geist Mono', ui-monospace, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1320px;
  --frame: 0px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bezel); }
body { margin: 0; padding: var(--frame); background: var(--bezel); color: var(--phos); font-family: var(--font-mono); font-size: .9375rem; line-height: 1.55; -webkit-font-smoothing: antialiased; font-variant-ligatures: none; }
.crt { min-height: calc(100svh - 2 * var(--frame)); background: radial-gradient(ellipse 80% 60% at 50% 30%, #07170d, var(--bg) 70%); }
a { color: inherit; }
::selection { background: var(--phos); color: var(--bg); }
:focus-visible { outline: 2px solid var(--phos); outline-offset: 3px; }
[hidden] { display: none !important; }
.glow { text-shadow: var(--glow); }

/* The screen: rounded glass edge, faint scanlines and vignette over everything */
.crt-glass { position: fixed; z-index: 40; inset: var(--frame); pointer-events: none; border-radius: var(--radius-screen, 0); box-shadow: 0 0 0 calc(var(--frame) + 40px) var(--bezel), inset 0 0 0 1px rgba(77, 255, 154, .08), inset 0 0 140px rgba(0, 0, 0, .7); }
.crt-glass::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: repeating-linear-gradient(rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px); opacity: .35; }

/* ---------- Top bar: like the header of a DOS menu ---------- */
.dos-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 18px var(--gutter) 14px; border-bottom: 1px solid var(--phos-faint); box-shadow: 0 3px 0 -2px var(--phos-faint); }
.dos-bar-date, .dos-bar-right { font-family: var(--font-dos); font-size: 1.375rem; line-height: 1; color: var(--phos-soft); }
.dos-bar-right { display: flex; justify-content: flex-end; align-items: center; gap: 22px; }
.dos-brand { display: grid; justify-items: center; gap: 2px; text-decoration: none; }
.dos-brand b { font-family: var(--font-sans); font-weight: 500; font-size: 1.375rem; line-height: 1; letter-spacing: .32em; margin-right: -.32em; text-shadow: var(--glow); }
.dos-brand span { font-size: .6875rem; letter-spacing: .08em; color: var(--phos-dim); }
.fd-sound { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; margin: -6px; padding: 0; border: 0; background: none; color: var(--phos); font: inherit; cursor: pointer; white-space: nowrap; }
.fd-sound-icon { width: 22px; height: 22px; }
/* Language: IT / EN, the one in use lit */
.dos-lang { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--phos-dim); font: inherit; cursor: pointer; white-space: nowrap; }
.dos-lang .is-on { color: var(--phos); text-shadow: var(--glow); }
.dos-lang:hover span:not(.is-on) { color: var(--phos-soft); }

/* Sound: only the speaker. On, its waves light up whenever the page makes a
   sound; off, the waves give way to an x */
.fd-sound-icon { overflow: visible; }
.fd-sound-icon g path { transition: opacity .18s steps(3), transform .18s steps(3); transform-origin: 9px 8px; }
.fd-sound-x { opacity: 0; transform: scale(.4); }
.fd-sound.is-talking .fd-sound-icon { filter: drop-shadow(0 0 3px var(--phos)); }
.fd-sound.is-talking .fd-sound-w1 { animation: fd-talk .24s steps(2) infinite alternate; }
.fd-sound.is-talking .fd-sound-w2 { animation: fd-talk .24s steps(2) .12s infinite alternate; }
@keyframes fd-talk { to { opacity: .25; } }
.fd-sound[aria-pressed="false"] { color: var(--phos-dim); }
.fd-sound[aria-pressed="false"] .fd-sound-w1, .fd-sound[aria-pressed="false"] .fd-sound-w2 { opacity: 0; transform: scale(.4); }
.fd-sound[aria-pressed="false"] .fd-sound-x { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .fd-sound-icon g path { transition: none; }
  .fd-sound.is-talking .fd-sound-w1, .fd-sound.is-talking .fd-sound-w2 { animation: none; }
}

/* ---------- Opening line: the name, selected like a layer in a design tool ---------- */
.fd-hero { position: relative; z-index: 6; max-width: var(--max); margin: 0 auto; padding: var(--hero-pad) var(--gutter) 0; }
.fd-hero-name { margin: 0; font-family: var(--font-sans); font-weight: 500; font-size: var(--hero-size); line-height: 1; letter-spacing: -.035em; text-shadow: var(--glow); }
.fd-sel { position: relative; display: inline-block; padding: .06em .16em .1em; margin-left: -.16em; border: 1px solid var(--phos); box-shadow: var(--glow); }
.fd-sel i { position: absolute; width: 9px; height: 9px; border: 1px solid var(--phos); background: var(--bg); }
.fd-sel i:nth-of-type(1) { left: -5px; top: -5px; }
.fd-sel i:nth-of-type(2) { right: -5px; top: -5px; }
.fd-sel i:nth-of-type(3) { left: -5px; bottom: -5px; }
.fd-sel i:nth-of-type(4) { right: -5px; bottom: -5px; }
.fd-hero-role { margin: 22px 0 0; font-family: var(--font-sans); font-weight: 500; font-size: var(--hero-role); line-height: 1.3; letter-spacing: -.015em; color: var(--tip); }
.fd-hero-role span { color: var(--phos-soft); font-weight: 400; }

/* ---------- The desk with the drive ---------- */
.fd-desk { position: relative; height: max(calc(100svh - 2 * var(--frame) - 64px - var(--hero-h, 0px)), var(--desk-min)); overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse 60% 55% at 50% 46%, rgba(77, 255, 154, .07), transparent 75%),
    linear-gradient(var(--phos-wash) 1px, transparent 1px) 0 0 / 100% 48px; }
.fd-desk.has-3d { background: radial-gradient(ellipse 60% 55% at 50% 46%, rgba(77, 255, 154, .07), transparent 75%); }

.fd-drive { position: absolute; z-index: 5; left: 50%; top: var(--drive-top); width: var(--drive-w); translate: -50% 0; }
.fd-drive-body { position: relative; height: calc(var(--drive-w) * 1.06); border-radius: 0 0 2px 2px; background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .07) 0 1px, rgba(0, 0, 0, .025) 1px 3px),
    linear-gradient(160deg, #d6d8d4, #b3b6b1 55%, #a3a6a1);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .15), 0 30px 50px -20px rgba(0, 0, 0, .9); }
.fd-screw { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #eef0ec, #8e918c 70%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.fd-screw::after { content: ''; position: absolute; inset: 5px 2px; background: rgba(0, 0, 0, .45); rotate: 35deg; }
.fd-screw-c { left: 10px; bottom: 10px; } .fd-screw-d { right: 10px; bottom: 10px; }
.fd-drive-sticker { position: absolute; left: 18%; right: 18%; bottom: 18%; display: grid; gap: 2px; padding: 9px 12px; border-radius: 2px; background: #f4f2ea; color: #2b2b28; font-family: var(--font-mono); font-size: calc(var(--drive-w) * .036); line-height: 1.35; text-transform: uppercase; letter-spacing: .04em; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.fd-drive-sticker b { font-size: 1.35em; font-weight: 600; letter-spacing: .02em; }
.fd-drive-bezel { position: relative; height: calc(var(--drive-w) * .16); margin-top: -2px; border-radius: 0 0 6px 6px; background: linear-gradient(#ece6d3, #d9d1ba); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -2px 0 rgba(0, 0, 0, .1), 0 14px 22px -12px rgba(0, 0, 0, .9); }
.fd-slot { position: absolute; left: 50%; top: 50%; width: 74%; height: 7px; translate: -50% -50%; border-radius: 4px; background: #1d1c19; box-shadow: inset 0 2px 2px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .7); transition: box-shadow .2s; }
.fd-led { position: absolute; left: 6%; top: 50%; translate: 0 -50%; width: 9px; height: 5px; border-radius: 1px; background: #3e4a3a; transition: background .08s, box-shadow .08s; }
.fd-led.is-on { background: #7dff70; box-shadow: 0 0 8px 2px rgba(125, 255, 112, .7); }
.fd-eject { position: absolute; right: 4%; top: 50%; translate: 0 -50%; width: 7%; height: 9px; border-radius: 2px; background: linear-gradient(#e2dbc6, #c9c0a7); box-shadow: 0 1px 1px rgba(0, 0, 0, .3); }
.fd-drive.is-target .fd-slot { box-shadow: inset 0 2px 2px rgba(0, 0, 0, .6), 0 0 0 3px rgba(255, 255, 255, .35); }
/* The 3D drive (Three.js) over the whole desk; the DOM drive stays as an
   invisible drop target over it, and as the fallback without WebGL */
.fd-3d { position: absolute; z-index: 5; inset: 0; pointer-events: none; }
/* With 3D the scene and the desk lines run on up behind the name, fading in
   from the top bar: no hard edge where the desk starts */
.has-3d { overflow: visible; }
.has-3d .fd-3d { top: calc(-1 * var(--bleed, 0px)); inset-inline: 0; bottom: 0; -webkit-mask-image: linear-gradient(transparent, #000 calc(var(--bleed, 0px) * .7)); mask-image: linear-gradient(transparent, #000 calc(var(--bleed, 0px) * .7)); }
.has-3d::before { content: ''; position: absolute; z-index: 0; inset: calc(-1 * var(--bleed, 0px)) 0 0; pointer-events: none; background: linear-gradient(var(--phos-wash) 1px, transparent 1px) 0 0 / 100% 48px; -webkit-mask-image: linear-gradient(transparent, #000 var(--bleed, 0px)); mask-image: linear-gradient(transparent, #000 var(--bleed, 0px)); }
/* the floppies live in the 3D scene: the flat ones stay only for the keyboard */
.has-3d-disks .fd-disk { opacity: 0; pointer-events: none; }
.fd-desk.is-grabbable { cursor: grab; }
.has-3d .fd-drive { translate: none; }
.has-3d .fd-drive > :not(.fd-tip) { display: none; }
.has-3d .fd-tip { bottom: 50%; translate: 0 50%; }
/* While a floppy goes in: the flap opens and a dark mouth sits in front of the floppy */
.fd-drive.is-open .fd-slot { background: #0b0a09; }
.fd-mouth { position: absolute; z-index: 8; height: 9px; translate: 0 -1px; border-radius: 4px 4px 2px 2px; background: #0b0a09; box-shadow: inset 0 3px 3px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 255, 255, .55); pointer-events: none; }
.fd-mouth::after { content: ''; position: absolute; left: 4px; right: 4px; top: 100%; height: 14px; background: linear-gradient(rgba(0, 0, 0, .45), transparent); }
.fd-desk.is-busy .fd-disk-btn { outline: none; }
.fd-tip { position: absolute; left: calc(100% + 18px); bottom: 26%; margin: 0; padding: 7px 11px; border: 1px solid var(--phos); background: var(--bg); color: var(--phos); font-size: .8125rem; white-space: nowrap; text-shadow: var(--glow); transition: opacity .3s; }
.fd-tip::before { content: ''; position: absolute; right: 100%; top: 50%; width: 14px; height: 1px; background: var(--phos); }
.fd-desk.is-busy .fd-tip { opacity: 0; }

.fd-disks { margin: 0; padding: 0; list-style: none; }
.fd-disk { position: absolute; z-index: 6; left: var(--x); top: var(--y); width: var(--disk-w); transform: translate(-50%, -50%) rotate(var(--r)); }
.fd-disk-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: grab; touch-action: pan-y; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transform: perspective(900px) rotateZ(var(--rz, 0deg)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .75));
  transition: scale .3s cubic-bezier(.2,.8,.3,1), filter .3s; }
.fd-disk-btn svg { display: block; width: 100%; height: auto; }
.fd-disk.is-lifted .fd-disk-btn { cursor: grabbing; scale: 1.12; filter: drop-shadow(0 46px 30px rgba(0, 0, 0, .8)); transition: scale .22s cubic-bezier(.2,.8,.3,1), filter .22s; }
.fd-disk.is-landing .fd-disk-btn { animation: fd-land .42s cubic-bezier(.3,.7,.3,1); }
@keyframes fd-land { 0% { scale: 1.12; } 45% { scale: .97; } 75% { scale: 1.015; } 100% { scale: 1; } }
.fd-disk.is-inserting { z-index: 7; }
.fd-disk.is-inserting .fd-disk-btn { filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .6)); }
.fd-disk.is-over .fd-disk-btn { scale: 1.04; }
@media (hover: hover) and (pointer: fine) {
  .fd-disk:not(.is-lifted):not(.is-inserting) .fd-disk-btn:hover { scale: 1.03; }
}
.fd-disk-btn:focus-visible { outline-offset: 6px; }

.dos-hint { position: absolute; z-index: 9; left: 0; right: 0; bottom: 0; margin: 0; padding: 16px var(--gutter) 20px; text-align: center; font-size: .8125rem; color: var(--phos); text-shadow: var(--glow); pointer-events: none; }

/* ---------- Projects (one clean list in a double-rule box) ---------- */
.dos-section { max-width: var(--max); margin: 0 auto; padding: clamp(48px, 7vw, 96px) var(--gutter) 0; }
.dos-box { position: relative; border: 1px solid var(--phos); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--phos-faint), var(--glow); }
.dos-box-head { padding: 16px clamp(16px, 2.4vw, 28px); border-bottom: 1px solid var(--phos-faint); }
.dos-box-title { margin: 0; font-family: var(--font-sans); font-weight: 500; font-size: clamp(1.125rem, 1.6vw, 1.375rem); letter-spacing: -.01em; text-shadow: var(--glow); }
.dos-menu { margin: 0; padding: 6px clamp(6px, 1.2vw, 14px); list-style: none; }
.dos-menu li + li { border-top: 1px solid var(--phos-faint); }
.dos-menu a { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; align-items: baseline; gap: 4px 14px; padding: 20px clamp(10px, 1.4vw, 14px); text-decoration: none; }
.dos-key { font-family: var(--font-dos); font-size: 1.625rem; line-height: 1; color: var(--phos-dim); }
.dos-item { display: grid; gap: 4px; min-width: 0; }
.dos-item b { font-family: var(--font-sans); font-weight: 500; font-size: clamp(1.25rem, 2.2vw, 1.875rem); line-height: 1.15; letter-spacing: -.02em; }
.dos-item span { font-size: .8125rem; color: var(--phos-soft); }
.dos-years { font-family: var(--font-dos); font-size: 1.375rem; line-height: 1; color: var(--phos-dim); }
.dos-menu a:hover, .dos-menu a:focus-visible { background: var(--phos); color: var(--bg); outline: none; }
.dos-menu a:hover :is(.dos-key, .dos-item span, .dos-years), .dos-menu a:focus-visible :is(.dos-key, .dos-item span, .dos-years) { color: var(--bg); }

.dos-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; padding: 0; list-style: none; }
.dos-links a { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; border: 1px solid var(--phos); text-decoration: none; text-shadow: var(--glow); }
.dos-links a:hover { background: var(--phos); color: var(--bg); text-shadow: none; }

.dos-prompt { margin: 0 0 18px; font-family: var(--font-dos); font-size: clamp(1.375rem, 2vw, 1.625rem); line-height: 1.1; color: var(--phos-soft); }
.dos-readme { max-width: 32ch; margin: 0; font-family: var(--font-sans); font-weight: 500; font-size: clamp(1.5rem, 3vw, 2.5rem); line-height: 1.2; letter-spacing: -.025em; text-shadow: var(--glow); text-wrap: pretty; }
.dos-cursor { display: inline-block; width: .55em; height: .9em; vertical-align: -.08em; background: currentColor; box-shadow: var(--glow); animation: dos-blink 1s steps(1) infinite; }
@keyframes dos-blink { 50% { opacity: 0; } }

.dos-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; max-width: var(--max); margin: clamp(56px, 8vw, 104px) auto 0; padding: 14px var(--gutter) 22px; border-top: 1px solid var(--phos-faint); font-family: var(--font-dos); font-size: 1.25rem; line-height: 1.1; color: var(--phos-dim); }

a.dos-back { text-decoration: none; }
a.dos-back:hover { color: var(--phos); }
.dos-prompt-end, .cs-end { margin: 28px 0 0; }
.dos-item b i { font-style: normal; color: var(--phos-dim); }
.cs-head { padding-top: clamp(40px, 6vw, 80px); }

/* ---------- DOS loading screen ---------- */
.fd-dos { position: fixed; inset: 0; z-index: 30; overflow: hidden; background: var(--bg); padding: var(--frame); }
.fd-dos-screen { margin: 0; padding: clamp(24px, 4vw, 56px); font-family: var(--font-dos); font-size: clamp(1.375rem, 2.4vw, 2rem); line-height: 1.15; color: var(--phos); text-shadow: 0 0 8px rgba(77, 255, 154, .55); white-space: pre-wrap; word-break: break-word; font-variant-ligatures: none; }
.fd-dos-screen .dos-cursor { width: .5em; height: .85em; }

/* ---------- Power-on and boot screen (first visit in a session) ---------- */
.fd-boot { position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; padding: var(--frame); background: var(--bg); transition: opacity .35s; }
.is-booted .fd-boot { display: none; }
.fd-boot.is-off { opacity: 0; pointer-events: none; }
/* the power symbol only says what this screen is; the two buttons under it start the site */
.fd-power { display: block; color: var(--phos); }
.fd-power svg { display: block; width: 64px; height: 64px; padding: 18px; box-sizing: content-box; border: 1px solid var(--phos); filter: drop-shadow(0 0 8px rgba(77, 255, 154, .5)); }
.fd-power-wrap { display: grid; justify-items: center; gap: 40px; outline: none; }
.fd-power-wrap[hidden] { display: none; }
.fd-power-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fd-power-mode .dos-btn { min-width: 220px; -webkit-tap-highlight-color: transparent; }
.fd-power-mode .dos-btn svg { width: 18px; height: 18px; flex: none; }
/* the DOS cursor at the end of whatever is being written */
.fd-boot-log::after { content: ''; display: inline-block; width: .5em; height: .9em; vertical-align: -.08em; background: currentColor; animation: dos-blink 1s steps(1) infinite; }
/* Standby: the power button breathes while it waits */
.fd-power svg { animation: fd-standby 3.2s ease-in-out infinite; }
@keyframes fd-standby {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(77, 255, 154, .2)); border-color: rgba(77, 255, 154, .45); opacity: .72; }
  50% { filter: drop-shadow(0 0 22px rgba(77, 255, 154, .85)); border-color: var(--phos); opacity: 1; }
}
.fd-boot-run { position: absolute; inset: var(--frame); display: grid; grid-template-rows: 1fr auto; padding: clamp(24px, 4vw, 56px); }
.fd-boot-log { margin: 0; font-family: var(--font-dos); font-size: clamp(1.25rem, 2vw, 1.75rem); line-height: 1.2; color: var(--phos); text-shadow: 0 0 8px rgba(77, 255, 154, .5); white-space: pre-wrap; }
.fd-boot-bar { display: grid; gap: 14px; }
.fd-boot-pct { font-family: var(--font-dos); font-size: clamp(4.5rem, 14vw, 12rem); line-height: .8; color: var(--phos); text-shadow: 0 0 18px rgba(77, 255, 154, .55); font-variant-numeric: tabular-nums; }
.fd-boot-track { display: block; height: clamp(20px, 3vw, 34px); padding: 4px; border: 1px solid var(--phos); }
.fd-boot-track i { display: block; height: 100%; width: 0; --seg: clamp(12px, 2.2vw, 30px); background: repeating-linear-gradient(90deg, var(--phos) 0 calc(var(--seg) - 4px), transparent calc(var(--seg) - 4px) var(--seg)); box-shadow: 0 0 12px rgba(77, 255, 154, .45); }

/* ---------- Case study page (Deltatre) ---------- */
.cs-path { margin: 0 0 22px; font-family: var(--font-dos); font-size: 1.375rem; line-height: 1.1; color: var(--phos-soft); }
.cs-title { margin: 0; font-family: var(--font-sans); font-weight: 500; font-size: clamp(2.6rem, 7vw, 6rem); line-height: .98; letter-spacing: -.045em; text-shadow: 0 0 18px rgba(77, 255, 154, .35); text-wrap: balance; }
.cs-tagline { max-width: 52ch; margin: 22px 0 0; font-family: var(--font-sans); font-size: clamp(1.0625rem, 1.5vw, 1.3125rem); line-height: 1.45; color: var(--phos-soft); text-wrap: pretty; }
.cs-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 36px 0 0; padding: 0; border-top: 1px solid var(--phos-faint); border-bottom: 1px solid var(--phos-faint); }
.cs-meta div { padding: 14px 16px 16px 0; }
.cs-meta div + div { padding-left: 16px; border-left: 1px solid var(--phos-faint); }
.cs-meta dt { font-size: .75rem; color: var(--phos-dim); }
.cs-meta dd { margin: 4px 0 0; font-family: var(--font-sans); font-size: 1rem; line-height: 1.35; }
.cs-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.cs-tags li { padding: 4px 10px; border: 1px solid var(--phos-faint); font-size: .75rem; color: var(--phos-soft); }
.cs-cover { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 7; margin-top: clamp(36px, 5vw, 64px); overflow: hidden; }
.cs-cover-logo { width: var(--logo-w, min(48%, 520px)); aspect-ratio: var(--logo-ratio, 122 / 20); background: var(--phos); -webkit-mask: var(--logo, url(deltatre-logo.svg)) center / contain no-repeat; mask: var(--logo, url(deltatre-logo.svg)) center / contain no-repeat; filter: drop-shadow(0 0 14px rgba(77, 255, 154, .5)); }
.cs-cover-grid { position: absolute; inset: 0; background: linear-gradient(var(--phos-wash) 1px, transparent 1px) 0 0 / 100% 24px, linear-gradient(90deg, var(--phos-wash) 1px, transparent 1px) 0 0 / 24px 100%; }
.cs-cover-cap { position: absolute; left: 16px; right: 16px; bottom: 12px; display: flex; justify-content: space-between; font-family: var(--font-dos); font-size: 1.25rem; color: var(--phos-dim); }

.cs-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: clamp(28px, 5vw, 72px); }
.cs-index { position: sticky; top: 24px; align-self: start; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.cs-index a { display: grid; grid-template-columns: 2em minmax(0, 1fr); gap: 8px; padding: 8px 10px; margin: 0 -10px; text-decoration: none; font-size: .8125rem; color: var(--phos-soft); }
.cs-index a span:first-child { font-family: var(--font-dos); font-size: 1.25rem; line-height: 1; color: var(--phos); }
.cs-index a:hover, .cs-index a.is-current { background: var(--phos); color: var(--bg); }
.cs-index a:hover span, .cs-index a.is-current span { color: var(--bg); }
.cs-section + .cs-section { margin-top: clamp(48px, 6vw, 80px); }
.cs-section { scroll-margin-top: 24px; }
.cs-h { display: flex; align-items: baseline; gap: 14px; margin: 0 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--phos-faint); font-family: var(--font-sans); font-weight: 500; font-size: clamp(1.25rem, 2vw, 1.625rem); letter-spacing: -.01em; text-shadow: var(--glow); }
.cs-h span { font-family: var(--font-dos); font-size: 1.375rem; letter-spacing: 0; color: var(--phos-dim); text-shadow: none; }
.cs-text { max-width: 62ch; margin: 0; font-family: var(--font-sans); font-size: clamp(1.0625rem, 1.3vw, 1.1875rem); line-height: 1.6; color: #c9f7dc; text-wrap: pretty; }
.cs-steps { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.cs-step { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: 4px 16px; padding: 18px clamp(14px, 2vw, 22px); border: 1px solid var(--phos-faint); }
.cs-step::before { counter-increment: step; content: '0' counter(step); grid-row: 1 / span 2; font-family: var(--font-dos); font-size: 1.75rem; line-height: 1; color: var(--phos); text-shadow: var(--glow); }
.cs-step h3 { margin: 0; font-family: var(--font-sans); font-weight: 500; font-size: 1.1875rem; line-height: 1.3; }
.cs-step p { max-width: 62ch; margin: 0; font-family: var(--font-sans); font-size: 1rem; line-height: 1.6; color: #b9eccd; }
.cs-next { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: clamp(48px, 6vw, 80px); }
.cs-next a { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 18px; border: 1px solid var(--phos); text-decoration: none; text-shadow: var(--glow); }
.cs-next a:hover { background: var(--phos); color: var(--bg); text-shadow: none; }

/* Gallery: the real artwork in full colour, each in a thin phosphor frame */
.cs-note { max-width: 62ch; margin: 0 0 22px; padding-left: 14px; border-left: 2px solid var(--phos-dim); font-size: .8125rem; line-height: 1.6; color: var(--phos-soft); }
.cs-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 28px); }
.cs-shot { display: grid; gap: 10px; margin: 0; min-width: 0; }
.cs-shot-wide { grid-column: 1 / -1; }
.cs-shot-btn { position: relative; display: block; width: 100%; padding: 6px; border: 1px solid var(--phos-faint); background: var(--phos-wash); color: var(--phos); cursor: zoom-in; transition: border-color .2s, box-shadow .2s; }
.cs-shot-btn img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: #07170d; }
.cs-shot-zoom { position: absolute; right: 14px; top: 14px; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--phos); background: var(--bg); font-size: 1rem; line-height: 1; opacity: 0; transition: opacity .2s; }
.cs-shot-btn:hover, .cs-shot-btn:focus-visible { border-color: var(--phos); box-shadow: var(--glow); }
.cs-shot-btn:hover .cs-shot-zoom, .cs-shot-btn:focus-visible .cs-shot-zoom { opacity: 1; }
.cs-shot figcaption { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); gap: 8px; font-family: var(--font-sans); font-size: .9375rem; line-height: 1.4; color: #c9f7dc; }
.cs-shot figcaption span { font-family: var(--font-dos); font-size: 1.25rem; line-height: 1; color: var(--phos-dim); }
@media (hover: none) { .cs-shot-zoom { opacity: 1; } }

/* Image viewer: a full-screen DOS window over the page */
.cs-viewer { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(3, 8, 5, .97); color: var(--phos); font-family: var(--font-mono); }
.cs-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.cs-viewer::backdrop { background: rgba(3, 8, 5, .9); }
.cs-viewer-bar, .cs-viewer-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gutter); }
.cs-viewer-bar { border-bottom: 1px solid var(--phos-faint); }
.cs-viewer-foot { border-top: 1px solid var(--phos-faint); }
.cs-viewer-file { font-family: var(--font-dos); font-size: 1.375rem; line-height: 1; color: var(--phos-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-viewer button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 0 14px; border: 1px solid var(--phos); background: none; color: var(--phos); font: inherit; cursor: pointer; text-shadow: var(--glow); }
.cs-viewer button:hover { background: var(--phos); color: var(--bg); text-shadow: none; }
.cs-viewer-stage { position: relative; min-height: 0; }
.cs-viewer-stage img { position: absolute; inset: clamp(12px, 3vw, 32px) var(--gutter); width: calc(100% - 2 * var(--gutter)); height: calc(100% - 2 * clamp(12px, 3vw, 32px)); object-fit: contain; opacity: 0; transition: opacity .2s; }
.cs-viewer-stage img.is-ready { opacity: 1; }
.cs-viewer-label { margin: 0; font-family: var(--font-sans); font-size: 1rem; line-height: 1.4; }
.cs-viewer-nav { display: flex; align-items: center; gap: 12px; flex: none; font-family: var(--font-dos); font-size: 1.375rem; color: var(--phos-soft); font-variant-numeric: tabular-nums; }

/* Previous and next project */
.cs-pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: clamp(56px, 7vw, 96px); }
.cs-pager a { display: grid; align-content: start; gap: 6px; padding: 18px clamp(16px, 2vw, 22px) 20px; border: 1px solid var(--phos-faint); text-decoration: none; transition: background .15s, border-color .15s; }
.cs-pager-next { grid-column: 2; text-align: right; }
.cs-pager-dir { font-family: var(--font-dos); font-size: 1.25rem; line-height: 1; color: var(--phos-dim); }
.cs-pager b { font-family: var(--font-sans); font-weight: 500; font-size: clamp(1.125rem, 1.6vw, 1.375rem); line-height: 1.2; letter-spacing: -.01em; text-shadow: var(--glow); }
.cs-pager-client { font-size: .8125rem; color: var(--phos-soft); }
.cs-pager a:hover, .cs-pager a:focus-visible { border-color: var(--phos); background: var(--phos); color: var(--bg); outline: none; }
.cs-pager a:hover :is(.cs-pager-dir, .cs-pager-client), .cs-pager a:focus-visible :is(.cs-pager-dir, .cs-pager-client) { color: var(--bg); }
.cs-pager a:hover b, .cs-pager a:focus-visible b { text-shadow: none; }
.cs-pager + .cs-next { margin-top: 14px; }

/* ---------- heatmap.exe: the visit as a green dot map ---------- */
.dos-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px; border: 1px solid var(--phos); background: none; color: var(--phos); font: inherit; font-family: var(--font-mono); text-decoration: none; text-shadow: var(--glow); cursor: pointer; }
.dos-btn:hover, .dos-btn:focus-visible { background: var(--phos); color: var(--bg); text-shadow: none; outline: none; }
.dos-btn-ghost { border-color: var(--phos-faint); }
/* the readme's last prompt types heatmap.exe by itself, then the box prints out */
.dos-section.dos-heat { padding-top: 28px; }
.dos-heat .dos-box.is-waiting { display: none; }
.dos-heat .dos-box.is-printing { animation: dos-print .42s steps(7, end) both; }
@keyframes dos-print { from { clip-path: inset(-40px -40px 100% -40px); } to { clip-path: inset(-40px); } }
.dos-heat-body { padding: clamp(20px, 3vw, 36px) clamp(16px, 2.4vw, 28px); }
.dos-heat-lead { max-width: 46ch; margin: 0 0 24px; font-family: var(--font-sans); font-size: clamp(1.0625rem, 1.4vw, 1.25rem); line-height: 1.45; color: #c9f7dc; text-wrap: pretty; }
.dos-heat-log { margin: 0; font-family: var(--font-dos); font-size: clamp(1.25rem, 1.8vw, 1.5rem); line-height: 1.15; color: var(--phos-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.dos-heat-result { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: clamp(24px, 4vw, 56px); margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--phos-faint); }
.dos-heat-map { --map-h: 440px; margin: 0; display: grid; gap: 10px; justify-items: start; }
.dos-heat-map canvas { --map-h: inherit; display: block; outline: 1px solid var(--phos); outline-offset: 6px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--phos-faint), var(--glow); }
.dos-heat-map figcaption { margin-top: 8px; font-family: var(--font-dos); font-size: 1.25rem; line-height: 1; color: var(--phos-dim); }
.dos-heat-side { display: grid; gap: 24px; align-content: start; min-width: 0; }
.dos-heat-story { max-width: 30ch; margin: 0; font-family: var(--font-sans); font-weight: 500; font-size: clamp(1.375rem, 2.4vw, 2rem); line-height: 1.22; letter-spacing: -.02em; text-shadow: var(--glow); text-wrap: pretty; }
.dos-heat-stats { display: grid; max-width: 440px; margin: 0; font-family: var(--font-dos); font-size: 1.375rem; line-height: 1.1; }
.dos-heat-stats div { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--phos-faint); }
.dos-heat-stats dt { color: var(--phos-dim); text-transform: uppercase; }
.dos-heat-stats dd { margin: 0 0 0 auto; color: var(--phos); text-shadow: var(--glow); font-variant-numeric: tabular-nums; }
.dos-heat-legend { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .8125rem; color: var(--phos-soft); }
.dos-heat-legend i { display: block; border-radius: 50%; }
.dos-heat-legend i:nth-child(1) { width: 6px; height: 6px; background: rgb(31, 122, 70); }
.dos-heat-legend i:nth-child(2) { width: 10px; height: 10px; background: rgb(122, 189, 148); }
.dos-heat-legend i:nth-child(3) { width: 15px; height: 15px; background: rgb(214, 255, 226); box-shadow: var(--glow); }
.dos-heat-legend span { margin-left: 4px; }
.dos-heat-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.dos-heat-card-foot { justify-content: flex-end; }
.dos-heat-card .cs-viewer-stage img { image-rendering: auto; }

/* ---------- Easter egg: the mini player ---------- */
.fd-player { position: fixed; z-index: 50; right: calc(var(--frame) + 16px); bottom: calc(var(--frame) + 16px); width: min(360px, calc(100vw - 2 * var(--frame) - 32px)); border: 1px solid #b07cff; background: var(--bg); box-shadow: 0 0 24px rgba(167, 96, 255, .45); animation: fd-player-in .35s cubic-bezier(.2, .8, .3, 1); }
.fd-player-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid #b07cff; font-family: var(--font-dos); font-size: 1.25rem; line-height: 1; color: #d2b2ff; text-shadow: 0 0 8px rgba(167, 96, 255, .6); }
.fd-player-bar button { padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.fd-player-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.fd-player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@keyframes fd-player-in { from { opacity: 0; translate: 0 16px; } }
@media (prefers-reduced-motion: reduce) { .fd-player { animation: none; } }

/* ---------- Viewports ---------- */
/* Desktop: rounded screen, the drive comes in from under the top bar */
@media (min-width: 1200px) {
  :root { --frame: 14px; --radius-screen: 30px; }
  :root { --hero-pad: 56px; --hero-size: 5rem; --hero-role: 1.5rem; --hero-h: 200px; }
  .fd-desk { --desk-min: 640px; --drive-w: 290px; --drive-top: -116px; --disk-w: 200px; --drive3d-w: 300px; --drive3d-y: .27; }
  .fd-disk:nth-child(1) { --x: 22%; --y: 50%; --r: -14deg; }
  .fd-disk:nth-child(2) { --x: 80%; --y: 58%; --r: 11deg; }
  .fd-disk:nth-child(3) { --x: 57%; --y: 72%; --r: -6deg; }
  .dos-hint { display: none; }
  .dos-heat-map { --map-h: 460px; order: 2; margin-right: 7px; } /* the frame drawn 7px outside the map lines up with the margin */
  .dos-heat-result { grid-template-columns: minmax(0, 720px) auto; justify-content: space-between; }
}
/* Tablet: rounded screen with a thinner edge, everything a bit smaller */
@media (min-width: 768px) and (max-width: 1199px) {
  :root { --frame: 10px; --radius-screen: 24px; }
  :root { --hero-pad: 48px; --hero-size: 4.25rem; --hero-role: 1.375rem; --hero-h: 180px; }
  .fd-desk { --desk-min: 620px; --drive-w: 240px; --drive-top: -96px; --disk-w: 170px; --drive3d-w: 250px; --drive3d-y: .25; }
  .fd-disk:nth-child(1) { --x: 19%; --y: 52%; --r: -14deg; }
  .fd-disk:nth-child(2) { --x: 81%; --y: 47%; --r: 11deg; }
  .fd-disk:nth-child(3) { --x: 54%; --y: 72%; --r: -6deg; }
  .fd-tip { display: none; }
  .cs-body { grid-template-columns: minmax(0, 1fr); }
  .cs-index { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dos-heat-map { --map-h: 420px; }
}
/* Mobile: no rounded edge, flat and full width; the explanation under the floppies */
@media (max-width: 767px) {
  .crt-glass { box-shadow: inset 0 0 90px rgba(0, 0, 0, .6); }
  .dos-bar { grid-template-columns: 1fr auto; padding-top: 16px; }
  .dos-bar-date { display: none; }
  .dos-brand { justify-items: start; }
  .dos-brand b { letter-spacing: .24em; }
  .dos-bar-right .dos-clock { display: none; }
  .dos-bar-right { gap: 14px; }
  /* only the other language, to fit next to the sound switch */
  .dos-lang .is-on, .dos-lang [aria-hidden] { display: none; }
  .dos-lang span { color: var(--phos); }
  .dos-brand span { white-space: nowrap; }
  :root { --hero-pad: 32px; --hero-size: 2.75rem; --hero-role: 1.125rem; --hero-h: 150px; }
  .fd-hero-role span { display: block; }
  .fd-desk { --desk-min: 560px; --drive-w: 168px; --drive-top: -62px; --disk-w: 118px; --drive3d-w: 176px; --drive3d-y: .18; }
  .fd-disk:nth-child(1) { --x: 27%; --y: 47%; --r: -10deg; }
  .fd-disk:nth-child(2) { --x: 71%; --y: 56%; --r: 9deg; }
  .fd-disk:nth-child(3) { --x: 36%; --y: 73%; --r: -4deg; }
  .fd-tip { display: none; }
  .dos-menu a { grid-template-columns: 1.8em minmax(0, 1fr); padding: 18px 10px; }
  .dos-years { grid-column: 2; font-size: 1.25rem; }
  .dos-keys-only { display: none; }
  .cs-page .dos-bar-date.dos-back { display: block; order: 2; text-align: right; }
  .cs-page .dos-bar { grid-template-columns: 1fr auto auto; }
  .cs-page .dos-bar-right { order: 1; }
  .cs-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-meta div:nth-child(3) { padding-left: 0; border-left: 0; }
  .cs-meta div:nth-child(n + 3) { border-top: 1px solid var(--phos-faint); }
  .cs-cover { aspect-ratio: 4 / 3; }
  .cs-body { grid-template-columns: minmax(0, 1fr); }
  .cs-index { position: static; }
  .cs-gallery { grid-template-columns: minmax(0, 1fr); }
  .cs-shot-btn { padding: 4px; }
  .cs-pager { grid-template-columns: minmax(0, 1fr); }
  .cs-pager-next { grid-column: 1; }
  .cs-viewer-foot { flex-direction: column; align-items: stretch; gap: 12px; }
  .cs-viewer-nav { justify-content: space-between; }
  .dos-heat-result { grid-template-columns: minmax(0, 1fr); }
  .dos-heat-log { font-size: 1.125rem; }
  .dos-heat-map { --map-h: 460px; justify-items: center; }
  .dos-heat-actions .dos-btn { flex: 1 1 100%; }
  .dos-heat-card-foot { flex-direction: column; align-items: stretch; }
}

@media (max-width: 767px) {
  .fd-power-mode { grid-template-columns: 1fr; width: min(100%, 280px); }
  .fd-power-mode .dos-btn { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fd-disk-btn { transition: none; }
  .dos-cursor { animation: none; }
  .fd-power svg { animation: none; }
}
