:root {
  --paper: #ffffff;
  --ink: #16203a;
  --ink-soft: #4a5470;
  --link: #0000ee;
  --line: #e6e8ef;
  --sun: #ffc928;

  --kde: #1d99f3;
  --kde-tint: #e3f3fe;
  --startup: #f2a900;
  --startup-tint: #fff6d6;
  --built: #1fae6b;
  --built-tint: #e2f6ec;
  --life: #ff5c8a;
  --life-tint: #ffe6ee;
  --progress: #7a5cff;
  --progress-tint: #efebff;

  --radius: 20px;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1200px;
  --header-h: 72px;

  color-scheme: light;
}

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

@font-face {
  font-family: 'Archivo';
  src: url('assets/fonts/Archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
/* Every link is underlined, always. */
a { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
p { margin: 0; }

.noscript { padding: var(--gutter); max-width: 60ch; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Focus: ink ring with a sun glow, visible on white and on every tint */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--sun);
  border-radius: 6px;
}

/* ---------- Buttons and pills ---------- */

.button {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 26px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 18px;
  font-weight: 650;
  white-space: nowrap;
}
.button--sun { border-color: var(--sun); background: var(--sun); }
.button--small { min-height: 42px; padding: 0 18px; font-size: 16px; }
.button:focus-visible { border-radius: 999px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pills li { padding: 4px 14px; border-radius: 999px; background: var(--paper); font-size: 15px; font-weight: 550; }

/* ---------- Header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
  background: rgb(255 255 255 / 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__name { font-size: 19px; font-weight: 800; }
.topbar__nav { display: flex; gap: 4px; margin-left: auto; }
.topbar__nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 550;
}
.topbar__nav a:hover { background: var(--line); color: var(--ink); }

/* ---------- Sections ---------- */

.section,
.hero {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section { margin-top: 120px; }
.band {
  max-width: none;
  padding-top: 88px;
  padding-bottom: 88px;
}
.band > * { max-width: var(--max); margin-left: auto; margin-right: auto; }
.band--startup { background: var(--startup-tint); }
.band--life { background: var(--life-tint); }

.section__head { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 40px; }
.section__marker { width: 44px; height: 10px; border-radius: 999px; background: var(--section-color, var(--ink)); }
.section__title {
  margin: 0;
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.section__sub { color: var(--ink-soft); max-width: 62ch; }

#progress { --section-color: var(--progress); }
#startup { --section-color: var(--startup); }
#kde { --section-color: var(--kde); }
#built { --section-color: var(--built); }
#life { --section-color: var(--life); }
#contact { --section-color: var(--sun); }

/* ---------- Hero ---------- */

.hero { padding-top: clamp(40px, 9vh, 112px); }
.hero__title {
  margin: 0;
  max-width: 32ch;
  font-size: clamp(32px, min(4.2vw, 6.6vh), 60px);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.015em;
}
.hero__title strong { font-weight: 800; }

.chip {
  display: inline-block;
  white-space: nowrap;
  text-decoration: none;
  border-radius: 999px;
  animation: chip-pop 220ms cubic-bezier(.2, .9, .3, 1.3) both;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}
.chip__img {
  display: inline-block;
  vertical-align: -0.14em;
  margin-right: 0.16em;
  width: 0.92em;
  height: 0.92em;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px var(--chip-color, var(--line));
}
/* The chip's image stays clean; its word carries the underline. */
.chip__word { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.12em; }
.chip:hover .chip__word { text-decoration-thickness: 5px; }
.chip[href="#life"] { --chip-color: var(--life); }
.chip[href="#built"] { --chip-color: var(--built); }
.chip[href="#kde"] { --chip-color: var(--kde); }
.chip[href="#startup"] { --chip-color: var(--startup); }
.chip[href="#progress"] { --chip-color: var(--progress); }

@keyframes chip-pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}

.hero__sub {
  margin-top: 28px;
  max-width: 58ch;
  color: var(--ink-soft);
  font-size: clamp(18px, 1.5vw, 21px);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

/* ---------- Timeline ---------- */

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline::before {
  content: '';
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--progress-tint);
}
.milestone { position: relative; display: flex; flex-direction: column; gap: 8px; }
.milestone__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--progress);
  box-shadow: 0 0 0 5px var(--paper);
}
.milestone__marker { margin-top: 10px; font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.milestone__age { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 16px; font-weight: 600; }
.milestone__text { color: var(--ink-soft); font-size: 16px; line-height: 1.5; }
.timeline__note { margin-top: 36px; font-weight: 550; }

/* ---------- Startup ---------- */

.startup { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.startup .section__head { margin-bottom: 24px; }
.startup__body { max-width: 58ch; font-size: 20px; line-height: 1.6; }
.startup__meta { margin-top: 18px; color: var(--ink-soft); }
.startup__side { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding: 28px; border-radius: var(--radius); background: var(--paper); }
.startup__label { font-size: 15px; font-weight: 650; color: var(--ink-soft); }
.startup__side .pills li { background: var(--startup-tint); }

/* ---------- KDE ---------- */

.kde__count { font-variant-numeric: tabular-nums; }
.kde { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.kde-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.kde-row {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 9em) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  padding: 18px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease-out;
}
.kde-row:hover, .kde-row:focus-visible { background: var(--kde-tint); }
.kde-row:focus-visible { border-radius: 10px; }
.kde-row__num { color: var(--ink-soft); font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kde-row__project { color: var(--ink-soft); font-size: 15px; overflow-wrap: anywhere; }
.kde-row__title { font-size: 19px; font-weight: 650; line-height: 1.35; }
.kde-row__arrow { color: var(--ink-soft); }
.kde-preview {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--kde-tint);
  box-shadow: inset 0 0 0 3px var(--kde);
}
.kde-preview img { width: 100%; height: 100%; object-fit: contain; }
.kde-preview img[hidden], .kde-preview__summary[hidden] { display: none; }
.kde-preview__summary { padding: 32px; font-size: clamp(20px, 2vw, 26px); font-weight: 600; line-height: 1.35; text-align: center; }
.kde__all { display: inline-block; margin-top: 24px; font-weight: 600; }

/* ---------- Things I built ---------- */

.projects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.project {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.project:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgb(22 32 58 / 0.08); }
.project__category {
  align-self: flex-start;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--built-tint);
  font-size: 14px;
  font-weight: 650;
}
.project__title { margin: 0; }
.project__open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-align: left;
  cursor: pointer;
}
/* The title button stretches over the whole card, so clicking anywhere opens the panel. */
.project__open::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.project__links a { position: relative; z-index: 1; }
.project__open:hover { text-decoration: underline; text-decoration-color: var(--built); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.project__summary { color: var(--ink-soft); }
.project__meta { display: flex; gap: 32px; margin: 4px 0 0; font-size: 15px; }
.project__meta dt { color: var(--ink-soft); }
.project__meta dd { margin: 0; font-weight: 600; }
.project__links { display: flex; gap: 20px; margin-top: auto; padding-top: 8px; font-weight: 600; }
.also { margin-top: 28px; color: var(--ink-soft); }

/* ---------- Off the keyboard ---------- */

.life__table {
  display: grid;
  place-items: center;
  margin: 0 0 48px;
  aspect-ratio: 21 / 8;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper);
}
.life__table img { width: 100%; height: 100%; object-fit: cover; }
.life__table img[src$=".svg" i] { object-fit: contain; padding: 12%; }
/* Until there's a real desk photo, skip the slot rather than show a big empty box. */
.life__table:has(img[src$=".svg" i]) { display: none; }
.life__subhead { margin: 0 0 18px; font-size: 22px; font-weight: 750; }
.life__gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin: 0 0 48px; padding: 0; list-style: none; }
.shot { margin: 0; }
.shot img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius); background: var(--paper); }
.shot__caption { margin-top: 10px; font-size: 16px; line-height: 1.4; color: var(--ink-soft); }
@media (max-width: 959px) { .life__gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Phones: one swipeable row instead of a tall stack. */
@media (max-width: 599px) {
  .life__gallery { display: flex; gap: 14px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .life__gallery::-webkit-scrollbar { display: none; }
  .life__gallery > li { flex: 0 0 72%; scroll-snap-align: start; }
}
.trips, .hobbies { display: grid; gap: 20px; margin: 0 0 48px; padding: 0; list-style: none; }
.trips { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hobbies { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.trip, .hobby { padding: 24px; border-radius: var(--radius); background: var(--paper); }
.trip img, .hobby img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.trip__city { margin: 16px 0 2px; font-size: 24px; font-weight: 750; }
.trip__craft { font-weight: 600; }
.trip__note { margin-top: 6px; color: var(--ink-soft); font-size: 16px; }
.hobby { display: flex; gap: 18px; align-items: flex-start; }
.hobby__title { margin: 0 0 4px; font-size: 20px; font-weight: 750; }
/* Hobby photos: rounded rectangles about half a gallery photo wide. Icons (SVG) keep the small circle. */
.hobby img:not([src$=".svg" i]) { flex: none; width: 120px; height: 150px; border-radius: 14px; }
@media (max-width: 599px) { .hobby img:not([src$=".svg" i]) { width: 96px; height: 120px; } }

/* ---------- Contact ---------- */

#contact { margin-bottom: 64px; }
.contact__email {
  display: inline-block;
  font-size: clamp(26px, 4vw, 52px);
  font-weight: 750;
  letter-spacing: -0.015em;
  text-decoration-thickness: 3px;
  overflow-wrap: anywhere;
}
.contact__links { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 0; padding: 0; list-style: none; }
.contact__status { margin-top: 36px; color: var(--ink-soft); }
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 15px;
}

/* ---------- Detail panel ---------- */

body:has(dialog[open]) { overflow: hidden; }

#panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(640px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: -24px 0 60px rgb(22 32 58 / 0.18);
}
#panel[open] { animation: panel-in 280ms cubic-bezier(.2, .8, .2, 1); }
#panel.is-closing { animation: panel-out 280ms ease-in forwards; }
#panel::backdrop { background: rgb(22 32 58 / 0.35); backdrop-filter: blur(4px); }

@keyframes panel-in { from { transform: translateX(100%); } }
@keyframes panel-out { to { transform: translateX(100%); } }

.panel__inner { padding: 28px clamp(20px, 4vw, 48px) 56px; }
.panel__close {
  display: block;
  margin: 0 0 28px auto;
  min-height: 44px;
  padding: 0 20px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
}
.panel__title {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.panel__summary { margin-top: 14px; color: var(--ink-soft); font-size: 19px; }
.panel__gallery { display: grid; gap: 14px; margin-top: 28px; }
.panel__figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; }
.panel__figure img { width: 100%; height: auto; }
.panel__body { margin-top: 28px; max-width: 62ch; line-height: 1.65; }
.panel__why { margin-top: 20px; padding-left: 16px; border-left: 4px solid var(--sun); color: var(--ink-soft); }
.panel__tech,
.panel__links { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 0; padding: 0; list-style: none; }
.panel__tech li { padding: 4px 12px; border-radius: 999px; background: var(--line); font-size: 15px; }
.panel__links { flex-direction: column; gap: 10px; }
.panel__links a { font-weight: 550; }

/* ---------- Terminal (easter egg) ---------- */

.term {
  position: fixed;
  left: var(--gutter);
  bottom: 24px;
  z-index: 50;
  width: min(560px, calc(100vw - 32px));
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 24px 64px rgb(22 32 58 / 0.35);
  font-family: ui-monospace, 'SF Mono', Menlo, 'DejaVu Sans Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
}
.term[hidden] { display: none; }
.term__out { max-height: 320px; margin: 0; padding: 16px 16px 4px; overflow: auto; font: inherit; white-space: pre-wrap; }
.term__form { display: flex; align-items: center; gap: 8px; padding: 4px 16px 14px; }
.term__prompt { color: var(--sun); }
.term__input { flex: 1; min-width: 0; border: 0; background: none; color: var(--paper); font: inherit; caret-color: var(--sun); }
.term__input:focus,
.term__input:focus-visible { outline: none; box-shadow: none; }

/* ---------- Phone ---------- */

@media (max-width: 899px) {
  .timeline { grid-template-columns: 1fr; gap: 22px; padding-left: 28px; }
  .timeline::before { top: 0; bottom: 0; left: 7px; right: auto; width: 2px; height: auto; }
  .milestone__dot { position: absolute; left: -28px; top: 4px; }
  .milestone__marker { margin-top: 0; }
  .startup { grid-template-columns: 1fr; gap: 28px; }
  .kde { grid-template-columns: 1fr; }
  .kde-preview { display: none; }
  .projects, .trips, .hobbies { grid-template-columns: 1fr; }
  .life__table { aspect-ratio: 16 / 9; }
  .kde-row { grid-template-columns: 2.2em minmax(0, 1fr) auto; }
  .kde-row__project { grid-column: 2; grid-row: 1; }
  .kde-row__title { grid-column: 2; grid-row: 2; }
  .kde-row__arrow { grid-column: 3; grid-row: 1 / span 2; }
}

.to-top { display: none; }
@media (max-width: 719px) {
  .to-top {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--sun);
    color: var(--ink);
    box-shadow: 0 4px 14px rgba(22, 32, 58, 0.18);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.2s, transform 0.2s;
  }
  .to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
  :root { --header-h: 60px; }
  .topbar__nav { display: none; }
  .topbar .button--small { margin-left: auto; }
  .section { margin-top: 72px; }
  .band { padding-top: 56px; padding-bottom: 56px; }
  #panel {
    inset: auto 0 0 0;
    width: 100vw;
    height: auto;
    max-height: 85dvh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  @keyframes panel-in { from { transform: translateY(100%); } }
  @keyframes panel-out { to { transform: translateY(100%); } }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chip { animation: none; }
  .project, .project:hover { transition: none; transform: none; }
  #panel[open], #panel.is-closing { animation: none; }
  .to-top { transition: none; }
}

/* Traditional links: blue and underlined everywhere, including buttons, nav and chips. */
a[href], a[href]:hover, a[href]:focus-visible { color: var(--link); text-decoration-color: currentColor; }
/* Punctuation glued to a chip is part of the sentence, not the link. */
a[href] .chip__glue { color: var(--ink); }
