/*
 * WAFL FootyFacts — Shared site stylesheet
 * File: /assets/css/site.css
 *
 * Load this before page-specific stylesheets.
 * Mobile-first. No external fonts or libraries required.
 */

/* ==========================================================
   1. Design tokens
   ========================================================== */

:root {
  color-scheme: light;

  --ink: #17191c;
  --yellow: #ffd229;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --line: #e0e3e8;
  --muted: #606772;

  --header-text: #e1e4e9;
  --header-muted: #cbd0d7;
  --focus: #936b00;

  --radius: 10px;
  --radius-small: 7px;
  --content-width: 1320px;
  --page-gutter: 16px;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* ==========================================================
   2. Base styles
   ========================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 18px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
summary {
  cursor: pointer;
}

button,
a {
  touch-action: manipulation;
}

a {
  color: inherit;
  text-underline-offset: 4px;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(29px, 5vw, 43px);
  letter-spacing: -1px;
}

h2 {
  margin: 0 0 12px;
  font-size: 22px;
  letter-spacing: -0.5px;
}

h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

p {
  margin: 0 0 16px;
}

/* ==========================================================
   3. Accessibility
   ========================================================== */

.skip {
  position: absolute;
  top: -120px;
  left: 12px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
}

.skip:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================
   4. Containers and reusable layouts
   ========================================================== */

.wrap {
  width: min(var(--content-width), 100%);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

main {
  padding-block: 24px 32px;
}

section[id] {
  scroll-margin-top: 18px;
}

/*
 * Grid/Flex children containing wide tables must be allowed
 * to shrink. Put tables inside a scrolling wrapper defined
 * in statistics.css.
 */
.grid > *,
.stats-panel,
.card-content {
  min-width: 0;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.flex-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================
   5. Header and branding
   ========================================================== */

.site-header {
  background: var(--ink);
  color: var(--surface);
  border-bottom: 4px solid var(--yellow);
}

.header-inner {
  padding-block: 15px 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  max-width: 100%;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  background: var(--yellow);
  color: var(--ink);
  border-radius: 9px;
  font-size: 16px;
  font-weight: 900;
}

.brand-name {
  font-size: clamp(18px, 5vw, 23px);
  font-weight: 850;
  letter-spacing: -0.6px;
  line-height: 1.2;
}

.brand-name span {
  color: var(--yellow);
}

.brand-tag {
  display: block;
  margin-top: 4px;
  color: var(--header-muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* Six navigation links fit into two rows on small screens. */
.top-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #363a40;
}

.top-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 6px;
  border-radius: 6px;
  color: var(--header-text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.top-nav .search-link {
  background: #2b3037;
  border: 1px solid #555c66;
  color: var(--surface);
}

.top-nav a[aria-current="page"] {
  background: #30353d;
  color: var(--yellow);
}

/* ==========================================================
   6. Breadcrumbs and section headings
   ========================================================== */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.breadcrumbs [aria-current="page"] {
  color: var(--ink);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.section-heading {
  margin: 27px 0 13px;
}

.section-heading.first {
  margin-top: 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.5px;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ==========================================================
   7. Buttons
   ========================================================== */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  max-width: 100%;
  padding: 11px 16px;
  background: var(--yellow);
  border: 1px solid var(--yellow);
  border-radius: var(--radius-small);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

/* Secondary button for use on light backgrounds. */
.button--secondary {
  background: var(--surface);
  border-color: #b7bec8;
  color: var(--ink);
}

/*
 * Outline button on dark backgrounds.
 * .secondary retains compatibility with the latest homepage.
 */
.button--outline,
.button.secondary {
  background: transparent;
  border-color: #616875;
  color: var(--surface);
}

.button--full {
  width: 100%;
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================
   8. Navigation cards and panels
   ========================================================== */

.card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  min-height: 64px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}

.icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  background: #eef0f4;
  border-radius: 8px;
  color: #515b68;
  font-size: 17px;
  font-weight: 800;
}

.card-content {
  flex: 1;
}

.card h3 {
  margin: 1px 0 5px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.4;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.arrow {
  flex-shrink: 0;
  color: #697483;
}

.panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ==========================================================
   9. Donation/support panel
   ========================================================== */

.support {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 23px;
  padding: 20px;
  background: #e9ecf0;
  border: 1px solid #dce1e7;
  border-radius: var(--radius);
}

.support h2 {
  margin: 0 0 5px;
  font-size: 16px;
  letter-spacing: normal;
}

.support p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.support .button {
  width: 100%;
  background: var(--surface);
  border-color: #b7bec8;
}

/* ==========================================================
   10. Footer
   ========================================================== */

.site-footer {
  padding-block: 23px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.footer-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.disclaimer {
  max-width: 950px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.preview-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 11px;
}

/* ==========================================================
   11. Tablet layouts
   ========================================================== */

@media (min-width: 700px) {
  :root {
    --page-gutter: 28px;
  }

  .top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
  }

  .top-nav a {
    padding-inline: 9px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .card {
    padding: 20px;
  }

  .section-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 20px;
  }

  .section-heading p {
    margin: 0;
  }

  .support {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .support .button {
    width: auto;
    flex-shrink: 0;
  }
}

/* ==========================================================
   12. Desktop layouts
   ========================================================== */

@media (min-width: 1000px) {
  .header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px 25px;
    padding-block: 16px;
  }

  .top-nav {
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .footer-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  main {
    padding-block: 28px 38px;
  }
}

/* ==========================================================
   13. Mouse/trackpad hover states
   ========================================================== */

@media (hover: hover) {
  .top-nav a:hover {
    background: #30353d;
    color: var(--yellow);
  }

  a.card:hover {
    background: #fffdf4;
    border-color: #c5a325;
    box-shadow: 0 4px 16px #17191c08;
  }

  .button:not(:disabled):hover {
    background: #f0c21c;
  }

  .button--secondary:not(:disabled):hover,
  .support .button:hover {
    background: #fff4c4;
  }

  .button--outline:not(:disabled):hover,
  .button.secondary:not(:disabled):hover {
    background: #30343b;
  }
}

/* ==========================================================
   14. Motion preferences
   ========================================================== */

@media (prefers-reduced-motion: no-preference) {
  a.card,
  .button {
    transition: background 120ms ease, border-color 120ms ease;
  }
}