/* ==========================================================================
   Kackwurm — shared stylesheet
   Every page links this. Page-specific rules go in a <style> block on that
   page, but anything used twice belongs here.
   NOTE: do not rename this to /style.css — install.php downloads a file with
   that name into the repo root for the presskit() install.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=JetBrains+Mono:wght@400;700&display=swap");

/* --- design tokens ------------------------------------------------------ */

:root {
  --bg: #100e0c;
  --bg-elev: #191614;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hi: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --line-hi: rgba(255, 255, 255, 0.16);

  --txt: #f2eee8;
  --dim: rgba(242, 238, 232, 0.58);
  --dimmer: rgba(242, 238, 232, 0.33);

  --gold: #ffb43f;
  --gold-dim: rgba(255, 180, 63, 0.16);
  --blood: #e0463f;

  --font: "Outfit", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);

  /* one canonical colour per person, used on every page */
  --c-robo: #e05c63;
  --c-scla: #eda200;
  --c-batz: #59a869;
  --c-simon: #389fd6;
  --c-mursch: #ba55d3;
  --c-nin: #4ec26a;
  --c-maxi: #ffd54a;
  --c-asshunter: #ff8a5c;
  --c-pami: #4ecdc4;
}

@font-face {
  font-family: bloodyterror;
  src: url("../BloodyTerror.ttf");
  font-weight: bold;
  font-display: swap;
}

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

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* warm ambient glow behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(255, 180, 63, 0.1), transparent 70%),
    radial-gradient(50rem 35rem at 95% 5%, rgba(186, 85, 211, 0.09), transparent 70%);
}

a {
  color: var(--gold);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: var(--gold);
  color: #1a1206;
}

/* --- navigation (injected by site.js) ----------------------------------- */

.kw-nav {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(16, 14, 12, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.kw-nav__brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--txt);
  text-decoration: none;
  white-space: nowrap;
}

.kw-nav__brand:hover {
  text-decoration: none;
}

.kw-nav__brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.kw-nav__links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.kw-nav__link {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--dim);
  font-size: 0.92rem;
  font-weight: 400;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
}

.kw-nav__link:hover {
  background: var(--surface-hi);
  color: var(--txt);
  text-decoration: none;
}

.kw-nav__link[aria-current="page"] {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
}

/* pages that want the nav floating over full-bleed art */
body.kw-fullbleed .kw-nav {
  position: fixed;
  left: 0;
  right: 0;
  background: linear-gradient(rgba(16, 14, 12, 0.85), transparent);
  border-bottom: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* --- layout ------------------------------------------------------------- */

.kw-wrap {
  width: min(1120px, 100% - clamp(2rem, 8vw, 5rem));
  margin-inline: auto;
  padding-block: clamp(2rem, 6vw, 4rem) 5rem;
}

.kw-head {
  margin-bottom: 2.5rem;
}

.kw-head h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
  background: linear-gradient(100deg, var(--txt) 25%, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.kw-head p {
  margin: 0.7rem 0 0;
  max-width: 55ch;
  color: var(--dim);
  font-size: 1.02rem;
}

.kw-head--horror h1 {
  font-family: bloodyterror, var(--font);
  font-weight: 700;
  letter-spacing: 0;
  background: linear-gradient(100deg, var(--blood), #ff9f6e);
  -webkit-background-clip: text;
  background-clip: text;
}

h2.kw-section {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 3rem 0 1.2rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dimmer);
}

h2.kw-section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --- cards -------------------------------------------------------------- */

.kw-grid {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
}

.kw-card {
  padding: 1.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  /* --accent is set per card to tint the header rule */
}

.kw-card__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent, var(--txt));
}

.kw-card__title::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent, var(--gold));
  box-shadow: 0 0 12px var(--accent, var(--gold));
}

/* --- tiles (home) ------------------------------------------------------- */

.kw-tiles {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.kw-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 210px;
  padding: 1.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background-size: cover;
  background-position: center;
  /* The ::after scrim below is positioned to the padding box. Without this the
     background image would still paint out to the border box and leave a 1px
     ring of undimmed image around every tile. */
  background-clip: padding-box;
  color: var(--txt);
  text-decoration: none;
  isolation: isolate;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1), border-color 0.28s;
}

.kw-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(16, 14, 12, 0.35) 10%, rgba(16, 14, 12, 0.93));
  transition: background 0.28s;
}

.kw-tile:hover {
  transform: translateY(-4px);
  border-color: var(--line-hi);
  text-decoration: none;
}

.kw-tile:hover::after {
  background: linear-gradient(rgba(16, 14, 12, 0.2) 10%, rgba(16, 14, 12, 0.88));
}

.kw-tile--wide {
  grid-column: span 2;
  min-height: 250px;
}

.kw-tile__kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.kw-tile__name {
  margin: 0.3rem 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kw-tile__desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--dim);
}

@media (max-width: 640px) {
  .kw-tile--wide {
    grid-column: span 1;
  }
}

/* --- countdown / stat readouts ------------------------------------------ */

.kw-rows {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.kw-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--line);
}

.kw-row:last-child {
  border-bottom: 0;
}

.kw-row__label {
  font-size: 0.95rem;
  color: var(--dim);
}

.kw-row__value {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--txt);
}

/* a countdown whose target date has already passed */
.kw-row--past .kw-row__label,
.kw-row--past .kw-row__value {
  color: var(--dimmer);
  text-decoration: line-through;
}

.kw-tag {
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--gold-dim);
  color: var(--gold);
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  vertical-align: middle;
}

/* the big single number on pnpDays */
.kw-bignum {
  display: block;
  font-family: var(--mono);
  font-size: clamp(1.6rem, 6vw, 3.2rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--accent, var(--gold));
}

/* --- tables ------------------------------------------------------------- */

.kw-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.kw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.kw-table th {
  padding: 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.kw-table td {
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.kw-table tr:last-child td {
  border-bottom: 0;
}

.kw-table tbody tr {
  transition: background 0.15s;
}

.kw-table tbody tr:hover {
  background: var(--surface-hi);
}

.kw-table .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.kw-player {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--txt);
  font-weight: 600;
}

.kw-player:hover {
  color: var(--gold);
  text-decoration: none;
}

.kw-player img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line-hi);
  flex: none;
}

/* --- charts ------------------------------------------------------------- */

.kw-chart {
  padding: 1.2rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.kw-chart__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.kw-chart__head h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.kw-chart__status {
  font-size: 0.82rem;
  color: var(--dimmer);
}

/* Chart.js with `maintainAspectRatio: false` sizes the canvas to its parent.
   That parent MUST have a height of its own — if it derives its height from
   the canvas, each resize grows the box and the chart grows without bound.
   Hence a fixed-height positioned wrapper, and no width/height rules on the
   canvas itself (Chart.js sets those inline and fights anything we add). */
.kw-chart__canvas {
  position: relative;
  height: var(--chart-h, 260px);
}

/* --- misc --------------------------------------------------------------- */

.kw-note {
  margin-top: 2.5rem;
  padding: 0.9rem 1.1rem;
  border-left: 2px solid var(--line-hi);
  color: var(--dimmer);
  font-size: 0.88rem;
}

.kw-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--dimmer);
  font-size: 0.92rem;
}

/* small floating audio toggle — pages with a soundtrack use this instead of
   an always-on autoplaying <audio>, which browsers block anyway */
.kw-audio {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  background: rgba(16, 14, 12, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
}

.kw-audio:hover {
  color: var(--txt);
  border-color: var(--line-hi);
}

.kw-audio[data-playing="true"] {
  color: var(--gold);
  border-color: var(--gold-dim);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
