/* ---------- theme: warm white, charcoal, one red accent ---------- */

:root {
  color-scheme: light dark;
  --bg: #f5f5f3;
  --paper: #ffffff;
  --ink: #1b1b1d;
  --muted: #707076;
  --line: #dcdcd8;
  --red: #c8102e;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --paper: #1c1c20;
    --ink: #efefec;
    --muted: #8d8d93;
    --line: #2b2b2f;
    --red: #ff4a5e;
  }
}


/* ---------- base ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(1.2rem, 4vw, 3rem);
}


/* ---------- top links ---------- */

.top {
  display: flex;
  justify-content: flex-end;
  gap: 2rem;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.top a {
  padding-bottom: 0.35em;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.top a:hover {
  border-bottom-color: var(--red);
  color: var(--ink);
}


/* ---------- name ---------- */

.hero {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
}

.name {
  margin: 0;
  font-size: clamp(3.5rem, 21vw, 15rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.86;
}

/* each word is a window, so letters rise up into view from below its edge */
.word {
  display: block;
  margin: -0.06em 0 -0.04em;
  padding: 0.06em 0 0.04em;
  overflow: hidden;
}

.ch {
  display: inline-block;
}

.ch.r {
  color: var(--red);
}

.rule {
  width: min(8rem, 30%);
  height: 4px;
  margin-top: clamp(1.2rem, 3vw, 2.2rem);
  background: var(--red);
  transform-origin: left;
}


/* ---------- front page: name on the left, numbered index down the right ---------- */

.hero.home {
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: end; /* keep the rows together at the bottom instead of stretching them apart */
  align-items: end;
  gap: 2rem clamp(2rem, 6vw, 5rem);
}

.home .name {
  font-size: clamp(3.5rem, 15vw, 13rem);
}

.home header {
  grid-column: 1;
  grid-row: 1;
}

.index {
  display: flex;
  flex-direction: column;
  grid-column: 2;
  grid-row: 1;
  gap: 0.6rem;
  padding-left: 1.6rem;
  border-left: 2px solid var(--line);
}

.index a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  color: var(--ink);
  font-size: clamp(1.5rem, 2.6vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  text-decoration: none;
  transition: color 0.15s ease, transform 0.2s ease;
}

.index .n {
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  letter-spacing: 0.2em;
}

.index a:hover {
  color: var(--red);
  transform: translateX(0.4rem);
}

/* on a narrow screen the index goes above the name instead of beside it */
@media (max-width: 760px) {
  .hero.home {
    grid-template-columns: 1fr;
  }

  .home .name {
    font-size: clamp(3.5rem, 21vw, 15rem);
  }

  .index {
    grid-column: 1;
    grid-row: 1;
  }

  .home header {
    grid-row: 2;
  }
}


/* ---------- section pages (CV, Projects, Personal) ---------- */

.soon {
  margin: clamp(2rem, 6vw, 4rem) 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

/* the line under a page title (Personal, Holidays) */
.subtitle {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-style: italic;
}

.rows {
  margin: clamp(2rem, 6vw, 4rem) 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.rows a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  transition: color 0.2s ease;
}

.rows .arrow {
  color: var(--muted);
  transition: color 0.2s ease, transform 0.2s ease;
}

.rows a:hover,
.rows a:hover .arrow {
  color: var(--red);
}

.rows a:hover .arrow {
  transform: translateX(0.5rem);
}


/* ---------- holidays page (/holiday/) ---------- */

.top.back {
  justify-content: flex-start;
}

.page-title h1 {
  margin: clamp(2.5rem, 9vw, 6rem) 0 0;
  font-size: clamp(3.5rem, 15vw, 10rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.page-title .r {
  color: var(--red);
}

/* one postage stamp per trip */

.stamps {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(2rem, 5vw, 3.5rem);
  margin: clamp(3rem, 8vw, 5rem) 0 clamp(3rem, 8vw, 5rem);
}

/* the wrapper tilts, casts the shadow and holds the postmark */
.stamp-wrap {
  position: relative;
  width: clamp(10.5rem, 42vw, 17rem);
  transform: rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.12));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.stamp-wrap:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.03);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2)) drop-shadow(0 14px 22px rgba(0, 0, 0, 0.18));
}

/* the paper: perforated edge made by punching half-circles out of all four sides */
.stamp {
  --hole: 5px;
  --gap: 17px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 3 / 4;
  padding: 1.7rem 1.4rem 1.5rem;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;

  -webkit-mask:
    radial-gradient(circle var(--hole) at 50% 0, #0000 96%, #000) top / var(--gap) 100% round no-repeat,
    radial-gradient(circle var(--hole) at 50% 100%, #0000 96%, #000) bottom / var(--gap) 100% round no-repeat,
    radial-gradient(circle var(--hole) at 0 50%, #0000 96%, #000) left / 100% var(--gap) no-repeat round,
    radial-gradient(circle var(--hole) at 100% 50%, #0000 96%, #000) right / 100% var(--gap) no-repeat round;
  -webkit-mask-composite: source-in;
  mask:
    radial-gradient(circle var(--hole) at 50% 0, #0000 96%, #000) top / var(--gap) 100% round no-repeat,
    radial-gradient(circle var(--hole) at 50% 100%, #0000 96%, #000) bottom / var(--gap) 100% round no-repeat,
    radial-gradient(circle var(--hole) at 0 50%, #0000 96%, #000) left / 100% var(--gap) no-repeat round,
    radial-gradient(circle var(--hole) at 100% 50%, #0000 96%, #000) right / 100% var(--gap) no-repeat round;
  mask-composite: intersect;
}

/* thin inner frame, like the printed border on a real stamp */
.stamp::before {
  content: "";
  position: absolute;
  inset: 0.85rem;
  border: 1.5px solid var(--ink);
  opacity: 0.85;
  pointer-events: none;
}

/* the country's flag, faint, filling the framed area behind the text */
.stamp::after {
  content: "";
  position: absolute;
  inset: 0.85rem;
  z-index: 0;
  background: var(--flag, none) center / 100% 100%;
  opacity: 0.2;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .stamp::after {
    opacity: 0.28;
  }
}

.stamp > span {
  position: relative;
  z-index: 1; /* text above the flag */
}

.stamp-dates {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.stamp-name {
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  overflow-wrap: anywhere;
  transition: color 0.2s ease;
}

.stamp-blurb {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.stamp-wrap:hover .stamp-name {
  color: var(--accent, var(--red));
}

/* the red postmark overlapping the top-right corner */
.postmark {
  position: absolute;
  top: -1.3rem;
  right: -1.3rem;
  width: 5.4rem;
  height: 5.4rem;
  color: var(--accent, var(--red));
  pointer-events: none;
  transform: rotate(-14deg);
}

.postmark circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
}

.postmark line {
  stroke: currentColor;
  stroke-width: 1.1;
}

.postmark text {
  fill: currentColor;
  font-family: var(--sans);
  font-weight: 700;
}


/* ---------- motion (skipped if the device asks for reduced motion) ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes stamp-in {
  from { opacity: 0; transform: translateY(26px) rotate(calc(var(--tilt) * 3)) scale(1.06); }
  to   { opacity: 1; transform: rotate(var(--tilt)); }
}

@keyframes letter-rise {
  from { transform: translateY(110%); }
  to   { transform: none; }
}

@keyframes draw {
  from { transform: scaleX(0); }
  to   { transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: no-preference) {
  .ch {
    animation: letter-rise 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) calc(0.15s + var(--i) * 0.06s) backwards;
  }

  .rule {
    animation: draw 1s cubic-bezier(0.2, 0.9, 0.2, 1) 1.1s backwards;
  }

  .top {
    animation: fade-in 1s ease-out 1.4s backwards;
  }

  /* the subtitle shows up a beat after the title */
  .subtitle {
    animation: fade-in 0.8s ease-out 1.2s backwards;
  }

  /* the index arrives just after the name has landed */
  .index a {
    animation: rise 0.7s cubic-bezier(0.2, 0.9, 0.2, 1) backwards;
  }

  .index a:nth-child(1) { animation-delay: 1.3s; }
  .index a:nth-child(2) { animation-delay: 1.42s; }
  .index a:nth-child(3) { animation-delay: 1.54s; }

  /* holidays page: trips rise in one after another */
  .page-title h1 {
    animation: rise 0.8s cubic-bezier(0.2, 0.9, 0.2, 1) backwards;
  }

  /* each stamp drops in and settles at its own tilt */
  .stamp-wrap {
    animation: stamp-in 0.8s cubic-bezier(0.2, 0.9, 0.2, 1) calc(0.35s + var(--i) * 0.12s) backwards;
  }
}
