/* =========================================================
   Layout idea: a quiet black-and-white page where the only
   colour comes from the projects. Each project owns one
   colour, used for its cover picture and for its block in
   the semester progress bar at the top.
   ========================================================= */

/* ---------- Design tokens (light theme) ---------- */
:root {
  --bg: #f6f7f9;        /* page background */
  --ink: #151829;       /* main text and dark buttons */
  --muted: #5b607a;     /* secondary text */
  --line: #dcdfe8;      /* thin dividers */
  --panel: #e9ebf2;     /* background of the Skills and Background panels */

  /* One colour per project (the same in light and dark mode) */
  --p1: #17483b;        /* Wildfire: forest green */
  --p1-ink: #eef3e6;
  --p2: #f5b83d;        /* Cookie Clicker: honey */
  --p2-ink: #3b2507;
  --p3: #d83d23;        /* Restaurant: tomato */
  --p3-ink: #fff4ea;
  --side: #4560e6;      /* Todo App: the blue from the app itself */
  --side-ink: #ffffff;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --gutter: clamp(18px, 4vw, 72px); /* empty space left and right of the content */
  --radius: clamp(20px, 2.2vw, 32px); /* one corner roundness for covers, panels and the contact box */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1); /* soft "ease out" used by all motion */
  color-scheme: light;
}

/* ---------- Dark theme: follows the system setting... ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f17;
    --ink: #eceef6;
    --muted: #9a9fb8;
    --line: #2a2d3e;
    --panel: #171925;
    color-scheme: dark;
  }
}

/* ---------- ...or the toggle button (data-theme="dark") ---------- */
:root[data-theme="dark"] {
  --bg: #0e0f17;
  --ink: #eceef6;
  --muted: #9a9fb8;
  --line: #2a2d3e;
  --panel: #171925;
  color-scheme: dark;
}

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

/* The base text size grows slowly with the screen width (16px on phones,
   up to 20px on very large screens). Every size written in "rem" follows it,
   so headings, small labels and spacing all keep the same proportions. */
html {
  scroll-behavior: smooth;
  font-size: clamp(100%, 87.5% + 0.3vw, 125%);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
}

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* Headings: Bricolage Grotesque, slightly narrow, tightly spaced */
h1, h2, h3 {
  font-family: var(--font-display);
  font-stretch: 85%;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  text-wrap: balance;
}

h2 { font-size: clamp(2.2rem, 4.2vw, 3.6rem); } /* same size for Projects, Skills, Background and Contact */

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88em;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

/* Visible focus ring for keyboard users */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* Content uses the full width of the screen, minus the gutter on each side */
.wrap {
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Top bar ---------- */
/* Stays at the top of the screen while the page scrolls underneath */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg); /* solid fallback for older browsers */
  background: color-mix(in srgb, var(--bg) 82%, transparent); /* slightly see-through... */
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);                                /* ...with the page blurred behind it */
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-decoration: none;
}

/* 2 x 2 grid of small coloured squares */
.logo-mark,
.contact-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 2px;
}

.logo-mark i,
.contact-mark i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.logo-mark i:nth-child(1), .contact-mark i:nth-child(1) { background: var(--p1); }
.logo-mark i:nth-child(2), .contact-mark i:nth-child(2) { background: var(--p2); }
.logo-mark i:nth-child(3), .contact-mark i:nth-child(3) { background: var(--p3); }
.logo-mark i:nth-child(4), .contact-mark i:nth-child(4) { background: var(--side); }

.nav {
  display: flex;
  gap: 26px;
  margin-left: auto; /* pushes nav + toggle to the right */
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.nav a:hover { color: var(--ink); }

.theme-toggle {
  font: 500 0.875rem var(--font-body);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}

.theme-toggle:hover { border-color: var(--ink); }

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Default button: filled, in the text colour */
.btn {
  display: inline-block;
  font: 600 1rem var(--font-body);
  color: var(--bg);
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 10px 22px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}

.btn:hover { transform: translateY(-2px); }

/* Outlined button */
.btn-line {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.btn-line:hover { border-color: var(--ink); }

/* ---------- Hero ---------- */
.hero { padding-bottom: 24px; }

/* Full-width band with the name and intro on the left and the portrait on the right */
.hero-main {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;      /* text sits in the lower part of the band */
  min-height: min(78vh, 56rem);   /* tall enough to feel like a full screen */
  padding-top: clamp(40px, 7vw, 96px);
  margin-bottom: clamp(28px, 4vw, 48px);
  background: var(--panel);
  overflow: hidden;               /* the portrait is cut off at the band's edges */
}

/* Portrait: fills the right side from top to bottom, BEHIND the text (lower z-index),
   so the end of the name runs across the picture */
.hero-portrait {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  width: 52%;
  margin: 0;
  animation: rise 0.9s var(--ease) 0.15s both;
}

/* A real photo is as tall as the band and anchored to the bottom right corner */
.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right bottom;
}

/* Placeholder drawing: a big head and shoulders */
.hero-portrait svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: color-mix(in srgb, var(--ink) 14%, var(--panel));
}

.hero-portrait span {
  position: absolute;
  right: var(--gutter);
  bottom: 1rem;
  color: var(--ink);
  font-size: 0.85rem;
}

/* The name: as big as the screen allows */
.hero-name {
  font-size: clamp(3.3rem, 12vw, 15rem);
  font-stretch: 78%;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.88;
  position: relative;
  z-index: 2; /* in front of the portrait */
  /* thin halo in the page colour keeps the letters readable on top of a photo */
  text-shadow: 0 0 0.06em var(--panel);
}

/* Each line slides up into place when the page loads */
.hero-name .line {
  display: block;
  animation: rise 0.8s var(--ease) both;
}

.hero-name .line:nth-child(2) { animation-delay: 0.09s; }

@keyframes rise {
  from { transform: translateY(0.35em); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  padding: clamp(24px, 4vw, 44px) 0 clamp(36px, 5vw, 64px);
  padding-right: 40%; /* keeps the intro and buttons off the face */
  position: relative;
  z-index: 2;
}

.hero-lead {
  font-size: clamp(1.1rem, 1.7vw, 1.35rem);
  line-height: 1.45;
  max-width: 33em;
}

/* ---------- Degree progress bar ---------- */
.degree-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 20px;
  padding-bottom: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Six blocks: finished semesters are wide, future ones narrow */
.semesters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 5fr)) repeat(3, minmax(0, 2fr));
  gap: 8px;
}

/* A future semester: dashed outline with its number */
.sem {
  min-height: 6.5rem;
  display: grid;
  place-items: center;
  border: 2px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
}

/* A finished (or current) semester: filled with its project colour.
   On page load the colour sweeps in from the left, one block after another. */
.sem-filled {
  display: block;
  border: 0;
  animation: fill 0.7s var(--ease) both;
}

.sem-p1 { background: var(--p1); color: var(--p1-ink); animation-delay: 0.25s; }
.sem-p2 { background: var(--p2); color: var(--p2-ink); animation-delay: 0.45s; }
.sem-p3 { background: var(--p3); color: var(--p3-ink); animation-delay: 0.65s; }

@keyframes fill {
  from { clip-path: inset(0 100% 0 0 round 16px); }
  to   { clip-path: inset(0 0 0 0 round 16px); }
}

/* The whole block is a link to that project */
.sem-filled a {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  border-radius: 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.25;
}

.sem-filled a:focus-visible { outline-offset: -5px; outline-color: currentColor; }

.sem-filled b {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

/* "Now" marker with a slowly pulsing dot */
.sem-filled em {
  position: absolute;
  top: 14px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-style: normal;
  font-size: 0.9rem;
  font-weight: 600;
}

.sem-filled em::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.25; }
}

/* ---------- Sections ---------- */
.section {
  padding-top: clamp(72px, 10vw, 128px);
}

/* Anchors: stop below the sticky top bar when jumped to */
#work, #about, #contact, .work { scroll-margin-top: 84px; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 48px;
}

.section-head p {
  max-width: 26em;
  color: var(--muted);
}

/* ---------- Project rows ---------- */
.work {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); /* picture : text, the same for every project */
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding-top: clamp(48px, 7vw, 88px);
}


.work-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.work-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  color: var(--muted);
  font-weight: 500;
}

/* Coloured label that matches the project's block in the progress bar */
.chip {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  border-radius: 7px;
  padding: 5px 9px;
}

.chip-p1 { background: var(--p1); color: var(--p1-ink); }
.chip-p2 { background: var(--p2); color: var(--p2-ink); }
.chip-p3 { background: var(--p3); color: var(--p3-ink); }
.chip-side { background: var(--side); color: var(--side-ink); }

.pill {
  font-size: 0.85rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 10px;
}

.work h3 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); }

.work-sum { font-size: 1.15rem; }

.work-points {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 18px;
  list-style: disc;
  color: var(--muted);
}

.work-tech {
  width: 100%;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.work-tech span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

/* ---------- Covers: the big coloured pictures ---------- */
.cover {
  --mx: 0; /* pointer position inside the cover, from -0.5 to 0.5 (set in script.js) */
  --my: 0;
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  container-type: inline-size; /* lets text inside scale with the cover (cqw units) */
}

.cover-p1 { background: var(--p1); }
.cover-p2 { background: var(--p2); }
.cover-p3 { background: var(--p3); }
.cover-side { background: var(--side); }

.cover:focus-visible { outline-offset: 5px; }

/* Background drawing: drifts slightly AWAY from the pointer */
.cover .art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  font-family: var(--font-body);
  transform: translate(calc(var(--mx) * -14px), calc(var(--my) * -14px)) scale(1.07);
  transition: transform 0.6s var(--ease);
}

/* Things on top: drift TOWARDS the pointer, which gives a feeling of depth */
.cover .float {
  position: absolute;
  /* --depth = how many pixels the item moves at most (each item can set its own) */
  transform:
    translate(calc(var(--mx) * var(--depth, 22) * 1px), calc(var(--my) * var(--depth, 22) * 1px))
    rotate(var(--tilt, 0deg));
  transition: transform 0.6s var(--ease);
}

/* Every rebuilt app screen is a rounded "window" with a shadow.
   Sizes inside use em, and the font size uses cqw, so a whole window
   scales with the width of its cover. */
.cover .app {
  border-radius: 1.6cqw;
  overflow: hidden;
  box-shadow: 0 3cqw 6cqw rgba(0, 0, 0, 0.35);
  line-height: 1.35;
}

/* ----- P3: waiter screen ----- */
.ppsh-waiter {
  --depth: 12;
  left: 6%;
  top: 8%;
  width: 78%;
  background: #fff6ef;
  color: #1f1a14;
  font-size: 9px;       /* fallback for older browsers */
  font-size: 1.6cqw;
}

.ppsh-bar {
  display: flex;
  align-items: center;
  gap: 2.2em;
  padding: 1em 1.4em;
  border-bottom: 1px solid #eadfd3;
  color: #6f675e;
}

.ppsh-bar b { color: #1f1a14; }

.ppsh-body {
  display: grid;
  grid-template-columns: 23% minmax(0, 1fr);
}

.ppsh-side {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  padding: 1em 0.6em 1.4em;
  border-right: 1px solid #eadfd3;
}

.ppsh-table {
  padding-left: 0.4em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.7em;
}

.ppsh-side li {
  padding: 0.6em 0.8em;
  border-radius: 0.6em;
  color: #4a433b;
}

.ppsh-side li.on {
  background: #5a6b2c;
  color: #ffffff;
  font-weight: 600;
}

.ppsh-menu {
  display: flex;
  flex-direction: column;
  gap: 1em;
  padding: 1em;
}

.ppsh-search {
  background: #ffffff;
  border: 1px solid #eadfd3;
  border-radius: 0.8em;
  padding: 0.7em 1em;
  color: #9a9086;
}

.ppsh-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8em;
}

/* One dish card; it lifts a little under the mouse */
.dish {
  display: flex;
  flex-direction: column;
  gap: 0.45em;
  background: #ffffff;
  border-radius: 0.8em;
  padding: 0.9em 1em;
  box-shadow: 0 1px 2px rgba(60, 40, 20, 0.1);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.dish:hover {
  transform: translateY(-0.4em);
  box-shadow: 0 0.6em 1.2em rgba(60, 40, 20, 0.16);
}

.dish b { font-size: 1.1em; font-weight: 500; }
.dish b i { margin-right: 0.4em; font-style: normal; font-weight: 700; color: #5a6b2c; }
.dish p { color: #6f675e; font-size: 0.9em; }
.dish strong { font-weight: 600; }

/* ----- P3: kitchen order ----- */
.ppsh-kitchen {
  --depth: 28;
  --tilt: 3deg;
  right: 5%;
  bottom: 6%;
  width: 40%;
  background: #fffaf5;
  color: #1f1a14;
  border: 0.22em solid #5a6b2c;
  font-size: 11px;
  font-size: 1.8cqw;
}

.k-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  padding: 0.9em 1em;
  border-bottom: 1px solid #eadfd3;
}

.k-head b {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5em;
  line-height: 1.1;
}

.k-head span { color: #6f675e; font-size: 0.8em; }

.k-head em {
  background: #fff6ef;
  border: 1px solid #eadfd3;
  border-radius: 0.7em;
  padding: 0.5em 0.8em;
  font-style: normal;
  font-size: 0.85em;
  white-space: nowrap;
}

.ppsh-kitchen li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9em;
  padding: 0.7em 1em;
}

.ppsh-kitchen li + li { border-top: 1px solid #eadfd3; }
.ppsh-kitchen li > b { font-family: Georgia, "Times New Roman", serif; font-size: 1.4em; }
.ppsh-kitchen li div { font-weight: 500; }
.ppsh-kitchen li div span { display: block; color: #6f675e; font-size: 0.7em; font-weight: 400; }

/* Green "done" button with a check mark drawn from two borders */
.tick {
  position: relative;
  width: 2.4em;
  height: 2.4em;
  border-radius: 0.6em;
  background: #5a6b2c;
  box-shadow: inset 0 0 0 0.14em #5a6b2c;
}

.tick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 0.5em;
  height: 0.95em;
  border: solid #ffffff;
  border-width: 0 0.18em 0.18em 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* ----- P2: chart window ----- */
.bench-win {
  --depth: 10;
  left: 6%;
  top: 8%;
  width: 78%;
  background: #1b1b1b;
  color: #f0f0f0;
  padding: 1.1em 1.2em 0.7em;
  font-size: 10px;
  font-size: 1.6cqw;
}

.bench-title {
  margin-bottom: 0.4em;
  text-align: center;
  font-size: 1.25em;
  font-weight: 700;
}

.bench-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--font-body);
}

/* The lines are drawn with a dash as long as the line itself,
   so sliding the dash (stroke-dashoffset) makes the line appear. */
.line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: opacity 0.25s, stroke-width 0.25s;
}

/* Hovering a table row: fade the other lines, thicken the chosen one */
.cover-p2[data-active] .line { opacity: 0.18; }
.cover-p2[data-active="blue"] .line-blue,
.cover-p2[data-active="green"] .line-green,
.cover-p2[data-active="orange"] .line-orange,
.cover-p2[data-active="purple"] .line-purple {
  opacity: 1;
  stroke-width: 3.5;
}

/* ----- P2: results table ----- */
.bench-table {
  --depth: 28;
  --tilt: -1.5deg;
  right: 5%;
  bottom: 6%;
  width: 70%;
  background: #141414;
  color: #f0f0f0;
  padding: 0.4em 0;
  font-size: 10px;
  font-size: 1.8cqw;
}

.bench-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5em;
  padding: 0.6em 1.2em;
  border-top: 1px solid #2c2c2c;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.2s;
}

.bench-row:hover { background: #242424; }
.bench-head { border-top: 0; font-weight: 700; }
.bench-head:hover { background: none; }

/* Small colour square in front of each algorithm name */
.bench-row i {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-right: 0.6em;
  border-radius: 0.15em;
}

.best { color: #86efac; }   /* fastest result, like the green in the real table */
.worst { color: #fca5a5; }  /* slowest result */

/* Todo App: a simple browser window with the rebuilt app inside */
.window {
  left: 50%;
  top: 50%;
  translate: -50% -50%; /* centred in the cover */
  width: 76%;
  background: #f3f3f6;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(8, 16, 70, 0.4);
}

.window-bar {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: #ffffff;
  border-bottom: 1px solid #e3e4ea;
}

.window-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d3d6e0;
}

/* ----- Todo App: the app itself ----- */
.todo-app {
  background: #f2f2f5;
  color: #1f2330;
  padding: 1.8em 4em 1.8em;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 11px;      /* fallback for older browsers */
  font-size: 1.7cqw;
  line-height: 1.35;
}

.todo-title {
  margin-bottom: 0.45em;
  text-align: center;
  font-size: 2.8em;
  font-weight: 300;
}

/* Input field and the blue Add button */
.todo-add {
  display: flex;
  gap: 0.6em;
}

.todo-add span {
  flex: 1;
  background: #ffffff;
  border: 1px solid #e3e4ea;
  border-radius: 0.6em;
  padding: 0.7em 1em;
  color: #777c8c;
}

.todo-add b {
  background: #4f6bed;
  color: #ffffff;
  border-radius: 0.6em;
  padding: 0.7em 1.3em;
  font-weight: 500;
}

.todo-list {
  margin-top: 1em;
  background: #ffffff;
  border: 1px solid #e3e4ea;
  border-radius: 0.7em;
  overflow: hidden;
}

.todo-list li {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 0.85em 1.2em;
  transition: background-color 0.2s;
}

.todo-list li + li { border-top: 1px solid #e3e4ea; }
.todo-list li:hover { background: #f4f6fd; }

/* Checkbox: empty by default, blue with a check mark when the todo is done */
.box {
  position: relative;
  flex: none;
  width: 1.15em;
  height: 1.15em;
  border: 1px solid #8a8fa0;
  border-radius: 0.2em;
  background: #ffffff;
}

.done .box {
  background: #4f6bed;
  border-color: #4f6bed;
}

.done .box::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 0.3em;
  height: 0.6em;
  border: solid #ffffff;
  border-width: 0 0.14em 0.14em 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* Finished todos are grey and crossed out */
.done span {
  color: #8b8fa0;
  text-decoration: line-through;
}

.todo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  margin-top: 0.9em;
  color: #8b8fa0;
  font-size: 0.88em;
}

.todo-filters {
  display: inline-flex;
  align-items: center;
  gap: 1.2em;
}

/* The selected filter has a blue outline */
.todo-filters b {
  border: 1px solid #4f6bed;
  border-radius: 0.6em;
  padding: 0.2em 0.7em;
  color: #4f6bed;
  font-weight: 400;
}

/* ----- P1: terminal interface ----- */
.tui {
  --depth: 14;
  left: 50%;
  top: 50%;
  translate: -50% -50%; /* centred in the cover */
  width: 88%;
  display: grid;
  grid-template-columns: 58% minmax(0, 1fr);
  gap: 1em 1.6em;
  align-items: start;
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 1.7em 1.4em 1em;
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 9px;
  font-size: 1.6cqw;
}

/* A box with a double line border and its title sitting on the top edge */
.tui-box {
  position: relative;
  border: 0.24em double #b4befe;
}

.tui-title {
  position: absolute;
  top: -0.85em;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1e2e;
  padding: 0 0.3em;
  font-size: 0.85em;
  white-space: nowrap;
}

#tui-map {
  display: block;
  width: 100%;
  height: auto;
}

/* The fire glows slowly */
.tui-fire { animation: fire 1.4s ease-in-out infinite; }

@keyframes fire {
  50% { fill: #ff7b1c; }
}

.tui-msg {
  min-height: 17em;
  margin-top: 3em;
  padding: 1.2em 1em;
  line-height: 1.7;
  white-space: pre-line; /* keeps the line breaks that script.js puts in the text */
}

.tui-menu {
  grid-column: 1 / -1;
  line-height: 1.5;
}

.tui-menu .on { color: #89b4fa; }

/* ---------- About: two full-width panels, one under the other ---------- */
.about {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.5vw, 28px);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: clamp(22px, 3.2vw, 38px);
}

.panel-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-head p { color: var(--muted); }

/* ---------- Skills panel ---------- */
/* Heading on the left, filter buttons on the right */
.skills-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px 32px;
}

.skill-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* The filter buttons reuse the coloured .chip look */
.skill-filter .chip {
  font-size: 1rem;
  border: 0;
  padding: 8px 13px;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.skill-filter .chip:hover { transform: translateY(-2px); }

/* A pinned filter gets a ring around it */
.skill-filter .chip[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--ink);
}

/* Four groups next to each other (fewer columns on smaller screens, see the bottom of this file) */
.skill-groups {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 28px;
}

.skill-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skill-group dt {
  color: var(--muted);
  font-size: 0.92rem;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* One skill tile */
.skill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 10px;
  padding: 6px 12px;
  font-weight: 600;
  transition: opacity 0.25s, background-color 0.25s, color 0.25s, transform 0.25s var(--ease);
}

/* Coloured dots: one per project the skill was used in (added by script.js) */
.dots {
  display: inline-flex;
  gap: 3px;
}

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-p1 { background: var(--p1); }
.dot-p2 { background: var(--p2); }
.dot-p3 { background: var(--p3); }
.dot-side { background: var(--side); }

/* When a project is picked: fade every tile... */
.skills[data-active] .skill { opacity: 0.3; }

/* ...except the ones used in that project, which take its colour */
.skills[data-active="p1"] .skill[data-used~="p1"] { background: var(--p1); color: var(--p1-ink); }
.skills[data-active="p2"] .skill[data-used~="p2"] { background: var(--p2); color: var(--p2-ink); }
.skills[data-active="p3"] .skill[data-used~="p3"] { background: var(--p3); color: var(--p3-ink); }
.skills[data-active="side"] .skill[data-used~="side"] { background: var(--side); color: var(--side-ink); }

.skills[data-active="p1"] .skill[data-used~="p1"],
.skills[data-active="p2"] .skill[data-used~="p2"],
.skills[data-active="p3"] .skill[data-used~="p3"],
.skills[data-active="side"] .skill[data-used~="side"] {
  opacity: 1;
  transform: translateY(-2px);
}

/* The dots are not needed while a tile is fully coloured */
.skills[data-active] .dots { visibility: hidden; }

/* ---------- Skill tree ----------
   Looks like a game skill tree: a root node, a trunk line running right,
   one branch per group, and every skill hanging off its branch on a curved line.
   All lines are drawn with ::before / ::after, so the HTML stays a plain list. */
.skills {
  --rail: 1.1rem;        /* how far from a column's left edge its branch line runs */
  --elbow: 1.5rem;       /* length of the small line from the branch to a skill */
  --step: 0.6rem;        /* space between two skills */
  --drop: 1.5rem;        /* space between the trunk and a branch's first node */
  --tree-line: color-mix(in srgb, var(--ink) 30%, var(--panel));
}

/* Root node */
.tree-root {
  position: relative;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
  background: var(--ink);
  color: var(--panel);
  border-radius: 999px;
  padding: 0.5rem 1.1rem 0.5rem 0.8rem;
  font-weight: 600;
}

/* Line from the root down to the trunk */
.tree-root::after {
  content: "";
  position: absolute;
  left: var(--rail);
  top: 100%;
  width: 2px;
  height: calc(1.6rem + 22px); /* root's bottom margin + the panel's gap */
  margin-left: -1px;
  background: var(--tree-line);
}

.skill-groups { gap: 2.4rem 1.75rem; }

.skill-group {
  position: relative;
  gap: var(--step);
}

/* Trunk: a line from this branch to the next one on its right */
.skill-group::after {
  content: "";
  position: absolute;
  left: var(--rail);
  top: -1px;
  width: calc(100% + 1.75rem);
  height: 2px;
  background: var(--tree-line);
}

.skill-group:last-child::after { display: none; }

/* Branch node: the group name with a big dot on the line */
.skill-group dt {
  position: relative;
  display: flex;
  align-items: center;
  z-index: 1; /* keeps the big dot above the lines that run into it */
  min-height: 2.2rem;
  margin-top: var(--drop);
  padding-left: calc(var(--rail) * 2 + 0.3rem);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.skill-group dt::before {
  content: "";
  position: absolute;
  left: var(--rail);
  top: 50%;
  width: 1.3rem;
  height: 1.3rem;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 4px var(--panel), 0 0 0 6px var(--tree-line);
}

/* Line from the trunk down to the branch node */
.skill-group dt::after {
  content: "";
  position: absolute;
  left: var(--rail);
  bottom: 50%;
  width: 2px;
  z-index: -1; /* behind the dot */
  height: calc(50% + var(--drop));
  margin-left: -1px;
  background: var(--tree-line);
}

/* Skills hang under each other */
.skill-list {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--step);
  padding-left: calc(var(--rail) + var(--elbow));
}

.skill {
  position: relative;
  white-space: nowrap; /* one line per skill, so the connectors always meet */
}

/* Curved connector: comes down the branch from the skill above, then turns right into this skill */
.skill::before {
  content: "";
  position: absolute;
  right: 100%;
  bottom: 50%;
  width: var(--elbow);
  height: calc(100% + var(--step));
  border-left: 2px solid var(--tree-line);
  border-bottom: 2px solid var(--tree-line);
  border-bottom-left-radius: 0.7rem;
  margin-left: -1px;
  pointer-events: none;
  transition: border-color 0.25s;
}

/* Small socket where the connector meets the skill */
.skill::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.6rem;
  height: 0.6rem;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--tree-line);
  transition: border-color 0.25s, background-color 0.25s;
}

/* A picked project lights up its connectors and sockets in its colour */
.skills[data-active="p1"] .skill[data-used~="p1"] { --lit: var(--p1); }
.skills[data-active="p2"] .skill[data-used~="p2"] { --lit: var(--p2); }
.skills[data-active="p3"] .skill[data-used~="p3"] { --lit: var(--p3); }
.skills[data-active="side"] .skill[data-used~="side"] { --lit: var(--side); }

.skills[data-active] .skill::before { border-color: var(--lit, var(--tree-line)); }
.skills[data-active] .skill::after { border-color: var(--lit, var(--tree-line)); background: var(--lit, var(--panel)); }

/* Text that only screen readers get */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Background panel: the timeline ----------
   Every row reads left to right: what it was, when, and its bar on the timeline. */
.chart-key {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-key span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.chart-key i {
  width: 18px;
  height: 10px;
  border-radius: 5px;
}

.key-work, .bar-work { background: color-mix(in srgb, var(--ink) 40%, var(--panel)); }
.key-edu, .bar-edu { background: var(--ink); }

.chart {
  --info: 50%;           /* width of the text part; the timeline gets the rest */
  --cursor: 97.9;        /* where the moving line stands, in percent of the timeline (97.9 = today) */
  position: relative;
  padding: 30px 0 40px;  /* room for the year labels (top) and the date label (bottom) */
}

/* Six year columns, drawn behind the bars */
.chart-years {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--info);
  right: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  pointer-events: none;
}

.chart-years li {
  border-left: 1px solid var(--line);
  padding-left: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.chart-rows {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* One row: text on the left, bar on the right, a thin line between rows */
.chart-row {
  display: grid;
  grid-template-columns: var(--info) minmax(0, 1fr);
  align-items: center;
  border-top: 1px solid var(--line);
  transition: opacity 0.25s;
}

.chart-row:last-child { border-bottom: 1px solid var(--line); }

/* Text part: title and description on the left, dates on the right */
.chart-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 20px;
  padding: 14px 28px 14px 0;
}

.chart-text strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 600;
}

.chart-text p,
.chart-when {
  color: var(--muted);
  font-size: 0.94rem;
}

.chart-when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.track {
  position: relative;
  height: 16px;
  cursor: crosshair;
}

/* The bar: placed and sized from the row's --start and --end months (72 months in total) */
.bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--start) / 72 * 100%);
  width: calc((var(--end) - var(--start)) / 72 * 100%);
  border-radius: 8px;
  transform-origin: left center;
}

/* University bar: one piece per semester */
.bar-aau {
  display: flex;
  gap: 2px;
  overflow: hidden;
}

.seg-p1 { background: var(--p1); }
.seg-p2 { background: var(--p2); }
.seg-p3 { background: var(--p3); }
.seg-break { background: color-mix(in srgb, var(--ink) 14%, var(--panel)); }

/* While the line is being moved, fade the rows that were not happening in that month */
.chart.scrubbing .chart-row:not(.active) { opacity: 0.35; }

/* The moving line (only over the timeline part) and its date label */
.chart-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--info) + (100% - var(--info)) * var(--cursor) / 100);
  width: 2px;
  margin-left: -1px;
  background: color-mix(in srgb, var(--ink) 65%, transparent);
  pointer-events: none;
}

/* The label slides from left-aligned to right-aligned as the line moves right,
   so it never sticks out of the panel */
.chart-cursor span {
  position: absolute;
  bottom: 0;
  left: 0;
  transform: translateX(calc(var(--cursor) * -1%));
  background: var(--ink);
  color: var(--panel);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Entrance animations for the two panels ----------
   script.js adds "anim" to <html> (only if motion is welcome)
   and "seen" to a panel once it scrolls into view. */
.anim .panel:not(.seen) .skill { opacity: 0; }
.anim .panel:not(.seen) .bar { transform: scaleX(0); }

.anim .panel.seen .skill {
  animation: pop 0.5s var(--ease) both;
  animation-delay: calc(var(--n) * 28ms); /* --n = the tile's number, set in script.js */
}

.anim .panel.seen .bar {
  animation: grow 0.9s var(--ease) both;
  animation-delay: calc(var(--i) * 120ms);
}

@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
}

/* The same idea for the project covers ("seen" is added when a cover scrolls into view):
   P3 ticks the dishes off one by one, P2 draws its lines, P1 places its warning marks. */
.tick { transition: background-color 0.35s; transition-delay: calc(var(--k) * 0.4s + 0.5s); }
.tick::after { transition: opacity 0.35s; transition-delay: calc(var(--k) * 0.4s + 0.5s); }
.anim .cover:not(.seen) .tick { background: transparent; transition: none; }
.anim .cover:not(.seen) .tick::after { opacity: 0; transition: none; }

/* Todo App: boxes fill and the text is crossed out, one todo at a time */
.done .box,
.done span { transition: all 0.35s; transition-delay: calc(var(--k) * 0.45s + 0.5s); }

.anim .cover:not(.seen) .done .box { background: #ffffff; border-color: #8a8fa0; transition: none; }
.anim .cover:not(.seen) .done .box::after { opacity: 0; }
.anim .cover:not(.seen) .done span { color: #1f2330; text-decoration-color: transparent; transition: none; }

.anim .cover:not(.seen) .line { stroke-dashoffset: 1; }
.anim .cover.seen .line { animation: draw 2.2s var(--ease) both; }
.anim .cover.seen .line-blue { animation-duration: 3.2s; }

@keyframes draw {
  from { stroke-dashoffset: 1; }
}

.anim .cover:not(.seen) .tui-bang { opacity: 0; }
.anim .cover.seen .tui-bang {
  animation: blink-in 0.3s both;
  animation-delay: calc(var(--k) * 45ms + 0.4s);
}

@keyframes blink-in {
  from { opacity: 0; }
}

@keyframes grow {
  from { transform: scaleX(0); }
}

/* ---------- Contact: one big dark panel ---------- */
.contact {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  padding: clamp(32px, 6vw, 72px);
}

.contact h2 { max-width: 14em; }

.contact-email {
  font-family: var(--font-display);
  font-stretch: 85%;
  font-size: clamp(1.35rem, 4.6vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere; /* wraps on small phones instead of overflowing */
}

/* Inside the dark panel the button colours are swapped */
.contact .btn {
  color: var(--ink);
  background: var(--bg);
  border-color: var(--bg);
}

.contact .btn-line {
  color: var(--bg);
  background: transparent;
  border-color: color-mix(in srgb, var(--bg) 35%, transparent);
}

.contact .btn-line:hover { border-color: var(--bg); }
.contact :focus-visible { outline-color: var(--bg); }

.copy-status {
  min-height: 1.5em;
  font-weight: 500;
}

/* Bigger version of the four-square logo in the corner */
.contact-mark {
  position: absolute;
  right: clamp(24px, 4vw, 48px);
  bottom: clamp(24px, 4vw, 48px);
  grid-template-columns: repeat(2, 18px);
  gap: 4px;
}

.contact-mark i {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-top: 28px;
  padding-bottom: 32px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Small laptops, tablets and phones ---------- */
@media (max-width: 1080px) {
  /* Picture on top, text below, for every project */
  .work { grid-template-columns: minmax(0, 1fr); }

  /* Skill tree with two columns: the trunk only joins the top two branches,
     and the lower branches hang from the ones above them */
  .skill-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-group:nth-child(n+2)::after { display: none; }
  .skill-group:nth-child(-n+2)::before {
    content: "";
    position: absolute;
    left: var(--rail);
    top: 0;
    bottom: -2.4rem; /* reaches across the gap to the branch below */
    width: 2px;
    margin-left: -1px;
    background: var(--tree-line);
  }

  /* Timeline: the text goes above its bar, and the timeline uses the full width */
  .chart { --info: 0%; }
  .chart-row { grid-template-columns: minmax(0, 1fr); }
  .chart-info { padding: 14px 7% 8px 0; }
  .track { margin-bottom: 16px; }

}

@media (max-width: 640px) {
  .nav { display: none; }              /* hide links on small screens */

  /* Portrait on phones: wider and faded, so the text on top of it stays readable */
  .hero-main { min-height: 0; padding-top: 120px; }
  .hero-portrait { width: 85%; opacity: 0.45; }
  .hero-portrait span { display: none; }
  .hero-row { padding-right: 0; }
  .theme-toggle { margin-left: auto; } /* keep the toggle on the right */

  /* Progress bar: three finished semesters on top, three future ones below */
  .semesters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sem { min-height: 52px; font-size: 1.2rem; }
  .sem-filled a { padding: 12px; font-size: 0.85rem; }
  .sem-filled b { font-size: 1.3rem; }
  .sem-filled em { top: 12px; right: 10px; font-size: 0.8rem; }

  .contact-mark { position: static; }

  /* Skill tree in one column: one line runs down through all four branches */
  .skill-groups { grid-template-columns: minmax(0, 1fr); }
  .skill-group::after { display: none; }
  .skill-group:nth-child(-n+3)::before {
    content: "";
    position: absolute;
    left: var(--rail);
    top: 0;
    bottom: -2.4rem;
    width: 2px;
    margin-left: -1px;
    background: var(--tree-line);
  }
  .chart-info { flex-direction: column; gap: 2px; }
}

/* No movement for people who ask for less motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .hero-portrait,
  .hero-name .line,
  .sem-filled,
  .sem-filled em::before { animation: none; }

  .cover .art,
  .cover .float,
  .btn,
  .skill,
  .chart-row,
  .skill-filter .chip,
  .dish,
  .line,
  .tick,
  .tick::after,
  .todo-list li,
  .done .box,
  .done span { transition: none; }

  .tui-fire { animation: none; }
}