/* =====================================================================
   Han Lwin Htoo — Portfolio
   One section per screen. Black & white theme with a soft light behind each
   screen and a faint film grain. (The Home terminal keeps its own classic
   green Linux-shell colours, see section 6.)
   Edit colors in the two theme blocks below; everything else reads them.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --container: 1100px;
  --topbar: 68px;
  --ease: cubic-bezier(.22, .61, .36, 1);   /* smooth ease-out */

  /* Dark: black (pages switch to the light theme below by default, see the <head> script) */
  --bg: #000000;
  --bg-alt: #0a0a0a;         /* every other screen */
  --surface: #141414;        /* tiles, panels */
  --border: #262626;
  --text: #ffffff;
  --muted: #a3a3a3;
  --faint: #6b6b6b;
  --accent: #ffffff;         /* buttons, labels, active states */
  --accent-strong: #d4d4d4;  /* tag text, primary button hover */
  --on-accent: #000000;      /* text on a white fill */
  --accent-soft: rgba(255, 255, 255, 0.08);
  --glow: rgba(255, 255, 255, 0.045); /* soft light behind each screen */
  --grain: 0.05;             /* film-grain strength */
  --ok: #4ade80;             /* status dot: terminal prompt green */
  --mark: rgba(255, 255, 255, 0.18);
  --sweep: #ffffff;          /* hover fill: menu, contact rows, skill tiles */
  --on-sweep: #000000;       /* text on that fill */
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --surface: #efefef;        /* slightly grey so tiles stand out without borders */
  --border: #e5e5e5;
  --text: #000000;
  --muted: #525252;
  --faint: #8a8a8a;
  --accent: #000000;
  --accent-strong: #262626;
  --on-accent: #ffffff;
  --accent-soft: rgba(0, 0, 0, 0.05);
  --glow: rgba(0, 0, 0, 0.03);
  --grain: 0.035;
  --ok: #22c55e;             /* status dot: slightly deeper green for white */
  --mark: rgba(0, 0, 0, 0.1);
  --sweep: #000000;          /* black in light mode */
  --on-sweep: #ffffff;
  color-scheme: light;
}

/* Theme switch: script.js cross-fades the whole page at once (View Transitions) */
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: .45s;
  animation-timing-function: cubic-bezier(.22, .61, .36, 1);
}
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol { margin: 0; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

mark.todo { background: var(--mark); color: inherit; padding: 0 3px; border-radius: 3px; }

.skip-link { position: absolute; left: -999px; top: 12px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 12px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 32px; }

/* ---------- 3. Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--topbar);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar-inner {
  max-width: var(--container); height: 100%; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; gap: 32px;
}
.brand { font-weight: 600; letter-spacing: -0.01em; margin-right: auto; }
.nav-links { display: flex; align-self: stretch; font-size: 15px; }
/* Links: full-height segments of the bar separated by thin lines; a fill
   sweeps in from the left on hover, like the contact rows
   (white in dark mode, black in light mode via --sweep / --on-sweep) */
.nav-links a {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; padding: 0 18px;
  color: var(--muted);
  transition: color .4s var(--ease);
}
.nav-links a + a { border-left: 1px solid var(--border); }
.nav-links a::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--sweep);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .4s var(--ease);
}
.nav-links a:hover::before, .nav-links a.tap::before { transform: scaleX(1); }
.nav-links a.active { color: var(--text); }
.nav-links a:hover, .nav-links a.tap { color: var(--on-sweep); }
/* Current section: accent line along the bottom of its segment */
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--accent);
  transform: scaleX(0); transition: transform .3s var(--ease);
}
.nav-links a.active::after { transform: scaleX(1); }
.nav-links a:hover::after, .nav-links a.tap::after { transform: scaleX(0); }

.theme-toggle {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  background: var(--surface); border: 0; border-radius: 50%;
  color: var(--muted); cursor: pointer; transition: color .15s, background-color .15s;
}
.theme-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.theme-icon {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

/* Menu button: phones only. Two lines that turn into an X when open. */
.menu-toggle {
  display: none; place-items: center;
  width: 36px; height: 36px; padding: 0;
  background: var(--surface); border: 0; border-radius: 50%;
  color: var(--text); cursor: pointer;
}
.menu-lines { position: relative; width: 16px; height: 10px; }
.menu-lines i {
  position: absolute; left: 0; width: 100%; height: 1.5px; border-radius: 2px;
  background: currentColor;
  transition: transform .3s var(--ease), top .3s var(--ease);
}
.menu-lines i:first-child { top: 0; }
.menu-lines i:last-child { top: 8.5px; }
.nav-open .menu-lines i:first-child { top: 4.25px; transform: rotate(45deg); }
.nav-open .menu-lines i:last-child { top: 4.25px; transform: rotate(-45deg); }

/* ---------- 4. Side dots ---------- */
.dots {
  position: fixed; right: 28px; top: 50%; transform: translateY(-50%); z-index: 40;
  display: flex; flex-direction: column; gap: 14px;
}
.dots a {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  transition: background .2s, transform .2s;
}
.dots a:hover { background: var(--muted); }
.dots a.active { background: var(--accent); transform: scale(1.4); }

/* ---------- 5. Screens ---------- */
.screen {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(var(--topbar) + 40px) 0 64px;
}
.screen:nth-of-type(even) { background: var(--bg-alt); }

/* Soft accent light behind each screen, alternating corners */
.screen { isolation: isolate; }
.screen::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(55% 60% at 12% 22%, var(--glow), transparent 70%);
}
.screen:nth-of-type(even)::before {
  background: radial-gradient(55% 60% at 88% 78%, var(--glow), transparent 70%);
}

/* Faint film grain over the whole page, so flat colours feel less digital */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 200; pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.kicker { font-size: 14px; font-weight: 500; color: var(--accent); margin-bottom: 12px; }
h2 { font-size: clamp(30px, 4vw, 44px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; margin-bottom: 48px; }
h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span {
  font-size: 13px; font-weight: 500;
  padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-strong);
}

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px;
  font-weight: 500; font-size: 15px;
  border: 0; background: var(--surface); color: var(--text);
  transition: background-color .35s var(--ease), color .35s var(--ease), transform .35s var(--ease);
}
/* Secondary buttons fill with the accent on hover */
.btn:hover { background: var(--accent); color: var(--on-accent); transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 30px -12px var(--accent); }
.btn-primary:hover { background: var(--accent-strong); color: var(--on-accent); }

/* ---------- 6. Home ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 64px; align-items: center; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--muted);
  padding: 6px 14px; background: var(--surface); border-radius: 999px;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
  100% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--ok) 0%, transparent); }
}
h1 { font-size: clamp(40px, 6vw, 68px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.05; margin-top: 28px; }
/* Hero headline: a short greeting, then a muted second line */
.hero-sub { display: block; max-width: 15em; margin-top: 10px; color: var(--faint); font-size: 0.6em; line-height: 1.12; }
/* Studies line under the headline (the dot stays at the end of a line when it wraps) */
/* Typed words at the end of the headline (script.js, section 8) */
.hero-sub { min-height: 2.24em; } /* room for two lines, so the page doesn't jump as words change */
.type-words { display: block; min-height: 1.12em; } /* typed words always start on line two */
.type-words::after {
  content: ""; display: inline-block; width: 0.08em; height: 0.9em; margin-left: 0.06em;
  vertical-align: -0.08em; background: currentColor; animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
/* Text for screen readers only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hero-meta { margin-top: 24px; font-size: 16px; color: var(--muted); }
.hero-meta .sep { color: var(--faint); }
.sp-logo { height: 26px; width: auto; vertical-align: middle; margin-left: 4px; }
.sp-logo--light { display: none; }
:root[data-theme="light"] .sp-logo--light { display: inline-block; }
:root[data-theme="light"] .sp-logo--dark { display: none; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.7; margin-top: 24px; max-width: 560px; }

/* Cartoon avatar beside the status pill. A ring with a page-coloured gap
   frames the white drawing on the dark theme; on hover the ring turns
   accent and the avatar lifts slightly. */
.hero-top { display: flex; align-items: center; gap: 18px; }
.avatar {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover; flex: none;
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--border);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.avatar:hover, .avatar.tap {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent);
}

/* Terminal window. Always dark, in both themes, in classic Linux-shell colours
   (bold green prompt + cursor). Lifted slightly above the black page.
   Change the --t-* values to retheme it. */
.terminal {
  --t-bg: #111111; --t-bar: #1c1c1c; --t-dot: #3a3a3a;
  --t-prompt: #4ade80; --t-key: #86efac;
  --t-text: #e8e8e8; --t-dim: #8a8a8a; --t-faint: #5c5c5c;
  width: 100%; max-width: 480px; justify-self: end;
  background: var(--t-bg);
  border-radius: 12px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6), 0 0 60px -20px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.75;
  color: var(--t-text);
}
.term-bar {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: 36px; background: var(--t-bar);
}
.term-dots { position: absolute; left: 14px; display: flex; gap: 7px; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--t-dot); }
.term-title { font-size: 12px; color: var(--t-dim); }
.term-body { padding: 16px 18px 18px; min-height: 290px; }
.term-body p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
/* Classic Linux shell: bold green prompt and cursor, light-green YAML keys */
.t-ps { color: var(--t-prompt); font-weight: 600; }
.t-text { color: var(--t-text); }
.t-out { color: var(--t-dim); }
.t-key { color: var(--t-key); }
.t-ls { display: flex; flex-wrap: wrap; column-gap: 18px; }
.t-cursor {
  display: inline-block; width: 8px; height: 1.1em; margin-left: 1px; vertical-align: -0.2em;
  background: var(--t-prompt);
  animation: t-blink 1.1s steps(1) infinite;
}
@keyframes t-blink { 50% { opacity: 0; } }
/* While typing, hidden lines take no space (script.js toggles .t-hide) */
.t-hide { display: none; }

.scroll-hint {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  font-size: 13px; color: var(--faint); transition: color .15s;
}
.scroll-hint:hover { color: var(--accent); }

/* ---------- 7. Skills: icon tiles ---------- */
.skills-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 32px; }
.skills-head h2 { margin-bottom: 0; }
.skills-head .lead { margin: 0; max-width: 340px; font-size: 15px; text-align: right; }

.tiles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 12px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 104px; padding: 14px 8px;
  text-align: center;
  transition: transform .35s var(--ease);
}
.tile-name { font-size: 12.5px; font-weight: 500; line-height: 1.3; color: var(--muted); transition: color .35s var(--ease); }
/* Hover: no box; the tile lifts, the icon grows and the name brightens */
.tile:hover, .tile.tap { transform: translateY(-4px); }
.tile:hover .tile-name, .tile.tap .tile-name { color: var(--text); }
.tile:hover .ico, .tile.tap .ico { transform: scale(1.18); }

/* "Studying" tiles: small label above the icon */
.tile-note {
  position: absolute; top: 4px; left: 0; right: 0;
  font-size: 10px; font-weight: 500;
  color: var(--faint);
}

/* Icons: SVGs used as masks. Brand logos use their official colour (--brand,
   from simple-icons.org); near-black brands and generic symbols follow the theme.
   Brand logos: Simple Icons; generic ones: Phosphor. Both from jsDelivr. */
.ico {
  width: 30px; height: 30px; flex: none;
  background: var(--brand, currentColor); /* brand colour if set, else follows the theme */
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
  transition: transform .35s var(--ease);
}
.i-proxmox   { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/proxmox.svg"); --brand: #E57000; }
.i-ubuntu    { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/ubuntu.svg"); --brand: #E95420; }
.i-bash      { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/gnubash.svg"); --brand: #4EAA25; }
.i-tailscale { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/tailscale.svg"); }
.i-git       { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/git.svg"); --brand: #F05032; }
.i-github    { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/github.svg"); }
.i-mqtt      { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/mqtt.svg"); --brand: #660066; }
.i-cisco     { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/cisco.svg"); --brand: #1BA0D7; }
.i-redhat    { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/redhat.svg"); --brand: #EE0000; }
.i-ssh       { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/key.svg"); }
.i-systemd   { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/gear-six.svg"); }
.i-tcpip     { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/tree-structure.svg"); }
.i-vlan      { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/network.svg"); }
.i-dns       { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/globe.svg"); }
.i-rtsp      { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/video-camera.svg"); }
.i-vmware    { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/stack.svg"); } /* VMware's own logo is a wide wordmark, too small in a tile */
.i-windows   { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/windows.svg"); --brand: #0078D4; }
.i-powershell { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/powershell.svg"); --brand: #5391FE; }
.i-ad        { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/users-three.svg"); }
.i-ospf      { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/path.svg"); }
.i-hsrp      { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/arrows-clockwise.svg"); }
.i-acl       { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/shield-check.svg"); }
.i-iis       { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/browser.svg"); }
.i-pki       { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/certificate.svg"); }
.i-storage   { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/regular/hard-drives.svg"); }
/* Contact row icons (filled logos, no brand colour: they follow the text colour) */
.i-mail      { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/gmail.svg"); }
.i-linkedin  { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@11/icons/linkedin.svg"); }
.i-doc       { --icon: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2/assets/fill/file-text-fill.svg"); }

/* ---------- 7b. Project screens (one project per screen) ---------- */
.project-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: center; }
/* Labels above a project title: the project type first, then extras (e.g. a result) */
.project-labels { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.project-label {
  display: inline-block;
  font-size: 13px; font-weight: 500;
  color: var(--muted); padding: 4px 10px; background: var(--surface); border-radius: 999px;
}
/* Project type: outlined in the text colour so it reads first */
.project-type { color: var(--text); background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.project h2 { font-size: clamp(40px, 5.2vw, 68px); letter-spacing: -0.035em; line-height: 1.05; margin: 4px 0 0; }
.project .lead { margin-top: 20px; max-width: 520px; }
.project .tags { margin-top: 24px; }
.project .actions { margin-top: 32px; }

/* Giant outlined index number */
.project-index { justify-self: end; display: flex; align-items: baseline; gap: 6px; line-height: 0.8; user-select: none; }
.project-index .num {
  font-size: clamp(140px, 19vw, 280px); font-weight: 700; letter-spacing: -0.06em;
  /* Inter draws some digits (like 4) from overlapping shapes, so a plain outline shows lines
     inside them. Instead: a 3px stroke painted first, then a fill in the section's own
     background colour on top, which hides the inner lines and half the stroke (1.5px left). */
  color: var(--bg); -webkit-text-stroke: 3px var(--accent); paint-order: stroke fill;
}
.screen:nth-of-type(even) .project-index .num { color: var(--bg-alt); }
.project-index .of { font-size: 16px; color: var(--faint); }

/* ---------- 8. Education ---------- */
/* Roadmap: a vertical track with a dot for each milestone */
.timeline { list-style: none; padding: 0; max-width: 860px; position: relative; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 24px; padding: 0 0 48px 32px; position: relative; }
.timeline li:last-child { padding-bottom: 0; }
/* Track: one segment per entry, running from its dot's centre (13px) to the
   next entry's dot centre, so the line stops at the last dot */
.timeline li:not(:last-child)::after {
  content: ""; position: absolute; left: 4px; top: 13px; bottom: -13px; width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--accent), color-mix(in srgb, var(--accent) 15%, transparent));
}
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 8px; z-index: 1;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--bg), 0 0 14px 5px var(--accent-soft); /* gap ring + soft glow */
}
.years { font-size: 15px; font-weight: 500; color: var(--accent); padding-top: 2px; }
.timeline h3 { font-size: 20px; }
.timeline p { color: var(--muted); margin-top: 6px; }
.timeline .tags { margin-top: 14px; }

/* ---------- 9. Contact ---------- */
.contact { display: grid; grid-template-columns: 0.85fr 1.35fr; gap: 56px; align-items: center; }
.contact h2 { margin-bottom: 0; }
.contact .lead { margin-top: 20px; max-width: 440px; }

/* Availability details */
.contact-facts { margin: 36px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; max-width: 440px; }
.contact-facts dt { font-size: 13px; color: var(--faint); }
.contact-facts dd { margin: 4px 0 0; font-weight: 500; }

/* Contact rows: full-width lines; a solid black fill sweeps in on hover */
.contact-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.contact-row {
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  border-bottom: 1px solid var(--border);
}
/* Fill sweeps in from the left and back out to the left. The origin stays
   fixed: swapping it on hover-out made a half-finished sweep jump sides. */
.contact-row::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--sweep);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .4s var(--ease);
  will-change: transform;
}
.contact-row:hover::before, .contact-row.tap::before { transform: scaleX(1); }

.row-link {
  display: grid; grid-template-columns: 24px 68px 1fr auto; align-items: center; gap: 14px;
  padding: 26px 20px;
  color: var(--text);
  transition: color .4s var(--ease), padding .4s var(--ease);
}
.row-link:focus-visible { outline: none; }
.row-label { font-size: 13px; color: var(--faint); transition: color .4s var(--ease), opacity .4s var(--ease); }
.row-value { font-size: clamp(17px, 1.6vw, 21px); font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.row-arrow { font-size: 20px; transition: transform .5s var(--ease); }
.row-ico { width: 24px; height: 24px; color: var(--text); transition: color .4s var(--ease); }

.contact-row:hover .row-link, .contact-row.tap .row-link { color: var(--on-sweep); padding-left: 28px; }
.contact-row:hover .row-label, .contact-row.tap .row-label { color: var(--on-sweep); opacity: .6; }
.contact-row:hover .row-arrow, .contact-row.tap .row-arrow { transform: translate(3px, -3px); }
.contact-row:hover .row-ico, .contact-row.tap .row-ico { color: var(--on-sweep); }

.copy-btn {
  margin-right: 20px;
  padding: 7px 14px; border-radius: 999px;
  font: 500 13px var(--font);
  background: var(--accent-soft); color: var(--text);
  border: 0; cursor: pointer;
  transition: color .35s var(--ease), background-color .35s var(--ease);
}
.contact-row:hover .copy-btn, .contact-row.tap .copy-btn { color: var(--on-sweep); background: color-mix(in srgb, var(--on-sweep) 14%, transparent); }
.contact-row .copy-btn:hover { background: var(--on-sweep); color: var(--sweep); }
.copy-btn.copied { background: var(--on-sweep); color: var(--sweep); }

/* Keyboard (Tab) focus shows the same fill. Kept in separate rules so a
   browser without :has() still gets the hover effect above. Mouse clicks
   don't trigger it, so a clicked row doesn't stay filled. */
.contact-row:has(:focus-visible)::before { transform: scaleX(1); }
.contact-row:has(:focus-visible) .row-link { color: var(--on-sweep); padding-left: 28px; }
.contact-row:has(:focus-visible) .row-label { color: var(--on-sweep); opacity: .6; }
.contact-row:has(:focus-visible) .row-ico { color: var(--on-sweep); }
.contact-row:has(:focus-visible) .copy-btn { color: var(--on-sweep); background: color-mix(in srgb, var(--on-sweep) 14%, transparent); }

footer {
  position: absolute; left: 0; right: 0; bottom: 24px;
  max-width: var(--container); margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-size: 13px; color: var(--faint);
}
.back-top { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; transition: color .3s var(--ease); }
.back-top-arrow { display: inline-block; transition: transform .3s var(--ease); }
.back-top:hover { color: var(--accent); }
.back-top:hover .back-top-arrow { transform: translateY(-3px); }

/* ---------- 10. Scroll reveal ---------- */
/* Only hidden when JS runs (html.js), so the page still shows without it.
   script.js adds .in when a screen scrolls into view; --i staggers items. */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  /* Hiding (screen left the window) is instant, so it's ready to replay */
  transition: opacity 0s, transform 0s;
}
.js .screen.in .reveal {
  opacity: 1; transform: none;
  transition: opacity .55s var(--ease), transform .55s var(--ease);
  transition-delay: calc(var(--i, 0) * 45ms);
}
/* Skill rows keep their own hover transition once revealed */
.js .screen.in .tile.reveal { transition: opacity .5s var(--ease) calc(var(--i, 0) * 25ms), transform .5s var(--ease); }
.js .screen.in .tile.reveal:hover, .js .screen.in .tile.reveal.tap { transform: translateY(-4px); }

/* ---------- 11. Smaller screens ---------- */
/* Shorter laptop windows: tighten spacing so every section fits one screen */
@media (min-width: 761px) and (max-height: 900px) {
  .screen { padding: calc(var(--topbar) + 20px) 0 36px; }
  h2 { font-size: clamp(28px, 3.4vw, 38px); margin-bottom: 28px; }
  .skills-head { margin-bottom: 24px; }
  .tile { min-height: 90px; padding: 12px 8px; gap: 8px; }
  .ico { width: 26px; height: 26px; }
  .timeline li { padding-bottom: 32px; }
}
/* Side dots need a free margin beside the content */
@media (max-width: 1200px) {
  .dots { display: none; }
}

/* Tablets (portrait iPad etc.): give the terminal more room and smaller text */
@media (min-width: 761px) and (max-width: 1023px) {
  .hero { grid-template-columns: 1.1fr 1fr; gap: 32px; }
  .terminal { font-size: 12px; line-height: 1.7; }
  .term-body { padding: 14px 14px 16px; min-height: 0; }
}

@media (max-width: 960px) {
  .contact { grid-template-columns: 1fr; gap: 48px; }
  .tiles { grid-template-columns: repeat(6, 1fr); }
  /* Project screens: number moves above the text */
  .project-grid { grid-template-columns: 1fr; gap: 16px; }
  .project-index { order: -1; justify-self: start; }
  .project-index .num { font-size: clamp(88px, 18vw, 140px); }
}

@media (max-width: 760px) {
  :root { --topbar: 60px; }
  .container, .topbar-inner, footer { padding: 0 20px; }
  .topbar-inner { gap: 10px; }
  /* Section links become a side drawer that slides in from the right.
     Note: the top bar's backdrop-filter makes it the containing block for
     fixed children, so sizes use 100vw / 100dvh instead of inset: 0.
     script.js (1b) drives the swipe-to-open / swipe-to-close gestures. */
  .menu-toggle, .theme-toggle { position: relative; z-index: 3; } /* stay above the drawer */
  .menu-toggle { display: grid; }
  .topbar::before { /* dimmed page behind the drawer */
    content: ""; position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; z-index: 1;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0; visibility: hidden;
    transition: opacity .35s var(--ease), visibility .35s;
  }
  .nav-open::before { opacity: 1; visibility: visible; }
  .nav-links {
    position: fixed; top: 0; right: 0; z-index: 2;
    width: min(80vw, 320px); height: 100dvh;
    flex-direction: column; gap: 0;
    padding: calc(var(--topbar) + 24px) 0 32px;
    background: var(--bg-alt);
    box-shadow: -24px 0 60px -20px rgba(0, 0, 0, 0.6);
    transform: translateX(100%); visibility: hidden;
    transition: transform .35s var(--ease), visibility .35s;
    touch-action: pan-y;
  }
  .nav-open .nav-links { transform: none; visibility: visible; }
  .nav-links.dragging { transition: none; } /* follows the finger while swiping */
  /* Drawer rows: full width, separated by lines, square fill like the contact rows */
  .nav-links a { padding: 18px 28px; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); border-bottom: 1px solid var(--border); }
  .nav-links a:first-child { border-top: 1px solid var(--border); }
  .nav-links a + a { border-left: 0; }
  .nav-links a::after { display: none; } /* drawer shows the current section by colour instead */
  .nav-links a.active { color: var(--accent); }
  .nav-links a.active:hover, .nav-links a.active.tap { color: var(--on-sweep); }
  .screen { padding: calc(var(--topbar) + 32px) 0 72px; }
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .terminal { justify-self: stretch; max-width: none; }
  h1 { margin-top: 20px; }
  .scroll-hint { display: none; }
  .skills-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .skills-head .lead { text-align: left; }
  .tiles { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  h2 { margin-bottom: 32px; }
  .row-link { grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 18px 12px; }
  .row-ico { grid-row: 1 / span 2; }
  .contact-row:hover .row-link, .contact-row.tap .row-link { padding-left: 16px; }
  .copy-btn { margin-right: 12px; }
  .row-label { grid-column: 2 / -1; }
  .avatar { width: 72px; height: 72px; }
  /* Phone hero: avatar on top, everything centred */
  .hero-text { text-align: center; }
  .hero-top { flex-direction: column; gap: 16px; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero .actions { justify-content: center; }
}

/* Education timeline: date stacks above the entry; the track stays on the left */
@media (max-width: 767px) {
  .timeline li { grid-template-columns: 1fr; gap: 4px; padding-left: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transition: none; transform: none; }
  .t-cursor { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .status .dot { animation: none; }
  .type-words::after { animation: none; }
  .avatar:hover, .avatar.tap { transform: none; }
}

/* ---------- 12. Project pages (projects/*.html) ----------
   Normal scrolling pages (no screens), sharing the tokens and components above. */
.page { padding: calc(var(--topbar) + 40px) 0 56px; }
.page h1 { margin-top: 0; }
.page-head .lead { max-width: 640px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 28px;
  font-size: 14px; font-weight: 500; color: var(--muted);
  transition: color .3s var(--ease);
}
.back-link:hover { color: var(--accent); }
.page-footer {
  position: static; display: flex; justify-content: space-between; align-items: center;
  max-width: var(--container); margin: 0 auto; padding: 24px 32px 32px;
  border-top: 1px solid var(--border);
  font-size: 14px; color: var(--muted);
}

/* Case study header: title, summary and facts on the left, hero image on the right */
.cs-head { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; }
.cs-head h1 { font-size: clamp(38px, 5vw, 64px); letter-spacing: -0.035em; line-height: 1.05; }
.facts {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 24px;
  margin: 32px 0 0; padding-top: 24px; border-top: 1px solid var(--border);
}
.facts > div:last-child:nth-child(odd) { grid-column: 1 / -1; } /* odd count: last item spans the row */
.facts dt { font-size: 13px; color: var(--faint); }
.facts dd { margin: 3px 0 0; font-weight: 500; }
.facts a { border-bottom: 1px solid var(--border); transition: border-color .3s var(--ease); }
.facts a:hover { border-color: var(--text); }

/* Images: <figure class="shot"> > <div class="media"> > <img> (or a placeholder) + caption.
   .media crops every image to the same shape, so rows and the gallery line up. */
.shot { margin: 0; }
.media { position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: var(--surface); }
.media img, .media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media img { cursor: zoom-in; transition: transform .6s var(--ease); }
.media img:hover { transform: scale(1.02); }
/* .media--natural: show the whole image at its own shape (wide screenshots) */
.media--natural { aspect-ratio: auto; }
.media--natural img { height: auto; }
.shot figcaption { margin-top: 12px; font-size: 14px; color: var(--faint); text-align: center; }
.shot-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  font-size: 14px; color: var(--faint);
  background-image:
    linear-gradient(color-mix(in srgb, var(--border) 70%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--border) 70%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Hero image beside the title */
.cs-hero .media { aspect-ratio: 4 / 3; border-radius: 20px; }
/* Portrait hero (e.g. a poster): shown whole, in a narrower column */
.cs-head:has(.cs-hero--portrait) { grid-template-columns: 1.4fr 1fr; }
.cs-hero--portrait { justify-self: end; width: 100%; max-width: 440px; }
.cs-hero--portrait .media { aspect-ratio: auto; border-radius: 14px; }
.cs-hero--portrait .media img { height: auto; }

/* Feature rows: text beside an image; .flip puts the image on the left */
.cs-row { display: grid; grid-template-columns: 1fr 1.15fr; gap: 40px; align-items: center; margin-top: 56px; }
.cs-row.flip { grid-template-columns: 1.15fr 1fr; }
.cs-row.flip .cs-section { order: 2; }
.cs-block { margin-top: 64px; }

/* Text inside a section */
.cs-section h2, .cs-block h2 { margin-bottom: 20px; font-size: clamp(28px, 3.2vw, 40px); }
.cs-section p, .cs-section li, .cs-block > p { color: var(--muted); line-height: 1.75; }
.cs-section p + p, .cs-section ul + p, .cs-section ol + p { margin-top: 16px; }
.cs-section ul, .cs-section ol { padding-left: 22px; margin-top: 16px; }
.cs-section li + li { margin-top: 8px; }
.cs-section strong { color: var(--text); font-weight: 600; }
.cs-narrow { max-width: 720px; }

/* Gallery: the first image spans the full width, the rest sit two per row */
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; margin-top: 24px; }
.gallery .shot:first-child { grid-column: 1 / -1; }
.gallery .shot:first-child .media { aspect-ratio: 16 / 9; }

/* Next project: a large link card at the end of the page */
.next-project {
  display: grid; grid-template-columns: 1fr 280px; gap: 32px; align-items: center;
  margin-top: 64px; padding: 32px; border-radius: 20px; background: var(--surface);
  transition: transform .35s var(--ease);
}
.next-project:hover { transform: translateY(-4px); }
.next-label { font-size: 14px; color: var(--faint); }
.next-title { display: block; margin-top: 8px; font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.next-arrow { display: inline-block; transition: transform .35s var(--ease); }
.next-project:hover .next-arrow { transform: translateX(6px); }
.next-project .media img { cursor: pointer; }
.next-project .media { display: block; aspect-ratio: 16 / 10; border-radius: 12px; background: var(--bg-alt); }
.cs-links { margin-top: 32px; }

/* Commands / config snippets: always dark, like the Home terminal */
.code {
  margin: 20px 0 0; padding: 18px 20px; border-radius: 12px; overflow-x: auto;
  background: #0d0d0d; color: #e5e5e5; border: 1px solid #262626;
  font: 13px/1.7 var(--mono);
}

/* Diagrams drawn in inline SVG (e.g. windows-server.html): follow the theme colours */
.diagram { padding: 20px; }
.cs-hero .media.diagram { aspect-ratio: auto; } /* the diagram sets its own height */
.diagram svg { display: block; width: 100%; height: auto; }
.dg-box { fill: var(--bg); stroke: var(--border); stroke-width: 1.5; }
.dg-box.dg-me { stroke: var(--text); stroke-width: 2; }
.dg-line { fill: none; stroke: var(--faint); stroke-width: 2; }
.dg-dash { stroke-dasharray: 6 5; }
.dg-serial { stroke: var(--text); stroke-width: 3; stroke-linejoin: miter; } /* zigzag = serial link */
.dg-name { fill: var(--text); font: 600 15px var(--font); }
.dg-ip { fill: var(--muted); font: 12px var(--font); }
.dg-role { fill: var(--muted); font: 13px var(--font); }
.dg-label { fill: var(--faint); font: 12px var(--font); }
.dg-pill { fill: var(--text); }
.dg-pill-text { fill: var(--bg); font: 600 10px var(--font); letter-spacing: 0.06em; }
.dg-head { fill: var(--text); font: 600 16px var(--font); }
.dg-sm { font-size: 13px; }
.dg-zone { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 7 6; }
/* Server and PC icons (<symbol>s drawn with these classes) */
.dg-ico { fill: var(--bg); stroke: var(--text); stroke-width: 3.5; stroke-linejoin: round; }
.dg-ico-line { fill: none; stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
.dg-ico-fill { fill: var(--text); }
.dg-ico-cut { fill: none; stroke: var(--bg); stroke-width: 3; stroke-linecap: round; }
.dg-ico-dot { fill: var(--bg); }
@media (max-width: 760px) { .diagram { padding: 10px; } }

/* Screenshots: shown whole (.media--natural) in a thin frame so white windows
   don't melt into a white page */
.shot--screen .media { border: 1px solid var(--border); border-radius: 12px; }
.shot--small { justify-self: center; width: 100%; max-width: 420px; } /* keeps small images near their real size */


/* Headline numbers under the header */
.cs-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 48px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.cs-stats > div { padding: 28px 24px; }
.cs-stats > div:first-child { padding-left: 0; }
.cs-stats > div + div { border-left: 1px solid var(--border); }
.stat-num { display: block; font-size: clamp(40px, 5vw, 60px); font-weight: 700; letter-spacing: -0.045em; line-height: 1; }
.stat-label { display: block; margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* Feature rows: numbered text beside the screenshot that shows it */
.cs-feature { margin-top: 48px; }
.cs-block + .cs-feature { margin-top: 8px; } /* first row sits right under its section heading */
.feature-num { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 500; color: var(--faint); }
.cs-section h3 { margin-bottom: 14px; font-size: clamp(22px, 2.4vw, 28px); letter-spacing: -0.02em; line-height: 1.2; }
.cs-section .card-tags { margin-top: 18px; font-size: 14px; color: var(--faint); }

/* Plain-language table (e.g. who can use each folder); scrolls sideways on phones */
.cs-table-wrap { margin-top: 40px; overflow-x: auto; }
.cs-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 15px; }
.cs-table caption { margin-bottom: 14px; text-align: left; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.cs-table th, .cs-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.cs-table thead th { font-size: 13px; font-weight: 500; color: var(--faint); }
.cs-table tbody th { font-weight: 600; color: var(--text); }
.cs-table td { color: var(--muted); line-height: 1.5; }
.cs-table-note { margin-top: 12px; font-size: 14px; color: var(--faint); }
/* Narrow table beside text in a .cs-row (instead of a screenshot) */
.cs-table-wrap--side { margin-top: 0; }
.cs-table--compact { min-width: 0; }
.cs-row + .fix-grid { margin-top: 40px; }
.cs-subhead { margin-top: 48px; }

/* Pass / blocked checklist: filled tick = allowed, outlined cross = blocked (both expected) */
.cs-section ul.checks { list-style: none; padding-left: 0; }
.checks li { position: relative; padding-left: 32px; }
.checks li::before {
  content: "✓"; position: absolute; left: 0; top: 4px;
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  font-size: 11px; font-weight: 700; background: var(--text); color: var(--bg);
}
.checks li.no::before { content: "✕"; background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text); }

/* Problem → fix */
.cs-row > * { min-width: 0; } /* long code lines scroll inside .code instead of widening the page */
.fix-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.fix-grid--two { grid-template-columns: repeat(2, 1fr); margin-top: 40px; }
.fix h3 { margin-bottom: 8px; }
.fix { padding: 24px; border: 1px solid var(--border); border-radius: 16px; }
.fix p { font-size: 15px; line-height: 1.65; color: var(--muted); }
.fix p + p { margin-top: 12px; }
.fix-label {
  display: inline-block; margin-right: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--text); color: var(--bg); vertical-align: 1px;
}

@media (max-width: 900px) {
  .cs-stats { grid-template-columns: repeat(2, 1fr); }
  .cs-stats > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .cs-stats > div:nth-child(n+3) { border-top: 1px solid var(--border); }

}
@media (max-width: 600px) {
  .cs-stats > div { padding: 22px 16px; }
  .fix-grid { grid-template-columns: 1fr; }
}


/* Full-size screenshot viewer (script.js, section 9) */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; overflow: visible; cursor: zoom-out; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.88); }
.lightbox img { display: block; max-width: 94vw; max-height: 86vh; border-radius: 8px; }
.lightbox-caption { margin-top: 12px; color: #d4d4d4; font-size: 14px; text-align: center; }

@media (max-width: 900px) {
  .cs-head, .cs-head:has(.cs-hero--portrait) { grid-template-columns: 1fr; gap: 36px; }
  .cs-hero--portrait { justify-self: center; }
  .cs-row, .cs-row.flip { grid-template-columns: 1fr; gap: 20px; margin-top: 40px; }
  .cs-row.flip .cs-section { order: 0; }
  .cs-block, .next-project { margin-top: 48px; }
}
@media (max-width: 760px) {
  .page { padding-top: calc(var(--topbar) + 32px); }
  .page-footer { padding: 20px; }
  .cs-hero .media { border-radius: 14px; }
  .gallery { grid-template-columns: 1fr; gap: 28px; }
  .next-project { grid-template-columns: 1fr; padding: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .media img:hover, .next-project:hover, .next-project:hover .next-arrow { transform: none; }
}
