:root {
  --ground: #F6F0E2;
  --panel: #FFFCF3;
  --ink: #1B1F1C;
  --muted: #3D453F;
  --brand: #1F4A3A;
  --accent: #EE7A3B;
  --line: rgba(31, 74, 58, 0.18);
  --display: 'Bricolage Grotesque', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --body: Figtree, 'Segoe UI', Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #12211B;
    --panel: #182B23;
    --ink: #F3EDDD;
    --muted: #BFC8BE;
    --brand: #D5E6D8;
    --line: rgba(213, 230, 216, 0.22);
  }
}
:root[data-theme="dark"] {
  --ground: #12211B;
  --panel: #182B23;
  --ink: #F3EDDD;
  --muted: #BFC8BE;
  --brand: #D5E6D8;
  --line: rgba(213, 230, 216, 0.22);
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); height: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
a { color: var(--brand); text-decoration-thickness: 0.08em; text-underline-offset: 0.15em; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 0.2rem; }

.wrap {
  max-width: 78rem;
  margin: 0 auto;
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
}

/* Navigointi */
.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  padding-top: 1.1rem;
  max-width: calc(100% - 5.25rem); /* keep clear of the disc peeking in from the corner */
}
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.9rem 1.25rem; flex-wrap: wrap; }
.nav a {
  text-decoration: none;
  font-weight: 700;
  padding: 0.35rem 0;
  border-bottom: 3px solid transparent;
}
.nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.nav a:hover { border-bottom-color: var(--accent); }

/* Header: otsikko + ingressi */
.masthead {
  position: relative;
  overflow: hidden;
}
.masthead .wrap {
  position: relative;
  padding-top: 0;
  padding-bottom: 2.25rem;
}
.masthead .intro { padding-top: 2rem; }
.disc {
  position: absolute;
  top: -5rem;
  right: -6rem; /* on phones only a sliver shows, so the nav keeps its width */
  width: 11rem;
  height: 11rem;
  color: var(--accent);
  pointer-events: none;
}
.disc .ring { stroke: var(--ground); }
.place {
  margin: 0 0 0.9rem;
  font-weight: 700;
  color: var(--brand);
  max-width: calc(100% - 6rem);
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.5rem, 1.2rem + 6.2vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
  color: var(--brand);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.page-title h1 { font-size: clamp(2.2rem, 1rem + 4.5vw, 4.25rem); }
.lead {
  margin: 1.25rem 0 0;
  max-width: 40rem;
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem);
  line-height: 1.45;
  text-wrap: pretty;
}

/* Sisältö */
.content { background: var(--panel); flex: 1 0 auto; }
.content .wrap {
  padding-top: 2.25rem;
  padding-bottom: 3rem;
}
.columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
}
.col { display: flex; flex-direction: column; gap: 2.25rem; min-width: 0; }

.facts { margin: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.fact { border-top: 2px solid var(--brand); padding-top: 0.7rem; }
.fact dt { font-size: 0.875rem; font-weight: 700; color: var(--brand); }
.fact dd { margin: 0; }
.fact .value {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.55rem;
  line-height: 1.15;
  margin-top: 0.15rem;
}
.fact .note { color: var(--muted); margin-top: 0.15rem; }

section h2 {
  margin: 0 0 0.6rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--brand);
}
section h2::before {
  content: "";
  display: block;
  width: 3rem;
  height: 0.375rem;
  background: var(--accent);
  margin-bottom: 0.7rem;
}
section h3 {
  margin: 1.1rem 0 0.35rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.2;
  color: var(--brand);
}
section p { margin: 0 0 0.7rem; text-wrap: pretty; }
section ul { margin: 0 0 0.7rem; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; }
section ul:last-child, section p:last-child { margin-bottom: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.8rem; counter-reset: step; }
.steps li { display: flex; gap: 0.75rem; align-items: flex-start; counter-increment: step; }
.steps li::before {
  content: counter(step);
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent);
  color: #1B1F1C;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps li > span { padding-top: 0.2rem; }

/* Kortit (yhteystiedot) */
.card {
  border: 2px solid var(--brand);
  border-radius: 1rem;
  padding: 1.25rem 1.35rem;
  background: var(--ground);
}
.card h2::before { display: none; }
.card p:last-child { margin-bottom: 0; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  background: var(--accent);
  color: #1B1F1C;
  font-weight: 700;
  text-decoration: none;
}
.button:hover { color: #1B1F1C; filter: brightness(1.06); }
.button svg { width: 1.2rem; height: 1.2rem; }

/* Esimerkkiväylä */
.example {
  border-left: 0.375rem solid var(--accent);
  padding: 0.6rem 0 0.6rem 1rem;
  margin: 0.5rem 0 0.9rem;
  background: var(--ground);
  border-radius: 0 0.6rem 0.6rem 0;
}
.example ol { margin: 0.3rem 0 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 0.3rem; }
.example p { margin: 0 0 0.3rem; }

/* Alatunniste */
.footer { border-top: 1px solid var(--line); background: var(--ground); }
.footer .wrap {
  padding-top: 1.5rem;
  padding-bottom: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.95rem;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.5rem 1.25rem; flex-wrap: wrap; }
.footer .copy { margin-left: auto; }

@media (min-width: 40rem) {
  .wrap {
    padding-left: max(2.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(2.5rem, env(safe-area-inset-right, 0px));
  }
  .nav { padding-top: 1.5rem; max-width: calc(100% - 10rem); } /* leave room for the disc */
  .disc { width: 16rem; height: 16rem; top: -6rem; right: -6rem; }
  .place { max-width: calc(100% - 10rem); }
  .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 2.25rem; }
  .col-facts { grid-column: 1 / -1; }
  .facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 2.25rem; }
  .columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem; }
}
@media (min-width: 64rem) {
  .masthead .intro { padding-top: 3rem; }
  .nav { max-width: calc(100% - 13rem); }
  .masthead .wrap { padding-bottom: 3rem; }
  .disc { width: 20rem; height: 20rem; top: -7rem; right: -7rem; }
  .columns { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; }
  .columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4rem; }
  .col-facts { grid-column: auto; }
  .facts { display: flex; }
}

/* Tulokset */
.table-wrap { overflow-x: auto; margin: 0 0 0.7rem; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.85rem; color: var(--brand); }
.table th.num, .table td.num { text-align: right; }
.table td.pos { color: var(--muted); width: 2.5rem; }
.tag { display: inline-block; margin-left: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.stamp { color: var(--muted); font-size: 0.9rem; margin: 1.5rem 0 0; }
section .stamp { margin: 0 0 0.7rem; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.people .person { font-weight: 700; margin: 0 0 0.35rem; }
.pills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.4rem; }
.pill { display: inline-block; padding: 0.2rem 0.7rem; border-radius: 999px; background: var(--accent); color: #1B1F1C; font-weight: 700; font-size: 0.9rem; }

/* Seuraavat tapahtumat */
.upcoming { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.upcoming li { display: grid; grid-template-columns: 5.5rem 1fr auto; align-items: baseline; column-gap: 0.75rem; border-top: 1px solid var(--line); padding: 0.55rem 0; }
.upcoming .when { font-family: var(--display); font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.upcoming .teams { color: var(--muted); }
.upcoming .signup { font-weight: 700; }
.upcoming .tag { margin: 0; }
