/* French Revolution theme: kraft paper, oxblood ink, engraved-poster
   type. Colors are tokens so the dark "candlelight" variant only has to
   change the tokens. */
@font-face {
  font-family: "Forum";
  src: url("../fonts/Forum-Regular.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #d3b693;
  --panel: #d3b693;
  --paper-light: #e2cba8;
  --paper-deep: #c4a47c;
  --ink: #1e1a16;
  --ink-soft: #4a3b2e;
  --blood: #7f0000;
  --blood-bright: #a31515;
  --on-blood: #f6ead8;
  --line: rgba(30, 26, 22, 0.25);
  --good: #2f5d2a;
  --row-alt: rgba(255, 255, 255, 0.18);
  --texture-opacity: 0.35;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #241b15;
    --panel: #4a3a2c;
    --paper-light: #2f241c;
    --paper-deep: #1a130e;
    --ink: #eadbc4;
    --ink-soft: #c2ad8f;
    --blood: #d04a3c;
    --blood-bright: #e8604f;
    --on-blood: #1a130e;
    --line: rgba(234, 219, 196, 0.22);
    --good: #8fc27f;
    --row-alt: rgba(255, 255, 255, 0.04);
    --texture-opacity: 0.15;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}

/* Paper grain: an SVG noise filter as a data URL (allowed by the CSP's
   img-src 'self' data:), laid over the background color. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--texture-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .18 0 0 0 0 .1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* Corner decoration: a splatter top-right, the seal top-left, a drip on
   the right edge. Hidden on narrow screens where they'd cover text.
   The splatter is drawn at 200px but its box is only the 130px corner
   that shows; the picture's top and right edges are cut off by the box
   instead of hanging past the page. A box hanging past the edge lets the
   browser slide the whole page sideways (e.g. when a click moves focus),
   even with overflow-x hidden. */
body::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 130px;
  height: 130px;
  background: url("../art/splatter.svg") no-repeat left bottom / 200px 200px;
  opacity: 0.85;
  pointer-events: none;
  z-index: 0;
}

.masthead, main, .colophon {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.masthead { padding-top: 56px; padding-bottom: 8px; text-align: center; }
.masthead::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 0;
  width: 120px;
  height: 120px;
  background: url("../art/stamp.svg") no-repeat center / contain;
  transform: rotate(-12deg);
  opacity: 0.75;
}

/* Buy Me a Coffee link, styled like their button (tan pill, black text
   and outline). Same colors in both themes so it reads as their badge. */
.support {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 2;
  padding: 6px 14px;
  border: 2px solid #000;
  border-radius: 999px;
  background: #cbaf8d;
  color: #000;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}
.support:hover { background: #d9c2a3; }

h1, h2, h3 {
  font-family: "Forum", Georgia, "Times New Roman", serif;
  font-weight: 400;
  color: var(--blood);
  line-height: 1.1;
}
h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); margin: 0; }
h2 { font-size: 1.9rem; margin: 0 0 12px; display: flex; align-items: center; gap: 14px; }
h3 { font-size: 1.4rem; margin: 28px 0 8px; }
/* Two short lines under the title; the first wraps naturally on narrow screens. */
.tagline { margin: 10px auto 0; max-width: 46em; color: var(--ink-soft); font-size: 0.95rem; }
.tagline + .tagline { margin-top: 4px; }

.step, .results {
  background: var(--paper-light);
  border: 1px solid var(--line);
  box-shadow: 0 2px 0 var(--paper-deep), 0 10px 24px rgba(0, 0, 0, 0.12);
  padding: 22px;
  margin: 22px 0;
  transform: rotate(-0.25deg);
}
.step:nth-of-type(even) { transform: rotate(0.25deg); }

/* Roman numeral inside a hand-drawn ring, like the slides' circled numbers. */
.step-number {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  background: url("../art/circle.svg") no-repeat center / contain;
  color: var(--ink);
  font-size: 1.5rem;
}
.optional { font-size: 1rem; color: var(--ink-soft); }

.hint { color: var(--ink-soft); font-size: 0.95rem; margin: 8px 0; }
.status { margin: 10px 0 0; min-height: 1.5em; }
.status.error { color: var(--blood-bright); font-weight: 600; }

.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

input[type="text"], input:not([type]), select {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink-soft);
  border-radius: 2px;
  padding: 10px 12px;
  min-width: 0;
}
#league-input { flex: 1 1 260px; }

/* Sleeper | ESPN folder tabs on top of the league panel. Each tab is an
   SVG shape (rounded top-left corner, right edge sloping out into the
   panel). The ESPN tab tucks under the Sleeper tab's slope; the selected
   tab comes to the front in the panel's colour. */
.platform-tabs { display: flex; align-items: flex-end; position: relative; }
.platform-tab {
  position: relative;
  width: 150px;
  height: 42px;
  margin-right: -34px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--on-blood);
  font-family: "Forum", Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0;
}
.platform-tab:hover { background: none; }
.platform-tab .tab-shape { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: var(--blood); }
.platform-tab:hover .tab-shape { fill: var(--blood-bright); }
.platform-tab .tab-label { position: absolute; inset: 0 30px 0 0; display: flex; align-items: center; justify-content: center; }
.platform-tab:first-child { z-index: 2; }
.platform-tab:nth-child(2) { z-index: 1; }
.platform-tabs .platform-tab[aria-selected="true"] { z-index: 3; color: var(--blood); }
.platform-tabs .platform-tab[aria-selected="true"] .tab-shape { fill: var(--panel); }
/* In dark mode red text on the brown panel is hard to read, so the
   selected tab's label uses the page's light ink instead. */
@media (prefers-color-scheme: dark) {
  .platform-tabs .platform-tab[aria-selected="true"] { color: var(--ink); }
}
.league-panel { position: relative; z-index: 4; background: var(--panel); border-radius: 0 9px 9px 9px; padding: 18px; }
/* Visitors have no tabs, so the league step looks as it always did: no box. */
.platform-tabs[hidden] + .league-panel { background: none; border-radius: 0; padding: 0; }
.league-panel #league-input { background: var(--paper-light); }

button {
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--on-blood);
  background: var(--blood);
  border: 0;
  border-radius: 2px;
  padding: 10px 20px;
  cursor: pointer;
}
button:hover { background: var(--blood-bright); }
button:disabled { opacity: 0.55; cursor: progress; }
button.secondary { background: transparent; color: var(--blood); box-shadow: inset 0 0 0 2px var(--blood); }
button.secondary:hover { background: var(--blood); color: var(--on-blood); }
:focus-visible { outline: 3px solid var(--blood-bright); outline-offset: 2px; }


.teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0; }
.team {
  /* radio | name | chopped mark stay on one row; the name wraps inside
     its own column. */
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
}
.team:has(input:checked) { box-shadow: inset 0 0 0 2px var(--blood); }
.team:has(input:disabled) { cursor: not-allowed; }
/* A chopped team: name struck through in blood, plus a small splatter. */
.team:has(input:disabled) .team-name {
  color: var(--ink-soft);
  text-decoration: line-through;
  text-decoration-color: var(--blood);
  text-decoration-thickness: 2px;
}
.chopped-mark {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: url("../art/splatter.svg") no-repeat center / contain;
}

.drops { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.drop {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 2px dashed var(--ink-soft);
  background: var(--paper);
  cursor: pointer;
}
/* The file input is visually hidden but still focusable, so show focus on the box. */
.drop:focus-within { outline: 3px solid var(--blood-bright); outline-offset: 2px; }
.drop.dragging { border-color: var(--blood); background: var(--paper-deep); }
.drop.loaded { border-style: solid; border-color: var(--good); }
.drop.error { border-style: solid; border-color: var(--blood-bright); }
.drop-title { font-weight: 600; }
.drop-status { font-size: 0.9rem; color: var(--ink-soft); overflow-wrap: anywhere; }

.mode { display: grid; gap: 2px; font-size: 0.85rem; color: var(--ink-soft); }

.log { margin: 10px 0 0; padding-left: 20px; font-size: 0.85rem; color: var(--ink-soft); }

.results-bar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; }

#report h1 { font-size: 2rem; }
#report h2 { font-size: 1.6rem; margin-top: 30px; }
#report h3.suggested { color: var(--blood-bright); }
#report blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-style: italic;
}
.table-wrap { overflow-x: auto; margin: 10px 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: "Forum", Georgia, serif; font-weight: 400; font-size: 1rem; color: var(--blood); }
tbody tr:nth-child(even) { background: var(--row-alt); }

.colophon { padding-top: 12px; padding-bottom: 60px; padding-right: 96px; padding-left: 96px; font-size: 0.85rem; color: var(--ink-soft); text-align: center; }
.colophon::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 0;
  width: 70px;
  height: 170px;
  background: url("../art/splatter-drip.svg") no-repeat center / contain;
  opacity: 0.8;
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  body::after { width: 75px; height: 75px; background-size: 110px 110px; }
  .masthead { padding-top: 40px; }
  .masthead::before { width: 70px; height: 70px; top: 6px; left: 4px; }
  /* Narrow screens: a smaller pill, so it fits between the seal and the
     right edge without covering the title. */
  .support { top: 8px; right: 8px; padding: 4px 10px; font-size: 0.8rem; }
  .step, .results { padding: 16px; transform: none; }
  .step:nth-of-type(even) { transform: none; }
  .colophon { padding-left: 16px; padding-right: 16px; }
  .colophon::after { display: none; }
  h2 { font-size: 1.6rem; }
}
