/* Base */
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body { margin: 0; font: 14px/1.4 system-ui, sans-serif; }
img { max-width: 100%; }
[hidden] { display: none !important; }

@font-face {
  font-family: "Big Shoulders Display";
  src: url("/fonts/big-shoulders-display-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Doto";
  src: url("/fonts/doto-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Layout: one night tram line. LED ticker, hero with a live countdown, a wall of blind cameras,
     the trilogy as a route map, and the book details printed on a ticket. */
  color-scheme: dark;
  --night-0: #05080D;
  --night: #0A0F17;
  --night-2: #0F1722;
  --night-3: #18233A;
  --line: #233049;
  --steel: #46546C;
  --text: #E9EEF4;
  --muted: #98A6B9;
  --tram: #E3262F;
  --tram-text: #FF5C63;
  --led: #FFB547;
  --cyan: #4FD8C9;
  --paper: #EEF1F4;
  --paper-ink: #111925;
  --paper-muted: #5A6577;
  --paper-line: #CBD2DB;

  --font-display: "Big Shoulders Display", "DIN Condensed", "Bahnschrift Condensed", "Arial Narrow", sans-serif;
  --font-led: "Doto", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-body: "Iowan Old Style", "Charter", "Sitka Text", Georgia, "Noto Serif", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, "Cascadia Mono", Consolas, "Roboto Mono", monospace;
}

html { scroll-behavior: smooth; background: var(--night); }
body { background: var(--night); color: var(--text); }
::selection { background: var(--tram); color: #FFFFFF; }

.site {
  overflow-x: clip;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.site h1, .site h2, .site h3 { margin: 0; font-weight: 800; text-wrap: balance; }
.site p { margin: 0; }
.site a { color: inherit; }
.site a:focus-visible { outline: 2px solid var(--led); outline-offset: 3px; border-radius: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Language: Finnish by default; any #en or #en-... address shows English. */
.lang--en { display: none; }
.site:has(.lang--en:target, .lang--en :target) .lang--en { display: block; }
.site:has(.lang--en:target, .lang--en :target) .lang--fi { display: none; }

/* ---------- LED ticker ---------- */
.ticker {
  position: relative;
  overflow: hidden;
  background: var(--night-0);
  border-bottom: 1px solid var(--line);
}
.ticker::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, transparent 0 1px, rgba(5, 8, 13, 0.5) 1.4px);
  background-size: 3px 3px;
}
.ticker__track { display: flex; width: max-content; animation: ticker 55s linear infinite; }
.ticker__text {
  flex: none;
  padding: 0.55rem 3rem 0.45rem 0;
  font-family: var(--font-led);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--led);
  text-shadow: 0 0 10px rgba(255, 181, 71, 0.45);
}
.t-alert { color: var(--tram-text); text-shadow: 0 0 10px rgba(255, 92, 99, 0.5); }
.t-sep { color: var(--steel); text-shadow: none; padding-inline: 0.9rem; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- Header ---------- */
.top__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding-block: 1.1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
}
.brand::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tram);
  box-shadow: 0 0 12px var(--tram);
}
.top__right { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; }
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.nav a { color: var(--muted); text-decoration: none; padding-block: 0.25rem; }
.nav a:hover { color: var(--text); }
.lang-switch { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.lang-switch a { padding: 0.2rem 0.65rem; border-radius: 999px; color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--text); }
.lang-switch a[aria-current="true"] { background: var(--text); color: var(--night); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: clamp(2.5rem, 6vw, 5.5rem) clamp(3.5rem, 8vw, 6.5rem);
}
.hero::before {
  content: "";
  position: absolute;
  inset: -12%;
  z-index: -2;
  background: url("/img/hero-tausta.jpg") center / cover no-repeat;
  filter: blur(70px) saturate(1.5);
  opacity: 0.5;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 15, 23, 0.2) 0%, var(--night) 100%),
    repeating-linear-gradient(104deg, transparent 0 28px, rgba(210, 225, 255, 0.05) 28px 29px);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: center;
}
.hero__text { display: grid; gap: 1.75rem; min-width: 0; }
.kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; color: var(--muted); }
.badge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: 0.04em;
  padding: 0.3rem 0.5rem 0.25rem;
  border-radius: 4px;
  background: var(--tram);
  color: #FFFFFF;
}
.title {
  font-size: clamp(4.6rem, 15vw, 11rem);
  line-height: 0.8;
  letter-spacing: 0;
}
.title__line { display: block; }
.title__line--red { color: var(--tram); text-shadow: 0 0 40px rgba(227, 38, 47, 0.35); }
.byline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.tagline { font-size: 1.25rem; line-height: 1.45; font-style: italic; color: var(--muted); max-width: 32ch; }

/* Countdown: CSS counters driven by animated integer properties, no script */
@property --m { syntax: "<integer>"; inherits: false; initial-value: 59; }
@property --s { syntax: "<integer>"; inherits: false; initial-value: 59; }
.countdown {
  position: relative;
  justify-self: start;
  display: grid;
  gap: 0.35rem;
  padding: 0.8rem 1.1rem 0.9rem;
  background: var(--night-0);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.countdown::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, transparent 0 1px, rgba(5, 8, 13, 0.45) 1.4px);
  background-size: 3px 3px;
}
.countdown__label { color: var(--muted); font-size: 0.6875rem; }
.countdown__digits {
  font-family: var(--font-led);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--led);
  text-shadow: 0 0 14px rgba(255, 181, 71, 0.55);
}
.cd-m { counter-reset: cdm var(--m); animation: cd-m 3600s steps(60, end) infinite; }
.cd-s { counter-reset: cds var(--s); animation: cd-s 60s steps(60, end) infinite; }
.cd-m::after { content: counter(cdm, decimal-leading-zero); }
.cd-s::after { content: counter(cds, decimal-leading-zero); }
@keyframes cd-m { from { --m: 59; } to { --m: -1; } }
@keyframes cd-s { from { --s: 59; } to { --s: -1; } }

.cover { margin: 0; justify-self: center; width: 100%; max-width: 340px; transform: rotate(-2.5deg); transition: transform 0.5s ease; }
.cover:hover { transform: rotate(0deg) translateY(-6px); }
.cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px 6px 6px 3px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 60px 90px -45px rgba(227, 38, 47, 0.6),
    0 24px 50px -20px rgba(0, 0, 0, 0.85);
}

/* ---------- Rails divider ---------- */
.rails {
  height: 14px;
  border-block: 2px solid var(--steel);
  background: repeating-linear-gradient(90deg, var(--steel) 0 3px, transparent 3px 24px);
  opacity: 0.7;
}

/* ---------- Statement ---------- */
.statement { background: var(--night-0); padding-block: clamp(2.75rem, 7vw, 5rem); }
.statement__text { font-size: clamp(2.8rem, 8.5vw, 7rem); line-height: 0.88; max-width: 14ch; }
.statement__text span { display: block; color: var(--tram); }

/* ---------- Sections ---------- */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section--alt { background: var(--night-2); border-block: 1px solid var(--line); }
.split {
  display: grid;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  gap: 2rem clamp(2rem, 5vw, 4.5rem);
}
.head { display: grid; gap: 0.6rem; align-content: start; }
.eyebrow { color: var(--led); }
.h2 { font-size: clamp(2.6rem, 5.5vw, 4.25rem); line-height: 0.88; }
.head__note { color: var(--muted); max-width: 40ch; }
.prose { display: grid; gap: 1.15rem; max-width: 38rem; min-width: 0; }
.lead { font-size: 1.3rem; line-height: 1.5; }

/* ---------- Camera wall ---------- */
.cams-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 3rem; margin-bottom: 2rem; }
.cam-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.cam {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0.7rem 0.8rem;
  background: radial-gradient(120% 100% at 50% 35%, var(--night-3), var(--night-0));
  border: 1px solid var(--line);
  border-radius: 4px;
}
.cam::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("/img/kohina.svg");
  opacity: 0.16;
}
.cam::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 3px);
}
.cam--first { border-color: var(--tram); box-shadow: 0 0 0 1px var(--tram), 0 0 30px -8px rgba(227, 38, 47, 0.7); }
.cam__top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.6875rem; letter-spacing: 0.1em; }
.cam__id { color: var(--cyan); }
.cam__status { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--tram-text); }
.cam__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tram-text);
  animation: blink 1.4s steps(1) infinite;
}
.cam__place {
  align-self: center;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 0.95;
  overflow-wrap: anywhere;
}
.cam__time { font-size: 0.6875rem; letter-spacing: 0.1em; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes blink { 50% { opacity: 0.15; } }

/* ---------- Trilogy route map ---------- */
.route-intro { max-width: 40ch; color: var(--muted); }
.line-map {
  --gap: 2rem;
  list-style: none;
  margin: 2.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}
.stop { position: relative; display: grid; gap: 0.45rem; align-content: start; padding-top: 2.6rem; min-width: 0; }
.stop::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 11px;
  width: calc(100% + var(--gap));
  height: 6px;
  border-radius: 3px;
  background: var(--tram);
}
.stop:last-child::before { display: none; }
.stop__dot {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  box-sizing: border-box;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 4px solid var(--text);
  background: var(--night);
}
.stop--current .stop__dot {
  background: var(--tram);
  box-shadow: 0 0 0 6px rgba(227, 38, 47, 0.22), 0 0 26px rgba(227, 38, 47, 0.7);
}
.stop--end .stop__dot { top: 4px; left: -6px; width: 34px; height: 14px; border-radius: 4px; }
.stop__part { color: var(--muted); }
.stop__title { font-size: clamp(2rem, 3.4vw, 2.75rem); line-height: 0.9; }
.tags { list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}
.tags--live li { border-color: var(--tram); color: var(--text); }

/* ---------- Author ---------- */
.cam--portrait { aspect-ratio: 4 / 5; max-width: 18rem; width: 100%; }
.noimage__label { align-self: center; justify-self: center; font-size: clamp(2.2rem, 4vw, 3rem); color: var(--muted); }
.noimage__note { font-family: var(--font-body); font-size: 0.875rem; line-height: 1.4; color: var(--muted); }
.bio-close { font-size: 1.3rem; line-height: 1.45; font-style: italic; color: var(--led); }

/* ---------- Ticket ---------- */
.ticket {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  max-width: 54rem;
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 14px;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.9);
}
.ticket__main { min-width: 0; }
.ticket__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.4rem;
  background: var(--tram);
  color: #FFFFFF;
  border-top-left-radius: 14px;
}
.ticket__body { padding: 1.4rem; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.6rem 1.75rem; margin: 0; }
.facts dt { color: var(--paper-muted); padding-top: 0.2em; }
.facts dd { margin: 0; }
.ticket__stub {
  position: relative;
  min-width: 0;
  padding: 1.4rem;
  border-left: 2px dashed var(--paper-line);
}
.ticket__stub::before, .ticket__stub::after {
  content: "";
  position: absolute;
  left: -13px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--night);
}
.ticket__stub::before { top: -12px; }
.ticket__stub::after { bottom: -12px; }
.table-wrap { overflow-x: auto; }
.formats { width: 100%; border-collapse: collapse; }
.formats caption { text-align: left; color: var(--paper-muted); padding-bottom: 0.6rem; }
.formats th, .formats td { text-align: left; vertical-align: baseline; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--paper-line); }
.formats th { font-weight: 400; color: var(--paper-muted); }
.formats thead th { border-bottom-color: var(--paper-ink); }
.isbn { font-family: var(--font-mono); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.format-note { display: block; color: var(--paper-muted); font-size: 0.8125rem; }
.edition-note { margin-top: 1.5rem; max-width: 40rem; color: var(--muted); font-size: 0.9375rem; }

/* ---------- Footer ---------- */
.foot { background: var(--night-0); color: var(--muted); }
.foot__in {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 2rem 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.foot__end { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); }

/* ---------- 404 ---------- */
.notfound { display: grid; gap: 1.75rem; justify-items: start; }
.notfound__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cam-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .hero__grid, .split { grid-template-columns: minmax(0, 1fr); }
  .cover { max-width: 250px; justify-self: start; }
  .ticket { grid-template-columns: minmax(0, 1fr); }
  .ticket__head { border-top-right-radius: 14px; }
  .ticket__stub { border-left: 0; border-top: 2px dashed var(--paper-line); }
  .ticket__stub::before { top: -13px; left: -12px; }
  .ticket__stub::after { top: -13px; bottom: auto; left: auto; right: -12px; }
  .line-map { grid-template-columns: minmax(0, 1fr); --gap: 2.25rem; }
  .stop { padding-top: 0; padding-left: 2.9rem; }
  .stop::before { top: 11px; left: 8px; width: 6px; height: calc(100% + var(--gap)); }
  .stop__dot { top: 2px; }
  .stop--end .stop__dot { top: 6px; left: -6px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker__track, .cd-m, .cd-s, .cam__status::before { animation: none; }
  .cover, .cover:hover { transition: none; }
}
