/* DerBruden.com design system.
   Shared across every page; page-specific rules stay inline. */

/* Archivo variable font, self-hosted subsets (weight axis 100-900, no italics). */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/archivo-latin-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/archivo-latin-ext-var.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  --paper: #f6f5f0;
  --surface: #fffefb;
  --ink: #191b17;
  --muted: #565a52;
  --line: #dcd9cf;
  --stripe: rgba(25, 27, 23, 0.04);
  --row-hover: rgba(25, 27, 23, 0.07);

  --accent: #14683c;
  --gold: #a16207;
  --up: #1a7f37;
  --down: #b3382e;

  --th-bg: #22251f;
  --th-fg: #f0efe9;

  --chart-grid: #e6eaef;
  --chart-neutral: #5a6572;
  --chart-connector: #dbe2ea;
  --chart-diag: #f0f0ef;
  --chart-pf: #1a7f37;
  --chart-pa: #c0392b;
  --chart-elo: #1a3a5a;

  --font: 'Archivo', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131512;
    --surface: #1b1e19;
    --ink: #e8e6de;
    --muted: #a6a89e;
    --line: #30342c;
    --stripe: rgba(232, 230, 222, 0.05);
    --row-hover: rgba(232, 230, 222, 0.09);

    --accent: #4cb87f;
    --gold: #d9ae56;
    --up: #58c47d;
    --down: #ef8a80;

    --th-bg: #262a23;
    --th-fg: #d9d7cf;

    --chart-grid: #2e353f;
    --chart-neutral: #a6a89e;
    --chart-connector: #3a444e;
    --chart-diag: #2a2e33;
    --chart-pf: #4ade80;
    --chart-pa: #f87171;
    --chart-elo: #60a5fa;
  }
}

/* Base */

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  max-width: 100%;
}

body {
  font-family: var(--font);
  line-height: 1.55;
  background: var(--paper);
  color: var(--ink);
  margin: 0 auto;
  padding: clamp(14px, 3vw, 28px);
  max-width: min(1200px, 100vw);
  width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  position: relative;
}

main {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

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

/* Fallback for browsers without :focus-visible (older mobile Safari):
   keyboard users still get a visible indicator. */
@supports not selector(:focus-visible) {
  :focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

main img,
main svg,
main table,
main pre,
main code {
  max-width: 100%;
  box-sizing: border-box;
}

main img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

main p a,
main li a {
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 2px;
}

/* Type: scoreboard voice */

h1,
h2,
h3 {
  font-weight: 900;
  line-height: 1.15;
  text-wrap: wrap;
  overflow-wrap: break-word;
  margin: 0 0 0.6em;
}

h2 {
  text-transform: uppercase;
  letter-spacing: 0.01em;
  border-top: 4px solid var(--ink);
  padding-top: 0.6rem;
}

.site-title {
  margin: 0;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

/* Layout containment — prevent horizontal page scroll on mobile */
header,
nav,
main,
.owner-logo-header,
.sponsor-ribbon,
.table-container,
.viz-chart,
.owner-viz {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Header */

.header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.header > div {
  min-width: 0;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 84px;
  height: auto;
  flex-shrink: 0;
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Sponsor strip */

.sponsor-ribbon {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  font-size: 0.8rem;
  min-width: 0;
  max-width: 100%;
}

.sponsor-ribbon img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  flex-shrink: 0;
}

.sponsor-ribbon p {
  margin: 0;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
}

.sponsor-ribbon strong {
  color: var(--ink);
}

.sponsor-ribbon a {
  text-decoration: underline;
  text-decoration-color: var(--line);
}

/* Nav ticker */

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  list-style: none;
  margin: 0 0 28px;
  padding: 4px 0;
  border-block: 2px solid var(--ink);
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

nav a:hover {
  color: var(--accent);
  text-decoration: none;
  box-shadow: inset 0 -3px 0 var(--accent);
}

nav a[aria-current='page'] {
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}

/* Tables */

.table-container {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-inline: 0;
}

.stats-table {
  min-width: 620px;
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.92em;
  background: var(--surface);
  border: 1px solid var(--line);
}

.stats-table th {
  background: var(--th-bg);
  color: var(--th-fg);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.stats-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.stats-table tbody tr:nth-child(even) {
  background: var(--stripe);
}

.stats-table tbody tr:hover {
  background: var(--row-hover);
}

.stats-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stats-table .owner {
  font-weight: 600;
}

.stats-table td a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.stats-table .totals-row td {
  font-weight: 800;
  border-top: 2px solid var(--ink);
  border-bottom: none;
}

.stats-table .leader-row td {
  background: var(--stripe);
}

.stats-table .leader-row td:first-child {
  box-shadow: inset 4px 0 0 var(--accent);
}

.trophies {
  color: var(--gold);
  letter-spacing: 0.12em;
  white-space: nowrap;
}

/* Award badges */

.rank-badge {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border-radius: 999px;
  font-size: 0.72em;
  font-weight: 800;
  vertical-align: -0.35em;
  margin-right: 0.5em;
}

.rank-badge.gold {
  background: var(--gold);
  color: var(--paper);
}

.rank-badge.silver {
  box-shadow: inset 0 0 0 2px var(--muted);
}

.icon-bottle {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.12em;
  margin-right: 0.5em;
  background-color: currentColor;
  mask: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M9.5%201.5h5c.55%200%201%20.45%201%201v1.6c0%20.46-.26.88-.68%201.09l-.82.41V7h.25A2.75%202.75%200%200%201%2017%209.75v9.5A2.75%202.75%200%200%201%2014.25%2022h-4.5A2.75%202.75%200%200%201%207%2019.25v-9.5A2.75%202.75%200%200%201%209.75%207H10V5.6l-.82-.41a1.22%201.22%200%200%201-.68-1.09V2.5c0-.55.45-1%201-1zM10%209v10.5h4V9h-4z%22%2F%3E%3C%2Fsvg%3E')
    no-repeat center / contain;
  -webkit-mask: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M9.5%201.5h5c.55%200%201%20.45%201%201v1.6c0%20.46-.26.88-.68%201.09l-.82.41V7h.25A2.75%202.75%200%200%201%2017%209.75v9.5A2.75%202.75%200%200%201%2014.25%2022h-4.5A2.75%202.75%200%200%201%207%2019.25v-9.5A2.75%202.75%200%200%201%209.75%207H10V5.6l-.82-.41a1.22%201.22%200%200%201-.68-1.09V2.5c0-.55.45-1%201-1zM10%209v10.5h4V9h-4z%22%2F%3E%3C%2Fsvg%3E')
    no-repeat center / contain;
}

/* Page furniture */

.owner-logo-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.owner-logo-header img {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.owner-logo-header h1 {
  margin: 0;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.owner-logo-image {
  width: 100px;
  height: 100px;
}

.championship-post {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-bottom: 40px;
}

.post-date,
.post-category {
  color: var(--muted);
  font-size: 0.9em;
}

.pr-meta,
.draft-meta {
  color: var(--muted);
  font-size: 0.9em;
}

.updated {
  color: var(--muted);
  font-size: 0.9em;
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.delta.up {
  color: var(--up);
}

.delta.down {
  color: var(--down);
}

.methodology {
  margin-top: 30px;
  font-size: 0.85em;
  color: var(--muted);
}

.methodology summary {
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  color: var(--ink);
}

.draft-history h2 {
  margin-top: 2rem;
}

footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Footer links meet the 44px touch target guideline on mobile. */
footer a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  padding: 0 8px;
}

/* Skip link - hidden until focused */
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  width: auto;
  height: auto;
  margin: 0;
  padding: 10px 16px;
  overflow: visible;
  clip: auto;
  white-space: normal;
  left: 8px;
  top: 8px;
  background: var(--surface);
  color: var(--ink);
  z-index: 10;
  border: 1px solid var(--ink);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Owner viz — dark-mode aware */
.owner-viz {
  margin-top: 30px;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.owner-viz h2 {
  margin-bottom: 4px;
}

.viz-note {
  color: var(--muted);
  font-size: 0.85em;
  margin-top: 0;
}

.viz-chart {
  width: 100%;
  max-width: 820px;
  margin: 10px 0 30px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

.viz-chart svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 520px;
  overflow: visible;
}

.viz-chart-h2h {
  max-width: 100%;
}

.viz-chart-h2h svg {
  min-width: 480px;
}

.viz-tooltip {
  position: fixed;
  display: none;
  padding: 6px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  pointer-events: none;
  font-size: 12px;
  line-height: 1.45;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Responsive */

@media (max-width: 720px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .logo {
    width: 64px;
  }

  .championship-post {
    grid-template-columns: 1fr;
  }

  .sponsor-ribbon {
    min-width: 0;
  }

  nav ul {
    gap: 2px 10px;
  }

  nav a {
    padding: 4px 4px;
    font-size: 0.9em;
  }
}
