/* ludienyen.com — hand-built static site. No frameworks, no trackers beyond GA. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Plex Mono";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-700-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  --ink: rgba(0, 0, 0, 0.85);
  --ink-soft: rgba(65, 65, 65, 0.81);
  --rule: rgba(0, 0, 0, 0.85);
  --paper: #fff;
  --chip: rgba(255,255,255,0.85);      /* small badges that sit on photos (slide arrows, peek hint) */
  --bubble-bg: #111; --bubble-fg: #fff; /* pronunciation bubble */
  color-scheme: light;
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: 1.25rem;
  --max: 1200px;
  --green: rgb(0, 166, 50);
  --teal: rgb(0, 166, 133);
  --blue: rgb(0, 22, 166);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
}
img { max-width: 100%; height: auto; display: block; }

/* ---------- dark mode (every page except the homepage, which paints its own sky) ----------
   Follows the device setting by default; `mode dark|light|auto` in the terminal overrides it (class on <body>). */
@media (prefers-color-scheme: dark) { body:not(.home):not(.light) { --paper: #222; --ink: rgba(255,255,255,0.88); --ink-soft: rgba(255,255,255,0.62); --rule: rgba(255,255,255,0.7);
  --chip: rgba(34,34,34,0.85); --bubble-bg: #eee; --bubble-fg: #111; color-scheme: dark;
  --green: rgb(70, 220, 110); --teal: rgb(60, 215, 190); --blue: rgb(130, 160, 255); /* awards colours lifted for #222 */ } }
body:not(.home).dark { --paper: #222; --ink: rgba(255,255,255,0.88); --ink-soft: rgba(255,255,255,0.62); --rule: rgba(255,255,255,0.7);
  --chip: rgba(34,34,34,0.85); --bubble-bg: #eee; --bubble-fg: #111; color-scheme: dark;
  --green: rgb(70, 220, 110); --teal: rgb(60, 215, 190); --blue: rgb(130, 160, 255); /* awards colours lifted for #222 */ }
body { transition: background .3s ease, color .3s ease; }
a { color: inherit; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- nav ---------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem var(--gutter);
  font-family: var(--mono);
  font-size: 0.95rem;
}
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }

/* ---------- marquee ---------- */
.marquee {
  overflow: hidden;
  white-space: nowrap;
  font-weight: 900;
  font-size: clamp(2rem, 4.3vw, 3rem);
  line-height: 1;
  padding: 0.15em 0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.marquee.dragging { cursor: grabbing; }
.marquee__track { display: inline-flex; will-change: transform; }
.marquee__item { padding: 0; }
.marquee .sep { display: inline-block; font-size: 0.8em; vertical-align: 0.1em; margin: 0 0.32em; }

/* ---------- layout ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 1.5rem var(--gutter) 2rem; }
.intro { max-width: 34rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); margin-bottom: 2rem; font-size: 1.05rem; }
.row {
  display: grid;
  grid-template-columns: 5fr 1fr 5fr 1fr;
  gap: 0 0.5rem;
  margin-bottom: 2.5rem;
}
.row > * { min-width: 0; grid-row: 1; }
.row > .media { grid-column: 1; }
.row > .text { grid-column: 3; }
.row.text-first > .text { grid-column: 1; }
.row.text-first > .media { grid-column: 3; }
.row h2 {
  font-family: var(--mono);
  font-style: italic;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 1rem;
}
.caption { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.5rem; }

@media (max-width: 760px) {
  .row { grid-template-columns: 1fr; }
  .row > * { grid-row: auto; }
  .row > .media, .row > .text, .row.text-first > .text, .row.text-first > .media { grid-column: 1; }
  .row > .media { margin-bottom: 1rem; }
}

/* ---------- slideshow ---------- */
.slides { position: relative; overflow: hidden; width: 100%; }
.slides__track { display: flex; transition: transform 0.6s cubic-bezier(.2,.7,.2,1); }
.slides__item { flex: 0 0 100%; min-width: 0; }
.slides__item img { width: 100%; }
.slides__item .caption { padding: 0 0.1rem; }
.slides__dots { display: flex; gap: 0.4rem; justify-content: center; margin-top: 0.5rem; }
.slides__dots button {
  width: 0.55rem; height: 0.55rem; border-radius: 50%; border: 1px solid var(--ink);
  background: transparent; padding: 0; cursor: pointer;
}
.slides__dots button[aria-current="true"] { background: var(--ink); }
.slides__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: var(--chip); border: 1px solid var(--ink); width: 2rem; height: 2rem;
  font-family: var(--mono); cursor: pointer; opacity: 0; transition: opacity .2s;
}
.slides:hover .slides__arrow, .slides:focus-within .slides__arrow { opacity: 1; }
.slides__arrow--prev { left: 0.5rem; }
.slides__arrow--next { right: 0.5rem; }

/* ---------- profile ---------- */
.profile { display: grid; grid-template-columns: 9fr 1fr 11fr; gap: 0 0.5rem; }
.profile > * { min-width: 0; grid-row: 1; }
.profile .media { grid-column: 1; }
.profile .text { grid-column: 3; }
.profile h1 { font-size: 2.4rem; font-weight: 900; line-height: 1; margin: 0 0 0.25rem; }
.profile .sub { font-family: var(--mono); font-style: italic; font-weight: 700; margin-bottom: 1.5rem; }
@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; }
  .profile > * { grid-row: auto; }
  .profile .media, .profile .text { grid-column: 1; }
  .profile .media { max-width: 320px; margin-bottom: 1.5rem; }
}

/* ---------- peek gallery (profile) ---------- */
.peek { position: relative; overflow: hidden; }
.peek__track {
  display: flex; gap: 0.75rem; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; cursor: grab; padding-bottom: 0.25rem;
  -webkit-mask-image: linear-gradient(to right, #000 78%, transparent 100%); mask-image: linear-gradient(to right, #000 78%, transparent 100%);
}
.peek.at-end .peek__track { -webkit-mask-image: none; mask-image: none; }
.peek__track::-webkit-scrollbar { display: none; }
.peek__item { flex: 0 0 80%; margin: 0; scroll-snap-align: start; }
.peek__item img { width: 100%; }
.peek__hint { position: absolute; right: 0.4rem; top: 0.4rem; font-family: var(--mono); font-size: 0.7rem; background: var(--chip); padding: 0.15rem 0.4rem; pointer-events: none; }
.peek.at-end .peek__hint { display: none; }
@media (max-width: 760px) {
  .peek { margin-right: calc(-1 * var(--gutter)); }      /* let the strip run to the screen edge */
  .peek__item { flex-basis: 84%; }
  .peek__item:last-child { margin-right: var(--gutter); }
}

/* ---------- awards ---------- */
.awards h2 { font-size: 1.2rem; text-decoration: underline; text-underline-offset: 0.2em; margin: 2rem 0 0.75rem; }
.awards table { width: 100%; border-collapse: collapse; }
.awards th { text-align: left; font-weight: 400; font-style: italic; padding: 0.25rem 0; }
.awards td { vertical-align: top; padding: 0.35rem 0; width: 50%; }
.awards td:first-child { color: var(--ink-soft); }
.awards td:first-child::before { content: "•  "; }
.awards .r { font-weight: 700; display: block; }
.awards .won { color: var(--green); }
.awards .team { color: var(--teal); }
.awards .me { color: var(--blue); }

/* ---------- photography (justified gallery) ---------- */
.gallery { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery a {
  flex-grow: calc(var(--w) / var(--h) * 100);
  flex-basis: calc(var(--w) / var(--h) * 180px);
  height: 180px; position: relative; overflow: hidden;
}
.gallery a::after { content: ""; flex-grow: 999999; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.gallery a:hover img { transform: scale(1.03); }
.gallery__spacer { flex-grow: 999999; height: 0; }
.photo-intro { max-width: 40rem; margin-bottom: 2rem; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92); display: none;
  align-items: center; justify-content: center; z-index: 50; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; width: auto; height: auto; object-fit: contain; }
.lightbox__hint { position: absolute; bottom: 1rem; left: 0; right: 0; text-align: center; color: #fff; font-family: var(--mono); font-size: 0.8rem; opacity: .7; }

/* ---------- home ---------- */
body.home { min-height: 100vh; min-height: 100dvh; overflow: hidden; background: transparent; }
.home .gradient {
  position: fixed; inset: -10vh 0; z-index: -1;
  background: repeating-radial-gradient(circle at 4.5% 36%,
    rgb(248, 226, 155) 38.5%, rgb(228, 188, 131) 70.9%, rgb(228, 188, 131) 88.5%,
    rgb(248, 226, 155) 120.9%, rgb(248, 226, 155) 138.5%);
}
.home .hero { position: absolute; left: 9%; top: 26%; max-width: 30rem; }
.home h1 { font-size: 2.75rem; font-weight: 900; line-height: 1; margin: 0 0 0.25rem; }
.home .tagline { color: rgb(112,112,112); margin: 0 0 1.5rem; font-size: 1.2rem; font-weight: 500; min-height: 1.5em; }
.home .menu { display: flex; flex-wrap: wrap; gap: 0.9rem 0.75rem; max-width: 22rem; }
.btn {
  display: inline-block; background: #fff; color: var(--ink); text-decoration: none;
  border: 2px solid var(--ink); padding: 0.5rem 0.75rem; font-size: 0.95rem; font-weight: 500;
  filter: drop-shadow(3px 3px 0 var(--ink)); cursor: grab; user-select: none; -webkit-user-select: none;
  touch-action: none; position: relative; will-change: transform;
  -webkit-user-drag: none; /* the throw is ours; the browser must not start a native link drag */
}
.btn:active, .btn.dragging { cursor: grabbing; filter: drop-shadow(1px 1px 0 var(--ink)); }
.home .foot { position: absolute; bottom: 1rem; left: 9%; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); }
@media (max-width: 600px) {
  .home .hero { left: var(--gutter); right: var(--gutter); top: 18%; }
  .home .foot { left: var(--gutter); right: var(--gutter); bottom: calc(3.4rem + env(safe-area-inset-bottom)); }
  .home .sky-note { left: var(--gutter); right: var(--gutter); max-width: none; text-align: left !important; bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 2rem; }
.notfound h1 { font-size: 4rem; font-weight: 900; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .marquee__track { animation: none !important; }
  .slides__track { transition: none; }
}

/* ---------- sky (home) — colours follow the visitor's clock, set by site.js ---------- */
.home .gradient {
  --c1: rgb(248, 226, 155); --c2: rgb(228, 188, 131);
  /* the rings drift outward: every colour stop is shifted by --off, which runs 0% → 100% (one full period of the
     repeating pattern) over a minute, so the loop is seamless. This repaints the gradient each frame; it is the
     same effect the old Cargo site had, and it is switched off for visitors who prefer reduced motion. */
  --off: 0%;
  background: repeating-radial-gradient(circle at 4.5% 36%,
    var(--c1) calc(38.5% + var(--off)), var(--c2) calc(70.9% + var(--off)), var(--c2) calc(88.5% + var(--off)),
    var(--c1) calc(120.9% + var(--off)), var(--c1) calc(138.5% + var(--off)));
  transition: --c1 2s, --c2 2s;
  animation: drift 60s linear infinite;
}
@property --off { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
@keyframes drift { to { --off: 100%; } }
@media (prefers-reduced-motion: reduce) { .home .gradient { animation: none; } }
@property --c1 { syntax: "<color>"; inherits: true; initial-value: rgb(248,226,155); }
@property --c2 { syntax: "<color>"; inherits: true; initial-value: rgb(228,188,131); }
.home .sky-note { position: absolute; right: 1rem; bottom: 1rem; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-soft); text-align: right; max-width: 18rem; }
.home.night { --ink: rgba(255,255,255,0.9); --ink-soft: rgba(255,255,255,0.65); }
.home.night .tagline { color: rgba(255,255,255,0.7); }
.home.night .btn { background: #111; color: #fff; border-color: #fff; filter: drop-shadow(3px 3px 0 rgba(255,255,255,0.9)); }

/* ---------- typewriter ---------- */
.tw__cursor { display: inline-block; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- gallery hover reveal ---------- */
.gallery a { color: #fff; text-decoration: none; }
.tile__info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6rem 0.6rem 0.5rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.75)); font-size: 0.72rem; line-height: 1.3;
  opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; pointer-events: none;
}
.tile__info b { display: block; font-weight: 600; font-size: 0.8rem; }
.tile__info i { display: block; font-style: normal; font-family: var(--mono); opacity: .85; }
.gallery a:hover .tile__info, .gallery a:focus .tile__info { opacity: 1; transform: none; }
@media (hover: none) { .tile__info { display: none; } }

/* ---------- hidden terminal ---------- */
.hint { text-align: center; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-soft); opacity: .35; margin: 0 0 1rem; }
.hint button { font: inherit; color: inherit; background: none; border: 0; padding: 0.6rem 1rem; cursor: pointer; white-space: normal; text-align: center; max-width: 100%; }
.hint:hover, .hint:focus-within { opacity: .8; }
.hint button:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
.term {
  position: fixed; left: 0; right: 0; bottom: 0; height: 42vh; max-height: 420px; z-index: 60;
  --term-bg: rgba(12,12,12,0.96); --term-fg: #d6f5d6; --term-accent: #3fb950; --term-link: #9cdcfe;
  background: var(--term-bg); color: var(--term-fg); font-family: var(--mono); font-size: 0.85rem;
  border-top: 2px solid var(--term-accent); padding: 0.75rem 1rem; display: none; flex-direction: column;
  transform: translateY(100%); transition: transform .25s ease-out, background .4s ease, color .4s ease, border-color .4s ease;
}
.term.open { display: flex; transform: none; }
.term__out { flex: 1; overflow-y: auto; white-space: pre-wrap; margin: 0; }
.term__out a { color: var(--term-link); }
.term__line { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.term__line input { flex: 1; background: transparent; border: 0; color: inherit; font: inherit; outline: none; }
.term__ps { color: var(--term-accent); }

/* ---------- cross-document view transitions (Chrome 126+, Safari 18.2+; others just navigate) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: 0.18s; }
::view-transition-new(root) { animation-duration: 0.25s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* ---------- pronunciation, dictionary-style ---------- */
.dfn { position: relative; display: inline-block; text-decoration: underline dotted; text-decoration-thickness: 2px; text-underline-offset: 0.12em; cursor: help; outline: none; }
/* one element, one shape: a speech bubble cut with clip-path (8px tail on top, pointing at the word) */
.dfn::after {
  content: attr(data-say); position: absolute; left: 0; top: calc(100% + 0.4rem); z-index: 40;
  background: var(--bubble-bg); color: var(--bubble-fg); font-family: var(--mono); font-weight: 400; font-size: 0.8rem; line-height: 1.2; letter-spacing: 0;
  padding: calc(0.35rem + 8px) 0.6rem 0.35rem; white-space: nowrap; pointer-events: none;
  clip-path: polygon(0 8px, 0.9rem 8px, calc(0.9rem + 8px) 0, calc(0.9rem + 16px) 8px, 100% 8px, 100% 100%, 0 100%);
  opacity: 0; transform: translateY(-4px); transition: opacity .15s, transform .15s;
}
.dfn.open::after, .dfn:focus-visible::after { opacity: 1; transform: none; }
@media (hover: hover) { .dfn:hover::after { opacity: 1; transform: none; } }
