/* FitFitr site. One stylesheet, system fonts, no external requests.
   Tokens are the design's light and dark sets (issue #318). */

:root {
  --bg: #F6F7F3;
  --card: #ECEEE6;
  --line: #DFE2D4;
  --line2: #CCD1BE;
  --line3: #AAB295;
  --ink: #15170F;
  --ink2: #40463A;
  --ink3: #5A6150;
  --ink4: #656C57;
  --accent: #4E6F00;
  --on-accent: #FFFFFF;
  --link: #3A5400;
  --link-hover: #2A3E00;
  color-scheme: light;

  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  --gutter: 16px;
  --pad-x: max(var(--gutter), calc(50% - 640px + var(--gutter)));
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --card: #1E1E1E;
    --line: #2A2A2A;
    --line2: #3A3A3A;
    --line3: #555555;
    --ink: #F4F6EE;
    --ink2: #D3D8C7;
    --ink3: #A4AA96;
    --ink4: #8A9080;
    --accent: #C6F432;
    --on-accent: #121212;
    --link: #C6F432;
    --link-hover: #DDFB7A;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121212;
  --card: #1E1E1E;
  --line: #2A2A2A;
  --line2: #3A3A3A;
  --line3: #555555;
  --ink: #F4F6EE;
  --ink2: #D3D8C7;
  --ink3: #A4AA96;
  --ink4: #8A9080;
  --accent: #C6F432;
  --on-accent: #121212;
  --link: #C6F432;
  --link-hover: #DDFB7A;
  color-scheme: dark;
}

@media (min-width: 720px) {
  :root { --gutter: 32px; }
}

@media (min-width: 1024px) {
  :root { --gutter: 64px; }
}

/* Base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }

ul, ol { padding-left: 20px; }

a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: 8px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  padding: 12px var(--pad-x);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { color: var(--ink); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--ink2);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

@media (min-width: 720px) {
  .site-header { padding-block: 20px; gap: 12px 24px; }
  .wordmark { font-size: 22px; }
  .site-nav { gap: 8px; }
  .site-nav a { padding: 0 12px; }
  .site-nav a:first-child { color: var(--ink); }
}

.site-nav a:first-child { color: var(--ink); }

/* Theme switch. Only shown when theme.js has run, so there is never a dead control. */

.theme-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.js .theme-toggle { display: inline-flex; }
.theme-toggle:hover { border-color: var(--line3); }

.theme-toggle .icon-sun { display: none; }

:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
}

.site-nav .theme-toggle { margin-left: 4px; }

/* Footer */

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px var(--pad-x);
  border-top: 1px solid var(--line);
  background: var(--card);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.footer-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.footer-note {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink2);
}

@media (min-width: 720px) {
  .site-footer { padding-block: 32px; gap: 16px; }
  .footer-nav { gap: 8px 24px; }
}

/* Main */

main {
  flex: 1 1 auto;
  min-width: 0;
}

h1 {
  font-size: 32px;
  line-height: 38px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
}

h3 {
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
}

@media (min-width: 720px) {
  h1 { font-size: 44px; line-height: 50px; }
  h2 { font-size: 26px; line-height: 32px; }
}

/* Landing */

.hero {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 48px var(--pad-x);
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

.hero h1 {
  max-width: 640px;
  font-size: 34px;
  line-height: 40px;
  letter-spacing: -0.01em;
}

.hero-art {
  order: -1;
  display: flex;
}

.hero-icon {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 0 0 1px var(--line2);
}

.store {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
}

.store-note {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink3);
}

@media (min-width: 720px) {
  .hero {
    flex-direction: row;
    align-items: center;
    gap: 48px;
    padding-block: 96px;
  }
  .hero-text { flex: 1 1 480px; }
  .hero h1 { font-size: 56px; line-height: 62px; }
  .hero-art {
    order: 0;
    flex: 0 1 220px;
    justify-content: center;
  }
  .hero-icon { width: 176px; height: 176px; border-radius: 40px; }
}

/* Language chooser and 404 */

.center-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  padding: 64px var(--pad-x) 96px;
}

.center-page-chooser {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-block: 48px;
}
.center-page-chooser .chooser { justify-content: center; }

.site-header > .site-nav:only-child { margin-left: auto; }

.chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { color: var(--on-accent); text-decoration: underline; }

.button-quiet {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line2);
}
.button-quiet:hover { color: var(--ink); }

/* Content pages: privacy and support */

.page {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 32px var(--pad-x) 56px;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 760px;
}

.lead { color: var(--ink2); }

.card {
  max-width: 760px;
  border-radius: 16px;
  background: var(--card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card h2 { font-size: 20px; line-height: 26px; }
.card ul { display: flex; flex-direction: column; gap: 8px; }

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
}
.cards > .card { flex: 1 1 340px; min-width: 0; max-width: none; padding: 20px; }
.cards h2 { font-size: 22px; line-height: 28px; }
.cards .button { align-self: flex-start; }
.cards ul { gap: 6px; color: var(--ink2); }

@media (min-width: 720px) {
  .page { gap: 40px; padding: 64px var(--pad-x) 96px; }
  .card { padding: 24px; }
  .cards > .card { padding: 28px; }
  .page-support { gap: 48px; }
  .lead-large { font-size: 18px; line-height: 28px; }
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: stretch;
}

@media (min-width: 900px) {
  .layout { flex-direction: row; gap: 48px; align-items: flex-start; }
}

.toc {
  border-radius: 12px;
  background: var(--card);
  padding: 0 16px;
}

.toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  font-weight: 600;
  cursor: pointer;
}

.toc nav {
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
  font-size: 15px;
  line-height: 20px;
}

.toc nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.toc-label { display: none; }

@media (min-width: 900px) {
  .toc {
    flex: 0 0 220px;
    max-width: 100%;
    padding: 0;
    background: none;
    position: sticky;
    top: 16px;
  }
  .toc-label {
    display: block;
    padding-bottom: 8px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 20px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink3);
  }
}

@media (min-width: 900px) {
  @supports selector(::details-content) {
    .toc summary { display: none; }
    .toc::details-content { content-visibility: visible; }
  }
}

.prose {
  flex: 1 1 520px;
  min-width: 0;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.prose section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 16px;
}

.prose section.stack-lg { gap: 16px; }

.panel {
  border-radius: 12px;
  background: var(--card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.panel ul { display: flex; flex-direction: column; gap: 4px; color: var(--ink2); }

@media (min-width: 720px) {
  .panel { padding: 20px; }
}

.prose ul.spaced { display: flex; flex-direction: column; gap: 8px; }

/* Details: the FAQ and the event list. Native elements, no script. */

details.faq,
details.events {
  border-radius: 12px;
  background: var(--card);
  padding: 0 16px;
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details.faq > summary,
details.events > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 8px 0;
}

summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }

details > summary::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--ink3);
  border-bottom: 2px solid var(--ink3);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
details[open] > summary::after { transform: rotate(-135deg); }

@media (prefers-reduced-motion: reduce) {
  details > summary::after { transition: none; }
}

details.faq > p { margin: 0 0 16px; color: var(--ink2); }
details.events > .events-intro { margin: 0 0 16px; color: var(--ink2); }

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 760px;
}

@media (min-width: 720px) {
  details.faq,
  details.events { padding: 0 20px; }
  details.faq > p { margin-bottom: 20px; }
  details.events > .events-intro { margin-bottom: 20px; }
}

/* Event tables inside the details */

.events-tables {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 20px;
}
.events-tables h3 {
  margin-top: 16px;
  font-size: 16px;
  line-height: 22px;
}

.table-scroll { overflow-x: auto; }

.events-tables table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 22px;
}

.events-tables th,
.events-tables td {
  padding: 8px 12px 8px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.events-tables thead th {
  font-weight: 600;
  white-space: nowrap;
}

.events-tables tbody th { font-weight: 400; }

.events-tables th:first-child { width: 45%; }

@media (max-width: 639px) {
  .events-tables table,
  .events-tables tbody { display: block; }
  .events-tables thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .events-tables tr {
    display: block;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
  }
  .events-tables th,
  .events-tables th:first-child,
  .events-tables td {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
  }
  .events-tables tbody th { font-weight: 600; }
  .events-tables td { color: var(--ink2); }
}

/* Who receives what: a table on wide screens, stacked cards on narrow ones. */

.recipients {
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
}

.recipients table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 22px;
}

.recipients th,
.recipients td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.recipients thead th { font-weight: 600; }
.recipients tbody th { font-weight: 400; }
.recipients tbody tr:last-child > * { border-bottom: 0; }

@media (max-width: 639px) {
  .recipients { background: none; overflow: visible; }
  .recipients table,
  .recipients tbody { display: block; }
  .recipients thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .recipients tbody { display: flex; flex-direction: column; gap: 12px; }
  .recipients tr {
    display: block;
    border-radius: 12px;
    background: var(--card);
    padding: 16px;
  }
  .recipients th,
  .recipients td {
    display: block;
    padding: 0;
    border: 0;
  }
  .recipients tbody th { font-weight: 700; }
  .recipients td { color: var(--ink2); }
  .recipients td::before {
    content: attr(data-label) ": ";
    color: var(--ink3);
  }
}

.recipient-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.recipient-cards li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 12px;
  background: var(--card);
  padding: 16px;
}
.recipient-cards span { color: var(--ink2); }

@media print {
  .theme-toggle, .skip { display: none; }
}
