/* Marco Cassano — Portfolio
   Display font: Inter Tight (stand-in for Degular Display used in the PDF).
   If you have Adobe Fonts, swap --font-display with "degular-display". */

:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #8a8a8a;
  --line: #e6e6e6;
  --font-display: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --gutter: clamp(16px, 3vw, 40px);
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  transition: background-color .35s ease, color .35s ease;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }

/* ---------- Header / nav ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { font-family: var(--font-display); font-size: 18px; letter-spacing: -0.01em; }
.page-home .brand { visibility: hidden; }
.nav { display: flex; gap: clamp(14px, 2.4vw, 32px); font-size: 14px; margin-left: auto; }
.nav a { position: relative; padding: 4px 0; color: var(--muted); transition: color .2s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
}

main { padding-top: var(--header-h); }
.wrap { padding-left: var(--gutter); padding-right: var(--gutter); max-width: 1440px; margin: 0 auto; }

/* ---------- Home: hero (cover) ---------- */
.hero {
  min-height: calc(100svh - var(--header-h));
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(8px, 2vw, 24px) var(--gutter) clamp(24px, 5vw, 56px);
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.hero-id { font-family: var(--font-display); font-size: clamp(20px, 2.2vw, 30px); line-height: 1.2; letter-spacing: -0.01em; }
.hero-mail { font-size: 13px; padding-top: 6px; }
.hero-mail:hover { text-decoration: underline; }
.kern-rt { letter-spacing: 0.035em; } /* opens the tight r–t pair in "Portfolio" */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(84px, 19vw, 300px);
  line-height: .85;
  letter-spacing: -0.045em;
  margin-left: -0.05em;
}

/* ---------- Home: about ---------- */
.about { padding: clamp(64px, 10vw, 140px) 0; border-top: 1px solid var(--line); }
.about-grid {
  display: grid; grid-template-columns: 1fr auto; gap: clamp(24px, 4vw, 64px); align-items: center;
}
.hej { font-size: clamp(72px, 10vw, 150px); line-height: .95; letter-spacing: -0.04em; margin-bottom: 24px; }
.about-lead { font-family: var(--font-display); font-size: clamp(22px, 2.6vw, 38px); line-height: 1.2; letter-spacing: -0.015em; }
.about-lead strong { font-weight: 600; }
.avatar {
  width: clamp(180px, 22vw, 320px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.about-text {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px, 4vw, 64px);
  margin-top: clamp(48px, 7vw, 96px); max-width: 1100px; margin-left: auto;
  font-size: 15px; line-height: 1.6;
}
.home-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(48px, 6vw, 80px); }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border: 1px solid var(--fg); border-radius: 999px; font-size: 14px;
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--fg); color: var(--bg); }

/* ---------- Page titles ---------- */
.page-head { padding: clamp(32px, 6vw, 80px) 0 clamp(32px, 5vw, 64px); }
.page-title { font-size: clamp(56px, 10vw, 140px); line-height: .9; letter-spacing: -0.04em; }

/* ---------- Projects ---------- */
.toc { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.toc li { border-bottom: 1px solid var(--line); }
.toc a {
  display: flex; align-items: baseline; gap: clamp(12px, 2vw, 28px);
  padding: 18px 0; font-family: var(--font-display); font-size: clamp(22px, 3vw, 40px); letter-spacing: -0.015em;
  transition: padding-left .25s;
}
.toc a:hover { padding-left: 12px; }
.toc .num { color: var(--muted); min-width: 2ch; }
.toc .arrow { margin-left: auto; font-size: .7em; color: var(--muted); }

.client { padding-top: clamp(80px, 10vw, 140px); scroll-margin-top: var(--header-h); }
.client-head { display: flex; align-items: baseline; gap: clamp(12px, 2vw, 24px); font-family: var(--font-display); font-size: clamp(30px, 4vw, 56px); letter-spacing: -0.02em; line-height: 1.05; padding-bottom: 24px; border-bottom: 1px solid var(--fg); }
.client-head .num { color: var(--muted); }

.work { padding-top: clamp(40px, 6vw, 80px); }
.work-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 24px; flex-wrap: wrap; margin-bottom: clamp(20px, 3vw, 32px); }
.work-title { font-size: clamp(20px, 2vw, 28px); color: var(--muted); letter-spacing: -0.01em; }
.role { font-size: 12px; color: var(--muted); }

.grid { display: grid; gap: clamp(10px, 1.4vw, 20px); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-feature { grid-template-columns: 1.6fr 1fr; }
.g-feature > .stack { display: grid; gap: inherit; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

.media { overflow: hidden; background: color-mix(in srgb, var(--fg) 5%, var(--bg)); cursor: zoom-in; }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.media:hover img { transform: scale(1.025); }
.r-16-9 { aspect-ratio: 16 / 9; }
.r-3-2 { aspect-ratio: 3 / 2; }
.r-4-5 { aspect-ratio: 4 / 5; }
.r-2-1 { aspect-ratio: 2 / 1; }
.r-auto img { height: auto; }

.text-block { margin-top: clamp(28px, 4vw, 48px); display: grid; gap: clamp(20px, 3vw, 48px); }
.text-block.cols-3 { grid-template-columns: repeat(3, 1fr); }
.text-block.cols-2 { grid-template-columns: 1fr 1fr; }
.text-block h4, .label { font-family: var(--font-body); font-weight: 600; font-size: 13px; letter-spacing: 0; margin-bottom: 8px; }
.text-block p { font-size: 14px; line-height: 1.6; max-width: 46ch; }
.intro p { max-width: 70ch; }

.quote {
  font-family: var(--font-display); font-size: clamp(28px, 3.6vw, 52px); line-height: 1.12; letter-spacing: -0.02em;
  max-width: 22ch; margin: clamp(16px, 3vw, 40px) 0;
}
.quote-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(20px, 4vw, 56px); align-items: center; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 3vw, 40px); margin-top: clamp(28px, 4vw, 48px); }
.stat .label { margin-bottom: 14px; }
.stat-circle {
  width: min(100%, 240px); aspect-ratio: 1 / 1; border-radius: 50%; background: var(--fg); color: var(--bg);
  display: grid; place-items: center; font-family: var(--font-display); font-size: clamp(26px, 3.4vw, 48px); letter-spacing: -0.02em;
}
.footnote { font-size: 11px; color: var(--muted); margin-top: 20px; }

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(16px, 2vw, 32px); margin-top: clamp(28px, 4vw, 48px); padding-top: 24px; border-top: 1px solid var(--line); }
.steps .n { font-weight: 600; font-size: 12px; margin-bottom: 8px; }
.steps p { font-size: 14px; line-height: 1.5; }

/* ---------- Timeline ---------- */
.page-timeline { --bg: #000; --fg: #fff; --muted: #8c8c8c; --line: #2a2a2a; }
.tl-intro { max-width: 80ch; font-size: 15px; line-height: 1.65; margin-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(64px, 8vw, 120px); }

.tl-scroller { position: relative; }
.tl-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr) 0.55fr;
  --line-y: 88px; /* vertical position of the arrow line */
}
.tl-line {
  position: absolute; left: 6px; right: 0; top: var(--line-y);
  height: 1px; background: var(--fg);
}
.tl-line::after { /* arrow head */
  content: ""; position: absolute; right: 0; top: -6px; width: 12px; height: 12px;
  border-top: 1px solid var(--fg); border-right: 1px solid var(--fg); transform: rotate(45deg); transform-origin: center;
}
.tl-runner {
  position: absolute; top: var(--line-y); left: 6px; right: 12px; height: 0; pointer-events: none;
}
.tl-runner span {
  position: absolute; top: 0; left: 0;
  width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--fg) 18%, transparent), 0 0 18px 4px color-mix(in srgb, var(--fg) 55%, transparent);
  animation: run 5.5s cubic-bezier(.45,.05,.55,.95) infinite;
}
@keyframes run {
  0%   { left: 0%;   opacity: 0; transform: scale(.6); }
  6%   { opacity: 1; transform: scale(1); }
  92%  { opacity: 1; transform: scale(1); }
  100% { left: 100%; opacity: 0; transform: scale(.6); }
}
@media (prefers-reduced-motion: reduce) {
  .tl-runner span { animation-duration: 12s; }
}

.tl-step { position: relative; padding-right: clamp(16px, 3vw, 40px); }
.tl-company { font-size: 12px; color: var(--muted); height: 22px; }
.tl-role { font-size: 14px; font-weight: 600; height: 40px; }
.tl-dot {
  position: absolute; left: 0; top: var(--line-y); width: 13px; height: 13px; margin-top: -6px;
  border-radius: 50%; background: var(--fg);
}
.tl-year { margin-top: calc(var(--line-y) - 62px + 26px); font-size: 13px; }
.tl-step h3 { font-family: var(--font-body); font-weight: 600; font-size: 14px; letter-spacing: 0; margin-top: clamp(32px, 4vw, 48px); margin-bottom: 8px; }
.tl-step p { font-size: 14px; line-height: 1.6; max-width: 36ch; }
.tl-today { text-align: right; padding-right: 0; }
.tl-today .tl-year { color: var(--fg); }
.tl-hint { display: none; }

/* ---------- Contacts ---------- */
.contact { min-height: calc(100svh - var(--header-h)); display: grid; grid-template-rows: auto 1fr auto; padding-bottom: clamp(24px, 5vw, 56px); }
.contact-sub { font-size: clamp(15px, 1.4vw, 18px); margin-top: 16px; }
.contact-list { list-style: none; padding: 0; margin: clamp(56px, 8vw, 120px) 0; display: grid; gap: 4px; }
.contact-list a, .contact-list span {
  font-family: var(--font-display); font-size: clamp(22px, 3.4vw, 48px); letter-spacing: -0.02em; line-height: 1.25;
}
.contact-list a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .35s; }
.contact-list a:hover { background-size: 100% 1px; }
.contact-list small { display: block; font-size: 12px; color: var(--muted); margin-top: 18px; }
.tak { font-family: var(--font-display); font-size: clamp(96px, 20vw, 320px); line-height: .85; letter-spacing: -0.05em; margin-left: -0.05em; }

/* ---------- Footer ---------- */
.site-footer { padding: 32px var(--gutter); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: clamp(80px, 10vw, 140px); }
.site-footer a:hover { color: var(--fg); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button {
  position: absolute; top: 14px; right: 16px; background: none; border: 0; color: #fff; font-size: 28px; cursor: pointer; line-height: 1;
}

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .g-3.posts { grid-template-columns: repeat(3, 1fr); }
  .g-feature { grid-template-columns: 1fr; }
  .text-block.cols-3 { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .quote-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --header-h: 56px; }
  .brand { display: none; }
  .site-header { justify-content: flex-end; }
  .nav { gap: 16px; font-size: 13px; }

  .about-grid { grid-template-columns: 1fr; }
  .avatar { order: -1; width: 64vw; max-width: 280px; }
  .about-text { grid-template-columns: 1fr; }

  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .g-3.posts { grid-template-columns: 1fr 1fr; }
  .g-3.posts > :first-child { grid-column: 1 / -1; }
  .g-4.thumbs { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: auto; }
  .text-block.cols-3, .text-block.cols-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .stat .label { font-size: 11px; }
  .stat-circle { font-size: 22px; }
  .steps { grid-template-columns: 1fr; }

  /* Timeline: lateral scrolling */
  .tl-scroller {
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 24px;
    scrollbar-width: none;
  }
  .tl-scroller::-webkit-scrollbar { display: none; }
  /* Slides 1–2: one step each. Slide 3: Art Director + the arrow's end ("Today"), filling the screen */
  .tl-track { width: max-content; grid-template-columns: 78vw 78vw 60vw calc(40vw - 2 * var(--gutter)); }
  .tl-step { scroll-snap-align: start; scroll-margin-left: var(--gutter); padding-right: 24px; }
  .tl-today { scroll-snap-align: none; padding-right: 0; }
  .tl-hint {
    display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 28px;
  }
  .tl-hint i { font-style: normal; display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
  @keyframes nudge { 50% { transform: translateX(6px); } }
  .tl-progress { display: flex; gap: 6px; margin-top: 8px; }
  .tl-progress b { width: 18px; height: 2px; background: var(--line); transition: background .3s; }
  .tl-progress b.on { background: var(--fg); }
  .tl-intro { margin-top: 32px; }
}
@media (min-width: 641px) { .tl-progress { display: none; } }
@media (max-width: 640px) { .g-split { grid-template-columns: 1fr !important; } }

/* =========================================================
   One-screen pages (Home, Timeline, Contacts)
   Everything fits the viewport; main.js lowers --k
   (a type/spacing multiplier) if a screen is too short.
   ========================================================= */
:root { --k: 1; }
.fit main { min-height: 100svh; }

/* Timeline */
.page-timeline main { display: flex; flex-direction: column; padding-bottom: calc(var(--k) * 4vh); }
.page-timeline .page-head { padding: calc(var(--k) * 4vh) 0 calc(var(--k) * 5vh); }
.page-timeline .page-title { font-size: calc(var(--k) * min(10vw, 14vh)); }
.page-timeline .tl-step h3 { margin-top: calc(var(--k) * 5vh); font-size: calc(var(--k) * 14px); }
.page-timeline .tl-step p:not(.tl-company):not(.tl-role):not(.tl-year) { font-size: calc(var(--k) * 14px); }
.page-timeline .tl-intro {
  margin-top: auto; padding: calc(var(--k) * 5vh) 0 0; font-size: calc(var(--k) * 15px);
}

/* Contacts */
.page-contacts main.contact { min-height: 100svh; padding-bottom: calc(var(--k) * 4vh); }
.page-contacts .page-head { padding: calc(var(--k) * 4vh) 0 0; }
.page-contacts .page-title { font-size: calc(var(--k) * min(10vw, 14vh)); }
.page-contacts .contact-sub { font-size: calc(var(--k) * clamp(14px, 1.4vw, 18px)); }
.page-contacts .contact-list { margin: calc(var(--k) * 5vh) 0; align-self: center; }
.page-contacts .contact-list a, .page-contacts .contact-list span { font-size: calc(var(--k) * min(3.4vw, 5.6vh)); }
.page-contacts .tak { font-size: calc(var(--k) * min(20vw, 26vh)); line-height: 1; }

@media (max-width: 900px) {
}
@media (max-width: 640px) {
  .page-contacts .contact-list a, .page-contacts .contact-list span { font-size: calc(var(--k) * min(6.4vw, 4vh)); }
  .page-contacts .page-title, .page-timeline .page-title { font-size: calc(var(--k) * min(15vw, 9vh)); }
  .page-timeline .tl-intro { font-size: calc(var(--k) * 14px); }
  .page-timeline .tl-hint { margin-bottom: calc(var(--k) * 3vh); }
}

/* Home: two full screens — cover, then Hej! — snapping on a single scroll */
html:has(.page-home) { scroll-snap-type: y mandatory; }
/* Touch screens: no snapping. Safari's toolbar resizes the viewport while scrolling and
   the snap re-aligns the page with a jump; free scrolling stays fluid. */
@media (pointer: coarse) { html:has(.page-home) { scroll-snap-type: none; } }
.page-home main { padding-top: 0; min-height: 0; }
.page-home .hero,
.page-home .about {
  height: 100svh;
  scroll-snap-align: start; scroll-snap-stop: always;
  padding: calc(var(--header-h) + var(--k) * clamp(8px, 2vh, 24px)) var(--gutter) calc(var(--k) * clamp(24px, 6vh, 64px));
}
.page-home .hero { min-height: 0; }
.page-home .hero-id { font-size: calc(var(--k) * clamp(18px, min(2.2vw, 3.6vh), 30px)); }
.page-home .hero-title { font-size: min(19vw, calc(var(--k) * 34vh)); }

.page-home .about {
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between; gap: calc(var(--k) * 4vh);
}
.page-home .about-grid { grid-template-columns: 1fr auto; align-items: center; }
.page-home .hej { font-size: calc(var(--k) * min(12vw, 18vh)); margin-bottom: calc(var(--k) * 2vh); }
.page-home .about-lead { font-size: calc(var(--k) * clamp(18px, min(2.6vw, 4vh), 40px)); max-width: 22em; }
.page-home .avatar { width: calc(var(--k) * min(26vw, 38vh)); }
.page-home .about-text {
  margin: 0 0 0 auto; max-width: 1100px; gap: clamp(16px, 3vw, 48px);
  font-size: calc(var(--k) * clamp(13px, min(1.25vw, 2.1vh), 17px)); line-height: 1.55;
}

@media (max-width: 640px) {
  .page-home .hero-mail { padding-top: 0; }
  /* Cover: name + role centred vertically, email just below on the left, Portfolio at the bottom */
  .page-home .hero { grid-template-rows: 1fr auto 1fr; }
  .page-home .hero > div:empty { display: none; }
  .page-home .hero-top { grid-row: 2; flex-direction: column; align-items: flex-start; gap: calc(var(--k) * 2vh); }
  .page-home .hero-title { grid-row: 3; align-self: end; }
  .page-home .about { justify-content: center; }
  .page-home .about-grid { grid-template-columns: 1fr; gap: calc(var(--k) * 2.5vh); }
  .page-home .avatar { order: -1; width: calc(var(--k) * min(48vw, 26vh)); max-width: none; }
  .page-home .hej { font-size: calc(var(--k) * min(20vw, 10vh)); margin-bottom: calc(var(--k) * 3.5vh); }
  .page-home .about-lead { font-size: calc(var(--k) * min(4.4vw, 2.4vh)); line-height: 1.3; }
  .page-home .about-text { grid-template-columns: 1fr; gap: 0.8em; font-size: calc(var(--k) * min(2.805vw, 1.445vh)); }
}

/* ---------- Projects: wide texts, Malaterra row, swipeable stats ---------- */
.text-block.wide p { max-width: none; }
.ml-row { grid-template-columns: 1.5fr 2.186fr; } /* columns follow the two images' ratios, so both are the same height */
.stats-note { margin-top: clamp(32px, 4vw, 56px); }
.swipe-hint, .swipe-progress { display: none; }

@media (max-width: 640px) {
  .stats.swipe {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 70vw; gap: 16px;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
    margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1);
    padding: 0 var(--gutter); scroll-padding: 0 var(--gutter);
    scrollbar-width: none;
  }
  .stats.swipe::-webkit-scrollbar { display: none; }
  .stats.swipe .stat { scroll-snap-align: start; }
  .stats.swipe .stat:last-child { scroll-snap-align: end; }
  .stats.swipe .stat .label { font-size: 13px; }
  .stats.swipe .stat-circle { width: 100%; font-size: 40px; }
  .swipe-hint { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: clamp(28px, 4vw, 48px) 0 0; }
  .swipe-hint + .stats { margin-top: 16px; }
  .swipe-hint i { font-style: normal; display: inline-block; animation: nudge 1.6s ease-in-out infinite; }
  .swipe-progress { display: flex; gap: 6px; margin-top: 20px; }
  .swipe-progress b { width: 18px; height: 2px; background: var(--line); transition: background .3s; }
  .swipe-progress b.on { background: var(--fg); }
  @keyframes nudge { 50% { transform: translateX(6px); } }
}

/* ---------- Colour inversion (toggle in the header, remembered per visitor) ---------- */
:root.inverted { --bg: #000000; --fg: #ffffff; --muted: #8c8c8c; --line: #2a2a2a; }
:root.inverted .page-timeline { --bg: #ffffff; --fg: #000000; --muted: #8a8a8a; --line: #e6e6e6; }

.theme-toggle {
  flex-shrink: 0;
  margin-right: clamp(14px, 1.6vw, 20px);
  width: 30px; height: 30px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--fg); border-radius: 50%;
  background: var(--bg); color: var(--fg);
  cursor: pointer;
  transition: transform .4s cubic-bezier(.2,.7,.2,1), background-color .35s, color .35s, border-color .35s;
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle:hover { transform: rotate(180deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

/* Home: the second screen stays hidden (it can peek under translucent mobile browser bars)
   and fades in once it is scrolled into view; it fades out again when going back up */
.js .page-home .about { opacity: 0; transition: opacity .9s ease; }
.js .page-home .about.is-visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .js .page-home .about { transition-duration: .01s; } }

/* Home photo: rounded rectangle — upright crop on the right (desktop/tablet), wide on top (mobile) */
.page-home .about-grid { align-items: start; } /* "Hej!" lines up with the top of the photo */
.page-home .avatar {
  border-radius: 14px;
  aspect-ratio: 924 / 956; /* desktop file is pre-cropped to the chosen framing */
  width: calc(var(--k) * min(30.5vw, 59vh));
}
.page-home .avatar picture { display: block; width: 100%; height: 100%; }
@media (max-width: 640px) {
  .page-home .avatar {
    border-radius: 12px;
    aspect-ratio: 7 / 4;
    width: 100%;
    max-width: calc(var(--k) * 26vh * 7 / 4);
  }
  .page-home .avatar img { object-position: 50% 42%; }
}

/* Tablet (touch screens 641–1366px): photo fills the right column, aligned with the second text column */
@media (min-width: 641px) and (max-width: 1366px) and (pointer: coarse) {
  .page-home .about-grid { grid-template-columns: 1fr 1fr; column-gap: 3vw; align-items: start; }
  .page-home .avatar {
    justify-self: end;
    width: calc(var(--k) * 100%);
    aspect-ratio: 1052 / 896;
    border-radius: clamp(14px, 2.1vw, 28px);
  }
  .page-home .about-text { grid-template-columns: 1fr 1fr; column-gap: 3vw; margin: 0; max-width: none; }
}

/* ---------- Language switch (EN ⇄ DK) ---------- */
.i18n-pending body { visibility: hidden; }
.lang-toggle {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  height: 30px; min-width: 30px; padding: 0 8px;
  border: 1px solid var(--fg); border-radius: 999px;
  background: var(--bg); color: var(--fg);
  font: 600 11px/1 var(--font-body); letter-spacing: .06em;
  cursor: pointer;
  transition: background-color .25s, color .25s, border-color .35s;
}
.lang-toggle:hover { background: var(--fg); color: var(--bg); }
.lang-toggle:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
@media (max-width: 640px) {
  /* phones: the menu fills the centre, so the switch sits next to the colour button */
  .lang-toggle { position: static; transform: none; order: 1; padding: 0 6px; }
  .theme-toggle { order: 0; margin-right: 10px; }
  .nav { order: 2; }
}
