/* ==========================================================================
   Tim Buyalski — portfolio, v2 ("material")
   Plain CSS, no build step.

   Principles
   - Flat colour only: black, white, greys and one orange accent. No gradients,
     no blurred shadows. Depth comes from solid surfaces and 1px borders.
   - High contrast: orange is always paired with black text (6.6:1), body
     text on white is near-black, secondary text never lighter than #5c5c5c
     on white or #b3b3b3 on black.
   - Rounded: buttons are full pills, cards 24px, chips 8px.
   ========================================================================== */

:root {
  /* colour */
  --black: #0a0a0a;
  --surface-dark: #161616;
  --line-dark: #2e2e2e;
  --white: #fff;
  --gray-50: #f5f5f5;
  --gray-100: #ebebeb;
  --gray-200: #e0e0e0;
  --gray-300: #cfcfcf;
  --text: #111;
  --text-2: #3a3a3a;
  --text-3: #5c5c5c;
  --on-dark: #fff;
  --on-dark-2: #d6d6d6;
  --on-dark-3: #b3b3b3;
  --orange: #f56218;
  --orange-hover: #f7803f;
  --orange-press: #d95210;
  --on-orange: #000;

  /* type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* shape */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* layout */
  --wrap: 1200px;
  --wrap-narrow: 760px;
  --gutter: 24px;
  --appbar-h: 68px;
  --section-y: 112px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--appbar-h) + 16px);
  -webkit-text-size-adjust: 100%;
  /* black canvas: on short pages the space below the footer (and the
     overscroll bounce) stays footer-coloured instead of showing white */
  background: var(--black);
}

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

body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* No lonely last words: body text avoids one/two-word final lines, and
   headings and short one-to-three-line texts split into even lines.
   Browsers without support simply wrap as before. */
p,
li,
dd,
blockquote,
figcaption {
  text-wrap: pretty;
}

h1,
h2,
h3,
.display,
.headline,
.hero__role,
.card__title,
.card__sub,
.feature__title,
.feature__sub,
.page-head__lead,
.project-head__lead,
.section__lede,
.footer__title,
.pager__name,
.trait .card__title {
  text-wrap: balance;
}

img,
video,
iframe {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

::selection {
  background: var(--orange);
  color: var(--on-orange);
}

:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.wrap--narrow {
  max-width: calc(var(--wrap-narrow) + 2 * var(--gutter));
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: var(--orange);
  color: var(--on-orange);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Type ---------- */
.display {
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.display--xl {
  font-size: clamp(48px, 9vw, 104px);
  line-height: 0.95;
}

.headline {
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.title {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
}

.overline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.overline--accent::before {
  content: "";
  width: 24px;
  height: 4px;
  border-radius: 2px;
  background: var(--orange);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: inherit;
  font: 700 15px/1 var(--font);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--sm {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

.btn--block {
  display: flex;
  width: 100%;
}

.btn--filled {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--on-orange);
}

.btn--filled:hover {
  background: var(--orange-hover);
  border-color: var(--orange-hover);
}

.btn--filled:active {
  background: var(--orange-press);
  border-color: var(--orange-press);
}

.btn--outlined {
  border-color: var(--black);
  color: var(--black);
}

.btn--outlined:hover {
  background: var(--black);
  color: var(--white);
}

.btn--outlined-light {
  border-color: var(--white);
  color: var(--white);
}

.btn--outlined-light:hover {
  background: var(--white);
  color: var(--black);
}

.btn--text,
.btn--text-light {
  padding: 0 14px;
  color: var(--on-dark);
}

.btn--text:hover,
.btn--text-light:hover {
  background: var(--line-dark);
}

.btn--back {
  display: flex;
  width: fit-content;
  height: 40px;
  margin: 0 0 28px -14px;
  font-size: 14px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  color: var(--black);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: var(--orange);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.icon-btn--accent {
  width: 48px;
  height: 48px;
  background: var(--orange);
  color: var(--on-orange);
}

.icon-btn--accent:hover {
  background: var(--orange-hover);
}

/* segmented button (BY/EN, photo sets) */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--on-dark-3);
  border-radius: var(--r-pill);
}

.segmented button {
  height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--on-dark);
  font: 700 13px/1 var(--font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.segmented button:hover {
  background: var(--line-dark);
}

.segmented button.is-active {
  background: var(--orange);
  color: var(--on-orange);
}

/* solid black pill, for use on white backgrounds */
.segmented--solid {
  padding: 6px;
  border-color: var(--black);
  background: var(--black);
}

.segmented--solid button {
  height: 34px;
  padding: 0 18px;
}

.segmented--light {
  border-color: var(--black);
}

.segmented--light button {
  color: var(--black);
}

.segmented--light button:hover {
  background: var(--gray-100);
}

/* chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 2px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
}

.chip--accent {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--on-orange);
  font-weight: 700;
}

/* ---------- App bar ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--black);
  color: var(--on-dark);
  border-bottom: 1px solid var(--line-dark);
}

.appbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--appbar-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

/* "Tim Buyalski" slides out, "TimPixel" slides in on hover/focus.
   Both names share one grid cell, so the width never jumps. */
.brand__name {
  display: inline-grid;
  overflow: hidden;
  vertical-align: bottom;
}

.brand__default,
.brand__alt {
  grid-area: 1 / 1;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.brand__alt {
  transform: translateY(100%);
  opacity: 0;
}

.brand:hover .brand__default,
.brand:focus-visible .brand__default {
  transform: translateY(-100%);
  opacity: 0;
}

.brand:hover .brand__alt,
.brand:focus-visible .brand__alt {
  transform: none;
  opacity: 1;
}

.brand__accent {
  margin-left: 6px;
  color: var(--on-dark-3);
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
}

/* Photo by default, drawn avatar on hover (in step with the TimPixel name swap) */
.brand__avatar {
  display: grid;
  flex: none;
}

.brand__avatar img {
  grid-area: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  transition: opacity 0.25s ease;
}

.brand__drawn {
  opacity: 0;
}

.brand:hover .brand__photo,
.brand:focus-visible .brand__photo {
  opacity: 0;
}

.brand:hover .brand__drawn,
.brand:focus-visible .brand__drawn {
  opacity: 1;
}

.appbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.appbar__nav .btn--filled {
  margin-left: 8px;
  background: #fff;
  border-color: #fff;
  color: var(--black);
}

.appbar__nav .btn--filled:hover {
  background: var(--gray-200);
  border-color: var(--gray-200);
}

.appbar__nav .btn--filled:active {
  background: var(--gray-300);
  border-color: var(--gray-300);
}

.appbar__nav [aria-current="page"]:not(.btn--filled) {
  background: var(--line-dark);
}

/* "Projects" dropdown (built by js/main.js from js/projects.js).
   The panel hangs off the right edge of the nav, in line with the page edge. */
.appbar__nav {
  position: relative;
}

.navmenu__toggle {
  gap: 4px;
  padding-right: 10px;
}

.navmenu__toggle svg {
  transition: transform 0.2s ease;
}

.navmenu__toggle[aria-expanded="true"] {
  background: var(--line-dark);
}

.navmenu__toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.navmenu__panel {
  position: absolute;
  top: calc(100% + 13px);
  right: 0;
  z-index: 30;
  width: min(680px, calc(100vw - 2 * var(--gutter)));
  padding: 12px;
  border: 1px solid var(--line-dark);
  border-radius: 24px;
  background: var(--surface-dark);
  color: var(--on-dark);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  animation: navmenu-in 0.16s ease-out;
}

@keyframes navmenu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* invisible bridge over the gap, so the mouse can travel down without
   leaving the menu */
.navmenu__panel::before {
  content: "";
  position: absolute;
  inset: -14px 0 100% 0;
}

.navmenu__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.navmenu__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 16px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.navmenu__item:hover,
.navmenu__item:focus-visible {
  background: var(--line-dark);
}

.navmenu__thumb {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--black);
}

.navmenu__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.navmenu__thumb .monogram {
  font-size: 18px;
}

.navmenu__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.navmenu__name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.navmenu__item[aria-current="page"] .navmenu__name {
  color: var(--orange);
}

.navmenu__sub {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 13px;
  line-height: 1.4;
  color: var(--on-dark-3);
}

.navmenu__all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 14px 10px 4px;
  border-top: 1px solid var(--line-dark);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  color: var(--on-dark-2);
}

.navmenu__all:hover,
.navmenu__all:focus-visible {
  color: var(--orange);
}

/* CV download sits with the portal links: same white pill, plus a label */
.icon-btn--cv {
  display: inline-flex;
  gap: 6px;
  width: auto;
  padding: 0 16px 0 12px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
}

/* thin divider between the CV pill and the portal icons,
   matching the one between Contact and the group */
.icon-btn--cv {
  position: relative;
  margin-right: 16px;
}

.icon-btn--cv::after {
  content: "";
  position: absolute;
  top: 0;
  right: -17px;
  bottom: 0;
  width: 1px;
  background: var(--line-dark);
}

.appbar__icons {
  display: flex;
  gap: 8px;
  margin-left: 8px;
}

/* ---------- Bands / sections ---------- */
.band--dark,
.section--dark {
  background: var(--black);
  color: var(--on-dark);
}

.section {
  padding: var(--section-y) 0;
}

.section--tinted {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
}

.section__head {
  max-width: 760px;
  margin-bottom: 72px;
}

.section__head > * + .headline {
  margin-top: 16px;
}

.section__lede {
  margin-top: 32px;
  font-size: 19px;
  line-height: 1.7;
  font-weight: 700; /* same weight as the card subtitles */
  color: var(--text-3);
}

.section--dark .section__lede {
  color: var(--on-dark-3);
}


/* ---------- Home hero ---------- */
/* fills the first screen; content centred vertically */
.hero {
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--appbar-h));
  min-height: calc(100svh - var(--appbar-h));
  padding: 64px 0 80px;
}

.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}

.hero__title {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.hero__name {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--on-dark-3);
}

.hero__name .chip {
  letter-spacing: 0;
  text-transform: none;
}

/* Same type as the name, dimmer (3.2:1 on black, large text) */
.hero__aka {
  color: #616161;
}

.hero__role {
  font-size: clamp(30px, 4.1vw, 56px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.hero__accent {
  display: block;
  color: var(--orange);
}

.hero__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.hero__stack li {
  padding: 6px 14px;
  border: 1px solid #4a4a4a;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--on-dark);
}

.hero__hello {
  margin-top: 36px;
  font-size: 24px;
  line-height: 1.3;
  color: var(--on-dark);
}

.hero__note {
  margin-top: 8px;
  font-size: 15px;
  color: var(--on-dark-3);
}

.hero__intro {
  max-width: 54ch;
  margin-top: 88px;
  font-size: 20px;
  line-height: 1.65;
  color: var(--on-dark-2);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 48px;
}

.quote-card {
  padding: 32px;
  border: 1px solid var(--line-dark);
  border-radius: var(--r-xl);
  background: var(--surface-dark);
}

.quote-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--on-dark-3);
}

.quote-card blockquote {
  margin-top: 28px;
}

.quote-card p {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--on-dark);
}

.quote-card p + p {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line-dark);
}

/* ---------- Random project roller ---------- */
.hero__side {
  display: grid;
  gap: 20px;
}

.roller {
  padding: 24px;
  border: 1px solid var(--line-dark);
  border-radius: var(--r-xl);
  background: var(--surface-dark);
}

.roller__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--on-dark-3);
}

.roller__dice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px 0 10px;
  border: 1.5px solid var(--on-dark-3);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--on-dark);
  font: 700 13px/1 var(--font);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.roller__dice:hover {
  border-color: var(--orange);
  background: var(--orange);
  color: var(--on-orange);
}

.roller__dice:disabled {
  cursor: default;
  opacity: 0.5;
}

.roller__dice:disabled:hover {
  border-color: var(--on-dark-3);
  background: transparent;
  color: var(--on-dark);
}

.roller.is-rolling .roller__dice svg {
  animation: dice-spin 0.5s linear infinite;
}

.roller__card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding: 12px;
  border: 2px solid var(--line-dark);
  border-radius: var(--r-lg);
  background: var(--black);
  color: var(--on-dark);
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.roller__card:hover {
  border-color: var(--white);
}

.roller.is-rolling .roller__card {
  pointer-events: none;
}

.roller__media {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--surface-dark);
}

.roller__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* projects without artwork get a monogram tile */
.monogram {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--orange);
}

.roller__text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.roller__title {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
  text-transform: uppercase;
}

.roller__sub {
  font-size: 14px;
  line-height: 1.45;
  color: var(--on-dark-3);
}

.roller__arrow {
  color: var(--orange);
  transition: transform 0.2s ease;
}

.roller__card:hover .roller__arrow {
  transform: translateX(3px);
}

/* each tick of the roll slides the new entry in from above */
.roller__card.is-tick .roller__media,
.roller__card.is-tick .roller__text {
  animation: roll-tick 0.12s ease-out;
}

.roller__card.is-landed {
  animation: roll-land 0.7s ease-out;
}

/* ---------- Featured project tiles (newest / coolest) ---------- */
.featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.feature {
  display: flex;
  flex-direction: column;
  padding: 16px 16px 20px;
  border: 1px solid var(--line-dark);
  border-radius: var(--r-xl);
  background: var(--surface-dark);
  color: var(--on-dark);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.feature:hover {
  border-color: var(--white);
  transform: translateY(-4px);
}

.feature__label {
  padding: 4px 4px 14px;
  color: var(--on-dark-3);
}

.feature__label::before,
.roller__head > .overline::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange);
}

.feature__media {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--black);
}

.feature__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.feature:hover .feature__media img {
  transform: scale(1.04);
}

.feature__media .monogram {
  font-size: 56px;
}

.feature__title {
  margin-top: 16px;
  padding: 0 4px;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 800;
  text-transform: uppercase;
}

.feature__sub {
  margin-top: 6px;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--on-dark-3);
}

/* about page: intro text beside the quote card */
.page-head__split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}

@keyframes roll-tick {
  from {
    transform: translateY(-14px);
    opacity: 0.3;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@keyframes roll-land {
  0% {
    border-color: var(--orange);
    transform: scale(1);
  }
  25% {
    border-color: var(--orange);
    transform: scale(1.03);
  }
  100% {
    border-color: var(--line-dark);
    transform: scale(1);
  }
}

@keyframes dice-spin {
  to {
    transform: rotate(360deg);
  }
}

.avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 2px solid var(--orange);
  border-radius: 50%;
  object-fit: cover;
  object-position: left center;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}

.card-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
}

.card-grid--next {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid__wide {
  grid-column: 1 / -1;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: 24px;
  background: var(--white);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 16px 48px rgba(0, 0, 0, 0.12);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

a.card:hover {
  border-color: var(--black);
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08), 0 24px 56px rgba(0, 0, 0, 0.16);
}

.card__media {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--black);
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.4s ease;
}

a.card:hover .card__media img {
  transform: scale(1.04);
}

.card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 28px;
}

.card__title {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

/* linked cards: an arrow after the title says "this opens something";
   on hover it turns orange and nudges right */
a.card .card__title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

a.card .card__title::after {
  content: "";
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  background: var(--text-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

a.card--dark .card__title::after {
  background: var(--on-dark-3);
}

a.card:hover .card__title::after,
a.card:focus-visible .card__title::after {
  background: var(--orange);
  transform: translateX(4px);
}

.card__sub {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 700; /* same weight and colour as the ROLE / TECH labels */
  color: var(--text-3);
}

.card__role,
.card__skills {
  font-size: 15px;
  line-height: 1.5;
}

.card__skills {
  color: var(--text-2);
}

/* detail rows, laid out like the project-page sidebar:
   equal space above and below a thin separator line */
.card__role,
.card__tech,
.card__skills {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-200);
}

/* extra air between the title/subtitle block and the first separator */
.card__sub + .card__role {
  margin-top: 28px;
}

.card--dark .card__role,
.card--dark .card__tech,
.card--dark .card__skills {
  border-color: var(--line-dark);
}

/* status tag ("Planned", "In development") above the title */
.card__body > .chip:first-child {
  margin-bottom: 14px;
}

/* section labels: ROLE / TECH / SOFT SKILLS / PLAN */
.card__role b,
.card__tech b,
.card__skills b {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Line up title / subtitle / detail rows across neighbouring cards, so the
   separator lines sit at the same height. Each card spans --card-rows rows
   of the parent grid and shares them through subgrid. */
@supports (grid-template-rows: subgrid) {
  .card-grid {
    --card-rows: 6; /* media, title, subtitle, role, tech, skills */
  }

  .card-grid--compact,
  .card-grid--next {
    --card-rows: 5; /* no media row */
  }

  .card-grid > li:not(.card-grid__wide),
  .card-grid > li:not(.card-grid__wide) > .card {
    display: grid;
    grid-template-rows: subgrid;
    row-gap: 0;
  }

  .card-grid > li:not(.card-grid__wide) {
    grid-row: span var(--card-rows);
  }

  .card-grid > li:not(.card-grid__wide) > .card {
    grid-row: 1 / -1;
  }

  .card-grid > li:not(.card-grid__wide) .card__body {
    display: grid;
    grid-row: 1 / -1;
    grid-template-rows: subgrid;
    row-gap: 0;
    align-content: start;
  }

  .card-grid > li:not(.card-grid__wide) .card__media + .card__body {
    grid-row: 2 / -1;
  }
}

/* dark variant */
.card--dark {
  border-color: var(--line-dark);
  background: var(--surface-dark);
  color: var(--on-dark);
}

a.card--dark:hover {
  border-color: var(--white);
}

.card--dark .card__sub,
.card--dark .card__skills {
  color: var(--on-dark-3);
}

.card--dark .card__role b,
.card--dark .card__tech b,
.card--dark .card__skills b {
  color: var(--on-dark-3);
}

.card--dark .chip:not(.chip--accent) {
  border-color: #4a4a4a;
  background: transparent;
  color: var(--on-dark);
}

/* media beside text */
.card--row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
}

.card--row .card__media {
  aspect-ratio: auto;
  min-height: 100%;
}

.card--row .card__body {
  padding: 36px;
  justify-content: center;
}

/* ---------- Page heads (about, contact, brainstorm, projects) ---------- */
.page-head {
  padding: 80px 0 96px;
}

.page-head .overline + .display {
  margin-top: 24px;
}

/* contact: no footer, the dark head fills the whole screen instead */
.page-head--full {
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--appbar-h));
  min-height: calc(100svh - var(--appbar-h));
}

.page-head--full > .wrap {
  width: 100%;
}

.elsewhere {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--line-dark);
}

.elsewhere__label {
  color: var(--on-dark-3);
}

.elsewhere__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.link-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--line-dark);
  border-radius: 24px;
  background: var(--surface-dark);
  color: var(--on-dark);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.link-tile:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}

.link-tile__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--white);
}

.link-tile__text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.link-tile__name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.link-tile__handle {
  font-size: 14px;
  color: var(--on-dark-3);
  overflow-wrap: anywhere;
}

.link-tile__arrow {
  flex-shrink: 0;
  color: var(--on-dark-3);
}

.link-tile:hover .link-tile__arrow {
  color: var(--orange);
}

@media (max-width: 960px) {
  .elsewhere__list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.page-head__lead {
  max-width: 60ch;
  margin-top: 36px;
  font-size: 20px;
  line-height: 1.65;
  color: var(--on-dark-2);
}

.project-head {
  padding: 56px 0 88px;
}

.project-head__inner--cover {
  display: grid;
  /* text | gap | cover | spacer. The spacer makes the cover end where the
     article text below ends: sidebar 320 + gap 64 + article 720 = 1104px. */
  grid-template-columns: minmax(0, 1fr) 64px 320px max(0px, calc(100% - 1104px));
  column-gap: 0;
  align-items: end;
}

.project-head__inner--cover > .project-head__cover {
  grid-column: 3;
}

.project-head .display {
  margin-top: 20px;
}

.project-head .overline {
  color: var(--on-dark-3);
}

.project-head__lead {
  max-width: 34ch;
  margin-top: 32px;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.4;
  color: var(--on-dark-2);
}

.project-head__cover {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 24px;
}

/* ---------- Project body ---------- */
.project-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
  padding-top: 72px;
  padding-bottom: 96px;
}

.info-card {
  position: sticky;
  top: calc(var(--appbar-h) + 24px);
  padding: 28px;
  border: 1px solid var(--gray-200);
  border-radius: 24px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 16px 48px rgba(0, 0, 0, 0.12);
}

.info-card__list > div + div {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--gray-200);
}

.info-card dt {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.info-card dd {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.55;
}

.info-card__actions {
  display: grid;
  gap: 10px;
  margin-top: 28px;
}

.info-card .btn {
  white-space: normal;
  height: auto;
  min-height: 48px;
  padding-top: 10px;
  padding-bottom: 10px;
  text-align: center;
  line-height: 1.25;
}

.article {
  max-width: 720px;
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
}

.article > * + * {
  margin-top: 36px;
}

.article > p + p {
  margin-top: 20px;
}

/* captions / asides read as small notes: soft gray box, like a quiet card */
.article .caption {
  padding: 14px 18px;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  background: var(--gray-50);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-3);
}

.article > p.caption + *:not(p) {
  margin-top: 16px;
}

.article a:not(.media):not(.yt) {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.article a:not(.media):not(.yt):hover {
  background: var(--orange);
  color: var(--on-orange);
  text-decoration: none;
}

/* ---------- Media ---------- */
.media {
  display: block;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  background: var(--gray-50);
}

a.media {
  cursor: zoom-in;
}

.media img {
  width: 100%;
  transition: transform 0.35s ease;
}

a.media:hover img {
  transform: scale(1.02);
}

.media--video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--black);
}

.gallery {
  display: flex;
  gap: 16px;
}

.gallery > figure {
  min-width: 0;
}

.gallery .media {
  height: 100%;
}

.gallery .media img {
  height: 100%;
  object-fit: cover;
}

/* YouTube: thumbnail until clicked, then swapped for the player */
.yt {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--black);
  color: var(--on-dark);
  text-decoration: none;
}

.yt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt__play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--on-orange);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.yt:hover .yt__play {
  transform: scale(1.08);
  background: var(--orange-hover);
}

.yt__title {
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: calc(100% - 32px);
  padding: 6px 12px;
  border-radius: var(--r-sm);
  background: var(--black);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.yt iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* dark strip holding a row of images */
.strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border-radius: 24px;
  background: var(--black);
}

.strip li {
  flex: 0 1 200px;
}

.strip .media {
  border-color: var(--line-dark);
  border-radius: var(--r-md);
}

.strip--icons {
  justify-content: space-between;
  padding: 24px 32px;
}

.strip--icons li {
  flex: 0 1 auto;
}

.strip--icons img {
  width: 52px;
  height: auto;
  image-rendering: pixelated;
}

/* ---------- Pager ---------- */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding-bottom: 96px;
}

.pager__link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 28px;
  border: 1px solid var(--gray-200);
  border-radius: 24px;
  background: var(--white);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.pager__link .overline {
  color: var(--text-3);
}

.pager__link:hover {
  border-color: var(--black);
}

.pager__link--next {
  align-items: flex-end;
  text-align: right;
}

.pager__name {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
  text-transform: uppercase;
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 72px;
  align-items: start;
}

.about__photos {
  position: sticky;
  top: calc(var(--appbar-h) + 24px);
}

.photo-set {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.photo-set[hidden] {
  display: none;
}

.photo-set img {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

/* bullet points as cards, same look as the project cards */
.trait-grid {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

/* one card per row */
.trait {
  display: block;
  padding: 28px 32px;
  transition: border-color 0.2s ease;
}

.trait p {
  margin-top: 10px;
}

.trait:hover {
  border-color: var(--black);
}

.trait .card__title {
  font-size: 19px;
  line-height: 1.25;
}

.trait p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-2);
}

/* ---------- Contact ---------- */
.mail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 44px;
}

/* "Download my CV" (contact + about) */
.btn--cv {
  margin-top: 36px;
}

.btn__meta {
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.14);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--on-orange);
}

.mail-row__address {
  font-size: clamp(24px, 4.2vw, 40px);
  line-height: 1.1;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.mail-row__address:hover {
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.snackbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  padding: 14px 20px;
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--black);
  font-size: 15px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.snackbar.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Footer ---------- */
.footer {
  padding: 96px 0;
  background: var(--black);
  color: var(--on-dark);
  border-top: 1px solid var(--line-dark);
}

.footer__title {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.footer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.footer__mail {
  display: inline-block;
  margin-top: 40px;
  color: var(--on-dark-3);
  font-size: 18px;
  text-decoration: none;
}

.footer__mail:hover {
  color: var(--on-dark);
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-underline-offset: 4px;
}

/* ---------- Lightbox ---------- */
.lightbox {
  max-width: 94vw;
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.9);
}

.lightbox img {
  max-width: 94vw;
  max-height: 88vh;
  width: auto;
  border-radius: var(--r-md);
}

.lightbox__close {
  position: fixed;
  top: 16px;
  right: 16px;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero__inner,
  .page-head__split,
  .project-head__inner--cover,
  .project-layout,
  .about {
    grid-template-columns: 1fr;
  }

  .hero__inner {
    gap: 48px;
  }

  .project-head__inner--cover {
    gap: 40px;
  }

  .project-head__inner--cover > .project-head__cover {
    grid-column: auto;
  }

  .project-head__cover {
    max-width: 300px;
  }

  .project-layout {
    gap: 40px;
    padding-top: 48px;
  }

  .info-card,
  .about__photos {
    position: static;
  }

  .about {
    gap: 56px;
  }

  .card-grid--next {
    grid-template-columns: 1fr 1fr;
  }

  .card--row {
    grid-template-columns: 1fr;
  }

  .card--row .card__media {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
    --appbar-h: 60px;
    --section-y: 72px;
  }

  /* phones: portal icons hide, the CV stays as a round download icon */
  .appbar__icons {
    margin-left: 4px;
  }

  .appbar__icons > :not(.icon-btn--cv) {
    display: none;
  }

  .icon-btn--cv {
    width: 40px;
    margin-right: 0;
    padding: 0;
  }

  .icon-btn--cv span,
  .icon-btn--cv::after {
    display: none;
  }

  /* phones: the projects menu drops down full width and scrolls */
  .navmenu__panel {
    position: fixed;
    top: calc(var(--appbar-h) + 8px);
    right: var(--gutter);
    left: var(--gutter);
    width: auto;
    max-height: calc(100svh - var(--appbar-h) - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .navmenu__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero {
    padding: 56px 0 72px;
  }

  .page-head {
    padding: 48px 0 64px;
  }

  .project-head {
    padding: 40px 0 64px;
  }

  .quote-card {
    padding: 24px;
  }

  .quote-card p {
    font-size: 19px;
  }

  .card-grid--next {
    grid-template-columns: 1fr;
  }

  .card--row .card__body {
    padding: 24px;
  }

  .roller {
    padding: 20px;
  }

  .roller__card {
    grid-template-columns: 64px minmax(0, 1fr) 20px;
    gap: 14px;
    padding: 10px;
  }

  .roller__media {
    width: 64px;
    height: 64px;
  }

  .roller__title {
    font-size: 17px;
  }

  .featured {
    gap: 12px;
  }

  .feature {
    padding: 12px 12px 16px;
  }

  .gallery {
    gap: 8px;
  }

  .strip--icons {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 16px;
  }

  .strip--icons img {
    width: 32px;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .section__head {
    margin-bottom: 40px;
  }
}

/* app bar on small screens: the name hides, then everything tightens so
   Projects / About / Contact always fit next to the logo */
@media (max-width: 900px) {
  .brand span {
    display: none;
  }
}

@media (max-width: 440px) {
  .appbar__nav {
    gap: 0;
  }

  .appbar__nav .btn--text {
    padding: 0 8px;
  }

  .appbar__nav .navmenu__toggle {
    gap: 2px;
    padding-right: 4px;
  }

  .appbar__nav .btn--filled {
    margin-left: 4px;
    padding: 0 14px;
  }
}

/* tiniest phones: drop the dropdown chevron to keep the logo on screen */
@media (max-width: 360px) {
  .appbar__nav .navmenu__toggle svg {
    display: none;
  }

  .appbar__inner {
    gap: 8px;
  }

  .brand {
    flex-shrink: 0;
  }

  .appbar__nav .btn--text,
  .appbar__nav .navmenu__toggle {
    padding: 0 6px;
  }

  .appbar__nav .btn--filled {
    padding: 0 12px;
  }

  .appbar__icons {
    margin-left: 2px;
  }

  .icon-btn--cv {
    width: 36px;
    height: 36px;
  }

  .appbar__inner {
    gap: 4px;
  }

  .appbar__nav .btn--text,
  .appbar__nav .navmenu__toggle {
    padding: 0 5px;
  }
}
