/* ============================================================
   PORTFOLIO — Silvan Guntlin
   desktop / ascii / glitch
   ============================================================ */

/* ── Themes ─────────────────────────────────────────────────
   Dark is the default; the menu bar toggles to light.
   Colour roles, same in both themes:
     --accent  identity: titles, code keys, primary buttons, links, the ascii field
     --line    structure: borders, dividers, key and button edges
     --muted   quiet labels: dates, subtitles, section labels
     --hl      interaction: selection, hover, focus, cursor, active tab, "new"
   ─────────────────────────────────────────────────────────── */
:root,
[data-theme="dark"] {                 /* pixel space: pink + cyan on near-black */
  --bg:        #06050C;
  --paper:     #0B0A15;
  --ink:       #EFFFFC;
  --ink-2:     #B5D9D3;
  --muted:     #3F7A55;
  --accent:    #FF86D6;
  --accent-2:  #86FFF0;
  --line:      #86FFF0;
  --shadow:    #FF86D6;
  --hl:        #FF86D6;
  --title-bg:  #FF86D6;
  --title-ink: #06050C;
  --cat:       #EFFFFC;
  --glow:      0 0 16px rgba(255, 134, 214, 0.5);
  color-scheme: dark;
}

[data-theme="light"] {                /* teal leads, green carries the structure, pink is the spark */
  --bg:        #F3F7F4;
  --paper:     #FFFFFF;
  --ink:       #16211C;
  --ink-2:     #45554C;
  --muted:     #3D7A52;
  --accent:    #0B7F76;
  --accent-2:  #D12F8F;
  --line:      #1F5A3D;
  --shadow:    #7CC79A;
  --hl:        #D12F8F;
  --title-bg:  #A6EBDD;
  --title-ink: #10261D;
  --cat:       #16211C;
  --glow:      none;
  color-scheme: light;
}

:root {
  --dot: color-mix(in srgb, var(--accent) 16%, transparent);

  --font-serif: 'DM Serif Display', serif;
  --font-mono:  'DM Mono', monospace;
  --font-sans:  'Inter', sans-serif;
  --font-pixel: 'Silkscreen', 'DM Mono', monospace;

  --bw: 2px;           /* window border width (error98 overrides) */
  --drop: 6px;         /* hard shadow offset */
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { overflow-x: hidden; }
html { scroll-behavior: smooth; scroll-padding-top: 48px; }
body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 6px 6px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection { background: var(--hl); color: var(--paper); }

button { font: inherit; color: inherit; }

/* ── Layout ── */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 44px;
}

section { padding: 40px 0; }

/* ── Typography ── */
.mono-key { font-family: var(--font-mono); font-weight: 300; color: var(--accent); }
.mono-val { font-family: var(--font-mono); font-weight: 300; color: var(--ink-2); }
.mono-dim { font-family: var(--font-mono); font-weight: 300; color: var(--muted); }

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  font-style: italic;
  color: var(--accent);
  line-height: 1.1;
  margin-top: 6px;
  text-shadow: var(--glow);
}

.section-header { margin-bottom: 24px; }
.section-header-out { margin-bottom: 28px; }

.cursor {
  display: inline-block;
  width: 9px;
  height: 1em;
  background: var(--hl);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ============================================================
   WINDOW  — the core component
   ============================================================ */
.win {
  position: relative;
  background: var(--paper);
  border: var(--bw) solid var(--line);
  box-shadow: var(--drop) var(--drop) 0 var(--shadow);
}

.win-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 26px;
  padding: 0 4px 0 10px;
  background: var(--title-bg);
  color: var(--title-ink);
  border-bottom: var(--bw) solid var(--line);
  user-select: none;
}

.win-title {
  font-family: var(--font-pixel);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-btns { display: flex; gap: 3px; }
.win-btns i,
.win-x {
  width: 18px; height: 18px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--line);
}
.win-x { cursor: pointer; }
.win-x:hover { background: var(--hl); color: var(--paper); }

.win-body { padding: 24px 26px; }

.win-status {
  display: flex;
  gap: 0;
  border-top: var(--bw) solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.win-status span { padding: 5px 12px; border-right: 1px solid color-mix(in srgb, var(--line) 35%, transparent); }
.win-status span:last-child { border-right: none; margin-left: auto; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--paper);
  border: var(--bw) solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
  padding: 9px 16px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn:hover { background: color-mix(in srgb, var(--hl) 12%, var(--paper)); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.12); }
.btn-sm { padding: 4px 10px; font-size: 11px; box-shadow: 2px 2px 0 var(--line); }
.btn-sm:active { transform: translate(2px, 2px); }

/* ============================================================
   MENU BAR
   ============================================================ */
.menubar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 34px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: var(--bw) solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}

.mb-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}
.mb-spark { width: 11px; height: 11px; fill: currentColor; }

.mb-links { display: flex; gap: 2px; }
.mb-links a {
  color: var(--ink);
  text-decoration: none;
  padding: 4px 10px;
}
.mb-links a:hover { background: var(--hl); color: var(--paper); }

.mb-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.mb-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid transparent;
  padding: 3px 8px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
}
.mb-btn:hover, .mb-btn[aria-expanded="true"] { border-color: var(--line); }
.motion-state, .theme-state { color: var(--hl); }
.mb-btn.off .motion-state { color: var(--muted); text-decoration: line-through; }
.mb-ico { display: none; color: var(--hl); font-size: 14px; line-height: 1; }
.mb-btn.off .mb-ico { color: var(--muted); text-decoration: line-through; }

.theme-icon {
  width: 10px; height: 10px;
  border: 1.5px solid var(--line);
  background: linear-gradient(90deg, var(--ink) 50%, var(--bg) 50%);
}

.mb-clock {
  font-family: var(--font-pixel);
  font-size: 11px;
  padding-left: 10px;
  border-left: 1.5px solid var(--line);
  color: var(--ink);
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - 34px);
  min-height: calc(100svh - 34px);
  display: flex;
  align-items: center;
  padding: 56px 0 72px;
}
/* halftone fade at the bottom edge */
#hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 90px;
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 55%, transparent) 1.4px, transparent 1.8px);
  background-size: 6px 6px;
  -webkit-mask-image: linear-gradient(to top, #000, transparent);
          mask-image: linear-gradient(to top, #000, transparent);
  pointer-events: none;
}

#ascii-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

.hero-grid {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 520px;
}

.win-hero { max-width: 760px; z-index: 3; }
.win-hero .win-body { padding: 30px 34px 30px; }

.code-block {
  font-family: var(--font-mono);
  font-weight: 300;
  line-height: 2.1;
  font-size: 16px;
}
.code-line { margin-left: 22px; }
.code-line-name { margin: 6px 0 6px 22px; }

.code-name {
  font-family: var(--font-serif);
  font-size: 76px;
  font-style: italic;
  color: var(--ink);
  font-weight: 400;
  line-height: 1;
  vertical-align: middle;
  text-shadow: var(--glow);
}

.glitch-wrap { position: relative; display: inline-block; }
.glitch-wrap + .mono-dim { margin-left: 10px; }
.name-val { white-space: nowrap; }   /* the comma never wraps away from the name */
.glitch-layer {
  position: absolute;
  top: 0; left: 0;
  font-family: var(--font-serif);
  font-size: 76px;
  font-style: italic;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  vertical-align: middle;
}
.gl-1 { color: var(--accent); clip-path: inset(10% 0 55% 0); }
.gl-2 { color: var(--accent-2); clip-path: inset(58% 0 8% 0); }

.hero-cta { display: flex; gap: 14px; margin-top: 26px; flex-wrap: wrap; }

/* floating clutter */
.win-float { position: absolute; z-index: 4; }
.win-float[data-drag] .win-bar { cursor: grab; }
.win-float.dragging .win-bar { cursor: grabbing; }

.f-news   { width: 310px; right: 40px; top: 40px; }

.notice-body { display: flex; gap: 14px; align-items: flex-start; padding: 18px 18px 8px; }
.notice-body p { font-family: var(--font-mono); font-size: 12px; line-height: 1.6; color: var(--ink); }
.notice-icon {
  flex: none;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border: var(--bw) solid var(--line);
  background: var(--hl);
  color: var(--paper);
  font-family: var(--font-pixel);
  font-size: 16px;
}
.notice-actions { display: flex; justify-content: center; padding: 8px 0 16px; }
.notice-actions .btn { min-width: 76px; justify-content: center; }

.news-body { padding: 14px 16px 10px; }
.news-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.news-badge {
  font-family: var(--font-pixel);
  font-size: 10px;
  text-transform: uppercase;
  padding: 1px 6px;
  background: var(--hl);
  color: var(--paper);
}
.news-date { font-family: var(--font-pixel); font-size: 10px; color: var(--muted); }
.news-item { display: flex; gap: 12px; align-items: flex-start; }
.proj-thumb.news-thumb { --tw: 72px; --th: 56px; flex: none; }
.news-text { min-width: 0; }
.news-name { font-family: var(--font-serif); font-style: italic; font-size: 18px; color: var(--ink); line-height: 1.15; }
.news-desc { font-size: 12px; line-height: 1.5; color: var(--ink-2); margin-top: 4px; }
.news-actions { display: flex; justify-content: flex-end; padding: 4px 16px 14px; }

.proj-date { font-family: var(--font-pixel); font-size: 10px; color: var(--muted); letter-spacing: 0.04em; }
.proj-row.flash { animation: row-flash 1.2s steps(2) 2; }
@keyframes row-flash { 50% { background: color-mix(in srgb, var(--hl) 22%, transparent); } }

/* pixel sparkles */
.spark { position: absolute; fill: var(--accent); z-index: 1; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 60%, transparent)); }
.spark.s1 { width: 27px; height: 27px; left: 6%; top: 12%; animation: twinkle 2.6s steps(2) infinite; }
.spark.s2 { width: 18px; height: 18px; right: 8%; bottom: 18%; animation: twinkle 3.4s steps(2) infinite 0.8s; }
.spark.s3 { width: 36px; height: 36px; left: 55%; top: 8%; animation: twinkle 4s steps(2) infinite 1.6s; fill: var(--accent-2); }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ============================================================
   PROJECTS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: var(--bw) solid var(--line);
  margin-bottom: 4px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 16px;
  margin-bottom: calc(var(--bw) * -1);
  background: none;
  border: var(--bw) solid transparent;
  border-bottom: none;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--hl);
  background: var(--paper);
  border-color: var(--line);
  position: relative;
}
.tab.active::after {        /* hide the tab strip's bottom line under the active tab */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: calc(var(--bw) * -1);
  height: var(--bw);
  background: var(--paper);
}
.tab .lock { opacity: 0.8; }

.list-pane { animation: pane-in 0.35s steps(4); }
.list-pane.hidden { display: none; }
@keyframes pane-in {
  0%   { opacity: 0; clip-path: inset(0 0 100% 0); }
  100% { opacity: 1; clip-path: inset(0 0 0 0); }
}

.proj-row {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 16px 12px;
  border-bottom: 1.5px dashed color-mix(in srgb, var(--line) 40%, transparent);
}
.proj-row:last-child { border-bottom: none; }
.proj-row.static { grid-template-columns: 40px 1fr; }
@media (hover: hover) {
  .proj-row:hover { background: color-mix(in srgb, var(--hl) 7%, transparent); }
}

/* thumbnails: the real image, uncropped, in a plain frame */
.proj-thumb {
  --tw: 112px; --th: 78px;
  width: var(--tw); height: var(--th);
  display: grid;
  place-items: center;
}
.thumb-frame {
  display: block;
  line-height: 0;
  border: var(--bw) solid var(--line);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--line) 35%, transparent);
}
.thumb-frame img {
  display: block;
  width: auto; height: auto;
  max-width: calc(var(--tw) - 2 * var(--bw) - 3px);
  max-height: calc(var(--th) - 2 * var(--bw) - 3px);
}
.proj-thumb.empty {
  border: var(--bw) solid var(--line);
  background: repeating-linear-gradient(45deg, var(--accent) 0 1.5px, transparent 1.5px 6px);
}

.proj-idx {
  font-family: var(--font-pixel);
  font-size: 14px;
  color: var(--accent);
  align-self: start;
  padding-top: 2px;
}

.proj-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.proj-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  color: var(--ink);
}
.proj-desc { font-size: 14px; line-height: 1.6; color: var(--ink-2); max-width: 720px; }
.proj-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.proj-tags { display: flex; flex-wrap: wrap; gap: 4px; }   /* chip style shared with .interest-tags */

.proj-links { display: flex; gap: 6px; }
.proj-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  padding: 3px 4px;
}
.proj-link:hover { background: var(--hl); color: var(--paper); }

.denied { padding: 36px 0 20px; display: flex; justify-content: center; }
.denied-win { width: min(380px, 100%); --drop: 4px; }

/* ============================================================
   INTERESTS — a structured index, no window chrome
   ============================================================ */
.int-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: var(--bw) solid var(--line);
  border-bottom: var(--bw) solid var(--line);
}
.int {
  padding: 24px 36px 30px;
  border-left: 1.5px dashed color-mix(in srgb, var(--line) 45%, transparent);
  transition: background 0.15s;
}
/* 2×2: dashed divider between the columns and between the rows */
.int:nth-child(odd) { border-left: none; padding-left: 0; }
.int:nth-child(even) { padding-right: 0; }
.int:nth-child(n+3) { border-top: 1.5px dashed color-mix(in srgb, var(--line) 45%, transparent); }
@media (hover: hover) {
  .int:hover { background: color-mix(in srgb, var(--hl) 5%, transparent); }
}
.int-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 22px;
  font-family: var(--font-pixel);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.int-idx { color: var(--accent); font-size: 12px; }

.interest-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 26px;
  color: var(--accent);
  text-shadow: var(--glow);
}
.interest-tags { display: flex; flex-wrap: wrap; align-items: flex-start; align-content: flex-start; gap: 4px; margin-top: 8px; }
.interest-tags span,
.proj-tags span {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--muted) 60%, transparent);
}
.interest-desc { font-size: 14px; line-height: 1.7; color: var(--ink-2); margin-top: 14px; max-width: 520px; }

/* person.json refuses to close: shake + a system error */
.win.shake { animation: shake 0.36s steps(6); }
@keyframes shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -7px 0; }
  40% { translate: 6px 0; }
  60% { translate: -4px 0; }
  80% { translate: 3px 0; }
}

.sys-error {
  position: fixed;
  top: 50%; left: 50%;
  translate: -50% -50%;
  width: min(340px, calc(100vw - 32px));
  z-index: 200;
  --drop: 8px;
  animation: err-in 0.18s steps(3);
}
.sys-error[hidden] { display: none; }
.sys-error p { white-space: pre-line; }
@keyframes err-in {
  0%   { clip-path: inset(45% 0 45% 0); }
  50%  { clip-path: inset(10% 0 60% 0); translate: calc(-50% + 6px) -50%; }
  100% { clip-path: inset(0 0 0 0); }
}

/* ============================================================
   CONTACT — keyboard
   ============================================================ */
.contact-container { display: flex; flex-direction: column; align-items: center; }
.contact-header { text-align: center; }

.keyboard-wrap { position: relative; padding-top: 10px; }

.keyboard {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  background: var(--paper);
  border: var(--bw) solid var(--line);
  box-shadow: var(--drop) var(--drop) 0 var(--shadow);
  /* dotted deck under the keys */
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 5px 5px;
}

.krow { display: flex; gap: 10px; justify-content: center; }

.key {
  width: 54px; height: 54px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 7px 9px;
  background: var(--paper);
  border: var(--bw) solid var(--line);
  border-radius: 3px;
  box-shadow: 0 5px 0 var(--line);
  font-family: var(--font-pixel);
  font-size: 13px;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 0.05s, box-shadow 0.05s;
}
.key:hover { background: color-mix(in srgb, var(--hl) 12%, var(--paper)); }
.key:active,
.key.pressed {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--line);
}
.key.special {
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--accent);
  color: var(--paper);
}
.key.special:hover { filter: brightness(1.12); }
.key.wide { width: 86px; }
.key.space {
  width: 360px;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  text-transform: none;
  font-size: 12px;
  color: var(--muted);
}
.key.space:hover { color: var(--hl); }

/* cat easter egg: peeks from behind the keyboard */
.cat-peek {
  position: absolute;
  top: -34px;
  left: 64px;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  transform: translateY(46px);
  transition: transform 0.35s steps(5);
  pointer-events: none;
}
.cat-peek.show { transform: translateY(0); }
#cat-svg .c-b { fill: var(--cat); }
#cat-svg .c-w { fill: var(--paper); }
#cat-svg .c-a { fill: var(--accent); }
.cat-meow {
  font-family: var(--font-pixel);
  font-size: 10px;
  color: var(--paper);
  background: var(--hl);
  border: 1.5px solid var(--line);
  padding: 1px 6px;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.1s 0.3s;
}
.cat-peek.show .cat-meow { opacity: 1; }

/* backspace easter egg */
body.glitching main,
body.glitching section { animation: page-glitch 0.45s steps(1) 1; }
@keyframes page-glitch {
  0%   { transform: translate(0, 0); filter: none; }
  15%  { transform: translate(-8px, 0); filter: hue-rotate(90deg) saturate(2); clip-path: inset(10% 0 60% 0); }
  30%  { transform: translate(10px, 2px); filter: invert(1); clip-path: none; }
  45%  { transform: translate(-3px, -2px); filter: none; clip-path: inset(40% 0 20% 0); }
  60%  { transform: translate(6px, 0); filter: hue-rotate(-60deg); clip-path: none; }
  80%  { transform: translate(-2px, 1px); filter: invert(1) hue-rotate(180deg); }
  100% { transform: translate(0, 0); filter: none; }
}

/* ============================================================
   TASKBAR / FOOTER
   ============================================================ */
.taskbar {
  margin-top: 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 36px;
  padding: 0 16px;
  background: var(--paper);
  border-top: var(--bw) solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

/* ── Focus ── */
:focus { outline: none; }
:focus-visible { outline: 2px dashed var(--hl); outline-offset: 3px; }

/* ── Reduced motion ── */
body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation: none !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* the hero windows only fit side by side from ~1160px */
@media (max-width: 1160px) {
  .hero-grid { min-height: 0; display: flex; flex-direction: column; gap: 26px; }
  .win-float { position: static; }
  .f-news { width: auto; max-width: 380px; }
}

@media (max-width: 900px) {
  .win-hero { max-width: none; }
  /* the name always stays on one line */
  .code-name, .glitch-layer { font-size: clamp(30px, 10.5vw, 56px); }

  /* interests: one row per interest, label column + text column */
  .int-grid { grid-template-columns: 1fr; }
  .int, .int:nth-child(odd), .int:nth-child(even) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 36px;
    align-content: start;
    padding: 24px 0 26px;
    border-left: none;
  }
  .int + .int { border-top: 1.5px dashed color-mix(in srgb, var(--line) 45%, transparent); }
  .int .interest-desc { grid-column: 2; grid-row: 1 / span 3; margin-top: 0; max-width: none; }
  .int-head { margin-bottom: 14px; }
}

@media (max-width: 700px) {
  .container { padding: 0 16px; }
  section { padding: 28px 0; }
  #hero { padding: 28px 0 60px; align-items: flex-start; }
  .win-hero .win-body { padding: 20px 18px; }
  .win-body { padding: 18px 16px; }
  .code-block { font-size: 13px; line-height: 1.9; }
  .code-line, .code-line-name { margin-left: 14px; }

  /* menu bar: section links stay, toggles collapse to icons */
  .menubar { gap: 8px; padding: 0 10px; }
  .mb-links a { padding: 4px 6px; font-size: 11px; }
  .mb-btn .mb-text, .mb-clock { display: none; }
  .mb-ico { display: inline; }
  .mb-btn { padding: 4px 6px; }

  .int, .int:nth-child(odd), .int:nth-child(even) { display: block; padding: 22px 0 26px; }
  .int .interest-desc { margin-top: 14px; }
  .int-head { margin-bottom: 18px; }

  .proj-row { grid-template-columns: 72px 1fr; gap: 14px; padding: 14px 4px; align-items: start; }
  .proj-row .proj-thumb { --tw: 72px; --th: 56px; }
  .proj-links { grid-column: 2; }
  .tab { padding: 7px 10px; font-size: 11px; }
  .win-status span:nth-child(n+2):not(:last-child) { display: none; }
}

@media (max-width: 480px) {
  .mb-logo .mb-text { display: none; }
  /* small phones: thumbnail above the text so the text gets the full width */
  .proj-row { grid-template-columns: 1fr; gap: 10px; }
  .proj-row .proj-thumb { --tw: 150px; --th: 96px; place-items: center start; }
  .proj-links { grid-column: 1; }
}

/* phones: the contact keyboard becomes fluid like a real phone keyboard */
@media (max-width: 560px) {
  .keyboard-wrap { width: 100%; }
  .keyboard { padding: 12px 6px; gap: 8px; }
  .krow { gap: 4px; }
  .key {
    flex: 0 0 calc((100% - 36px) / 10);
    width: auto;
    height: 46px;
    padding: 6px 0 0;
    justify-content: center;
    font-size: 12px;
  }
  .key.special { padding: 0; }
  .key.special svg { width: 20px; height: 20px; }
  .key.wide { flex-basis: calc((100% - 36px) / 10 * 2 + 4px); }
  .key.space { flex-basis: 64%; width: auto; }
  .cat-peek { left: 24px; }
}

/* touch screens: bigger tap targets */
@media (pointer: coarse) {
  .menubar { height: 44px; }
  .mb-links a, .mb-btn { padding-top: 9px; padding-bottom: 9px; }
  .win-x { width: 28px; height: 28px; font-size: 15px; }
  .proj-link { padding: 9px 6px; }
  .tab { padding-top: 10px; padding-bottom: 10px; }
}
