/* ==========================================================================
   Thailand Chess — 17b "live feel": the product-polish layout in the live site's warm editorial dress
   1. Tokens   2. Base   3. Photo hero   4. Header   6. Finder
   7. Listing  8. Event card   9. Weekly panel   10. Footer   11. Organizer page
   12. Dialogs and forms   13. Without JavaScript   14. Motion and small screens
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
  /* Inter for text, Fraunces for display, JetBrains Mono for small labels (as on the live site).
     Anuphan covers Thai in all three roles. */
  --font: 'Inter', 'Anuphan', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Anuphan', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', 'Anuphan', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #faf8f3;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --well: rgba(60, 46, 16, 0.06);
  --ink: #0a0e1a;
  --ink-2: #3f4350;
  --line: #e8e2d5;
  --line-strong: #cfc6b3;
  --control-line: #6b6455;

  --accent: #5c3f06;
  --accent-tint: rgba(184, 134, 11, 0.1);
  --accent-ring: rgba(184, 134, 11, 0.42);
  --gold: #b8860b;
  --primary: #0a0e1a;
  --primary-hover: #262b3a;
  --on-primary: #faf8f3;
  --focus: #0a0e1a;

  --good: #064d30;
  --warn: #643600;
  --warn-tint: rgba(196, 128, 20, 0.14);
  --error: #8a1c1c;

  --shadow-card: 0 0 0 1px var(--line), 0 1px 2px rgba(10, 14, 26, 0.04), 0 14px 32px -20px rgba(60, 46, 16, 0.22);
  --shadow-card-hover: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(10, 14, 26, 0.05), 0 22px 44px -22px rgba(60, 46, 16, 0.34);
  --shadow-float: 0 0 0 1px var(--line), 0 2px 4px rgba(10, 14, 26, 0.04), 0 28px 60px -28px rgba(10, 14, 26, 0.4);
  --shadow-raised: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(10, 14, 26, 0.08);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  /* Dark surfaces: hero photo overlay and the weekly panel. */
  --night: #0a0e1a;
  --hero-ink: #faf8f3;
  --hero-ink-2: #ece7dc;
  --hero-gold: #ffd8a3;
  --logo-plate: #f3efe6;
  /* Weekly panel: warm parchment in the light theme, so it reads as part of the page. */
  --panel-bg: linear-gradient(140deg, #f2ead8 0%, #efe5cf 60%, #eadcbc 100%);
  --panel-ink: #0a0e1a;
  --panel-ink-2: #3f4350;
  --panel-card: rgba(255, 255, 255, 0.72);
  --panel-line: rgba(60, 46, 16, 0.14);
  --panel-accent: #5c3f06;
  --panel-focus: #0a0e1a;
  /* Ticket stub behind each event's date. */
  --stub: #f2ead8;
  --stub-perforation: #cfc6b3;

  --r-card: 20px;
  --r-control: 12px;
  --r-tag: 8px;
  --page-pad: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme='dark'] {
  --bg: #0c0f18;
  --surface: #151924;
  --surface-solid: #1a1f2c;
  --well: rgba(250, 248, 243, 0.06);
  --ink: #faf8f3;
  --ink-2: #dedad0;
  --line: rgba(250, 248, 243, 0.12);
  --line-strong: rgba(250, 248, 243, 0.26);
  --control-line: #9a9484;

  --accent: #ffd8a3;
  --accent-tint: rgba(255, 216, 163, 0.1);
  --accent-ring: rgba(255, 216, 163, 0.4);
  --gold: #e3b866;
  --primary: #faf8f3;
  --primary-hover: #ffffff;
  --on-primary: #0a0e1a;
  --focus: #ffd8a3;

  --good: #9aeac4;
  --warn: #f6c777;
  --warn-tint: rgba(246, 199, 119, 0.12);
  --error: #ffc2c2;

  --shadow-card: 0 0 0 1px var(--line), 0 24px 48px -28px rgba(0, 0, 0, 0.7);
  --shadow-card-hover: 0 0 0 1px var(--line-strong), 0 28px 56px -28px rgba(0, 0, 0, 0.8);
  --shadow-float: 0 0 0 1px var(--line), 0 32px 64px -32px rgba(0, 0, 0, 0.8);
  --shadow-raised: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0, 0, 0, 0.4);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --panel-bg: linear-gradient(140deg, #141826 0%, #1a1f2e 60%, #2a2214 100%);
  --panel-ink: #faf8f3;
  --panel-ink-2: #e4dfd3;
  --panel-card: rgba(250, 248, 243, 0.06);
  --panel-line: rgba(250, 248, 243, 0.16);
  --panel-accent: #ffd8a3;
  --panel-focus: #ffffff;
  --stub: #1d2230;
  --stub-perforation: rgba(250, 248, 243, 0.26);
}

/* 2. Base ------------------------------------------------------------------ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  position: relative;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Thai script needs more vertical room and no negative tracking. */
:lang(th) {
  line-height: 1.75;
  letter-spacing: 0;
}

h1,
h2,
h3,
p,
ul,
dl,
dd,
fieldset {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

fieldset {
  border: 0;
  min-width: 0;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

[hidden] {
  display: none !important;
}

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

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-control);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s, box-shadow 0.16s, transform 0.16s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--primary), 0 8px 18px -10px rgba(10, 14, 26, 0.55);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 0 1px var(--primary-hover), 0 12px 22px -10px rgba(10, 14, 26, 0.6);
}

.btn-secondary {
  background: var(--surface-solid);
  box-shadow: var(--shadow-raised);
}

.btn-secondary:hover {
  box-shadow: 0 0 0 1px var(--line-strong), 0 2px 6px rgba(10, 14, 26, 0.12);
}

.btn-quiet {
  background: transparent;
  color: var(--accent);
  padding-inline: 12px;
}

.btn-quiet:hover {
  background: var(--accent-tint);
}

.text-link,
.inline-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.inline-link {
  overflow-wrap: anywhere;
}

.text-link:hover,
.inline-link:hover {
  text-decoration-thickness: 2px;
}

/* 3. Photo hero -----------------------------------------------------------
   The live site's Bangkok photograph, darkened so text on it clears AAA. */

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.hero,
.org-band {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--night);
  color: var(--hero-ink);
}

.hero-photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 64%;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(10, 14, 26, 0.9) 0%, rgba(10, 14, 26, 0.86) 56%, rgba(10, 14, 26, 0.46) 100%),
    linear-gradient(180deg, rgba(10, 14, 26, 0.3) 0%, rgba(10, 14, 26, 0) 40%, rgba(10, 14, 26, 0.7) 100%);
}

.hero-inner {
  padding-top: clamp(28px, 4vw, 52px);
  padding-bottom: clamp(76px, 8vw, 96px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font: 500 0.75rem/1.4 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hero-ink-2);
}

.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--hero-gold);
}

.hero h1 {
  max-width: 18em;
  font-family: var(--font-display);
  font-size: clamp(2.125rem, 1.15rem + 3.5vw, 3.625rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--hero-gold);
}

.hero h1:lang(th) {
  line-height: 1.4;
  letter-spacing: 0;
  font-size: clamp(1.75rem, 1rem + 2.6vw, 2.875rem);
  font-weight: 600;
}

.hero h1:lang(th) em {
  font-style: normal;
  font-weight: 600;
}

.hero-lede {
  max-width: 36em;
  margin-top: 14px;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.55;
  color: var(--hero-ink-2);
  text-wrap: pretty;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(24px, 4vw, 44px);
  width: fit-content;
  max-width: 100%;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(250, 248, 243, 0.2);
}

/* Number first for the eye, label first in the markup (dt before dd). */
.hero-stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}

.hero-stat dd {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums;
}

.hero-stat dt {
  font: 500 0.6875rem/1.4 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hero-ink-2);
}

/* The finder sits half on the photo, half on the page. */
.finder-wrap {
  position: relative;
  z-index: 2;
  margin-top: clamp(-52px, -4.5vw, -40px);
}

@media (max-width: 1099px) {
  .hero-shade {
    background: linear-gradient(180deg, rgba(10, 14, 26, 0.84) 0%, rgba(10, 14, 26, 0.88) 100%);
  }
}

/* 4. Header ---------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  text-decoration: none;
}

.brand-logo {
  width: 46px;
  height: auto;
}

[data-theme='dark'] .brand-logo {
  filter: invert(1) brightness(1.6);
}

.brand-text {
  display: grid;
  line-height: 1.2;
}

.brand-name {
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  font-family: var(--font-display);
  white-space: nowrap;
}

.brand-sub {
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-control);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 0.16s, color 0.16s;
}

.header-link:hover {
  background: var(--well);
  color: var(--ink);
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border-radius: 14px;
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line);
}

.lang-btn {
  min-width: 48px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.16s, color 0.16s;
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn[aria-pressed='true'] {
  background: var(--surface-solid);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-raised);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 0.16s, color 0.16s;
}

.icon-btn:hover {
  background: var(--well);
  color: var(--ink);
}

.icon-btn .icon {
  width: 20px;
  height: 20px;
}

.icon-btn .icon-sun,
.icon-btn[aria-pressed='true'] .icon-moon {
  display: none;
}

.icon-btn[aria-pressed='true'] .icon-sun {
  display: block;
}

/* 6. Finder ---------------------------------------------------------------- */

.finder {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-float), var(--highlight);
}

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

.search-field {
  position: relative;
  flex: 1 1 240px;
  min-width: 0;
}

.search-field .icon {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 50px;
  padding: 0 46px 0 46px;
  border: 1px solid var(--control-line);
  border-radius: 14px;
  background: var(--surface-solid);
  box-shadow: 0 1px 2px rgba(10, 14, 26, 0.06);
  font-size: 1rem;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.search-field input::placeholder {
  color: var(--ink-2);
  opacity: 1;
}

.search-field input:hover {
  border-color: var(--ink);
}

.search-field input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 14px;
}

.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-key {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font: 500 0.8125rem/1 var(--font);
  pointer-events: none;
}

.search-field input:focus ~ .search-key,
.search-field input:not(:placeholder-shown) ~ .search-key {
  display: none;
}

/* Segmented controls: the selected option is a raised, heavier tile, not just a colour. */

.seg {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  border-radius: 14px;
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line);
}

.seg label {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 11px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s, color 0.16s, box-shadow 0.16s;
}

.seg label:hover {
  color: var(--ink);
}

.seg input:checked + label {
  background: var(--surface-solid);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-raised);
}

.seg input:focus-visible + label,
.months input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Youth switch */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 8px 0 6px;
  border-radius: var(--r-control);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-solid);
  box-shadow: inset 0 0 0 1.5px var(--control-line);
  transition: background-color 0.2s, box-shadow 0.2s;
}

.switch-thumb {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--control-line);
  transition: transform 0.22s var(--ease), background-color 0.2s;
}

.switch input:checked + .switch-track {
  background: var(--primary);
  box-shadow: inset 0 0 0 1.5px var(--primary);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
  background: #ffffff;
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Month chips */

.months-field {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.months {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.months label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px 0 14px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s, color 0.16s;
}

.months label:hover {
  background: var(--well);
  color: var(--ink);
}

.chip-count {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--well);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.months input:checked + label {
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

.months input:checked + label .chip-count {
  background: color-mix(in srgb, var(--bg) 18%, transparent);
}

/* 7. Listing --------------------------------------------------------------- */

.listings {
  padding-top: 22px;
  padding-bottom: clamp(48px, 8vw, 96px);
}

.listings:focus {
  outline: none;
}

.result-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  min-height: 44px;
  margin-bottom: 6px;
}

.result-count {
  font-size: 0.75rem;
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.groups {
  display: grid;
  gap: clamp(36px, 5vw, 56px);
}

.group {
  display: grid;
  gap: 16px;
}

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
}

.group-head::after {
  content: '';
  order: 1;
  flex: 1 1 40px;
  align-self: center;
  height: 1px;
  background: var(--line-strong);
}

.group-count {
  order: 2;
}

.group-note {
  order: 3;
  flex-basis: 100%;
}

.group-title {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.group-title:lang(th) {
  line-height: 1.5;
  letter-spacing: 0;
}

.group-count {
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.6875rem;
  font-weight: 500;
}

.group-note {
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.group-note {
  max-width: 22em;
  margin-top: 8px;
}

.event-list {
  display: grid;
  gap: 14px;
}

@media (min-width: 1020px) {
  .group {
    grid-template-columns: 208px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }

  .group-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    position: sticky;
    top: 96px;
    padding-top: 22px;
  }

  .group-head::after {
    flex: none;
    align-self: stretch;
  }

  .group-title {
    font-size: 1.75rem;
  }
}

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: clamp(40px, 8vw, 72px) 24px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card), var(--highlight);
  text-align: center;
}

.empty-board {
  width: 72px;
  height: 72px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: repeating-conic-gradient(var(--accent-ring) 0% 25%, transparent 0% 50%) 0 0 / 36px 36px, var(--surface-solid);
  box-shadow: var(--shadow-raised);
  transform: rotate(-6deg);
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.empty p {
  max-width: 30em;
  margin-bottom: 12px;
  color: var(--ink-2);
}

.notice {
  padding: 20px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

/* 8. Event card ------------------------------------------------------------ */

.event {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card), var(--highlight);
  transition: box-shadow 0.25s var(--ease);
}

.event:hover,
.event:focus-within {
  box-shadow: var(--shadow-card-hover), var(--highlight);
}

/* Date block: a small tinted tile; on phones it lies flat as a strip. */

.event-date {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'days weekday' 'days month';
  align-items: center;
  column-gap: 14px;
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  line-height: 1.25;
  row-gap: 5px;
}

.date-weekday {
  grid-area: weekday;
  align-self: end;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.date-days {
  grid-area: days;
  font-size: 1.875rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-family: var(--font-display);
}

.date-month {
  grid-area: month;
  align-self: start;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.event-date.is-open-date {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  border: 0;
  outline: 1px dashed transparent;
  background-image: repeating-linear-gradient(135deg, var(--well) 0 6px, transparent 6px 12px);
}

.event-date.is-open-date .date-days {
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.event-date.is-open-date .date-month {
  grid-row: 1 / -1;
  align-self: center;
  color: var(--ink-2);
  font-weight: 500;
}

.event-date :lang(th) {
  letter-spacing: 0;
}

/* Main column */

.event-main {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

.event-name {
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
}

.event-name:lang(th),
.event-name :lang(th) {
  line-height: 1.55;
  letter-spacing: 0;
}

.event-place {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: -4px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.event-place .icon {
  margin-top: 3px;
  width: 17px;
  height: 17px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--r-tag);
  background: var(--well);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.tag .icon {
  width: 14px;
  height: 14px;
  margin-left: -2px;
  stroke-width: 2;
}

.tag-type {
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--accent-ring);
  color: var(--accent);
  font-weight: 600;
}

.tag-confirmed {
  background: transparent;
  color: var(--good);
}

.tag-tentative {
  background: transparent;
  box-shadow: none;
  border: 1px dashed var(--control-line);
  color: var(--ink-2);
}

.event-cats {
  font-size: 0.9375rem;
}

.cats-label {
  margin-right: 8px;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.timing strong {
  font-weight: 600;
  color: var(--ink);
}

.timing .icon {
  width: 17px;
  height: 17px;
}

.timing.is-soon {
  justify-self: start;
  padding: 5px 12px 5px 9px;
  border-radius: 999px;
  background: var(--warn-tint);
  color: var(--warn);
}

.timing.is-soon strong {
  color: var(--warn);
}

.timing.is-live strong {
  color: var(--good);
}

.live-dot {
  position: relative;
  width: 9px;
  height: 9px;
  margin-inline: 4px 2px;
  border-radius: 50%;
  background: var(--good);
}

.live-dot::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid var(--good);
  opacity: 0;
  animation: ping 2.4s var(--ease) infinite;
}

/* Side column: organizer and actions */

.event-side {
  display: grid;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.org {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  min-width: 0;
  border-radius: 12px;
  text-decoration: none;
}

/* Organizer logos. Three cases, set by logoMark() / tc_logo_mark() from the logo manifest:
   .is-clear  transparent artwork, sits straight on the card surface (no tile)
   .is-bleed  the background is part of the design: fills a rounded tile edge to edge
   neither    initials, or an opaque logo without a manifest entry: white tile, as before */
.org-logo {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  object-fit: contain;
}

.org-logo:not(.is-clear) {
  box-shadow: 0 0 0 1px var(--line), 0 2px 5px rgba(10, 14, 26, 0.08);
}

img.org-logo:not(.is-clear),
img.profile-logo:not(.is-clear) {
  background: #ffffff;
}

.org-logo.is-clear {
  width: 44px;
  height: 44px;
  border-radius: 0;
}

.org-logo.is-bleed,
.profile-logo.is-bleed {
  object-fit: cover;
}

/* Mostly-black artwork would vanish on the dark theme: show it inverted (white). */
[data-theme='dark'] .org-logo.is-dark-ink,
[data-theme='dark'] .profile-logo.is-dark-ink {
  filter: invert(1);
}

.org-initials {
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--accent-tint), transparent), var(--surface-solid);
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.org-text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.org-label {
  font-size: 0.625rem;
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.org-name {
  font-size: 0.9375rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

a.org .org-name {
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a.org:hover .org-name {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-actions .btn {
  flex: 1 1 auto;
}

.btn-details .icon {
  transition: transform 0.25s var(--ease);
}

.btn-details[aria-expanded='true'] .icon {
  transform: rotate(180deg);
}

/* Expanding details */

.event-more {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: -16px;
  transition: grid-template-rows 0.32s var(--ease), margin-top 0.32s var(--ease);
}

.event-more-inner {
  min-height: 0;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.24s, visibility 0s 0.32s;
}

.event.is-open .event-more {
  grid-template-rows: 1fr;
  margin-top: 0;
}

.event.is-open .event-more-inner {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.3s 0.06s, visibility 0s;
}

.facts {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.fact {
  display: grid;
  gap: 2px;
  align-content: start;
}

.fact dt {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fact dd {
  max-width: 68ch;
  font-size: 0.9375rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.more-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 12px 0 -4px -12px;
}

/* Quiet cards: placeholders and undated events sit flatter on the page. */

.event.is-quiet {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.event.is-quiet .event-name {
  font-size: 1.0625rem;
}

/* From 560px the date becomes an upright tile beside the content. */
@media (min-width: 560px) {
  .event {
    grid-template-columns: 124px minmax(0, 1fr);
    gap: 16px 24px;
    padding: 20px;
  }

  .event-date {
    grid-row: 1 / span 2;
    align-self: start;
    grid-template-columns: 1fr;
    grid-template-areas: 'weekday' 'days' 'month';
    justify-items: center;
    align-content: center;
    row-gap: 3px;
    min-height: 112px;
    padding: 14px 8px;
    text-align: center;
  }

  .date-days {
    font-size: 2.125rem;
  }

  .event-date.is-open-date .date-month {
    grid-area: month;
  }

  .event-side {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .event-actions .btn {
    flex: 0 1 auto;
  }

  .event-more {
    grid-column: 2;
  }

  .fact {
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 16px;
    align-items: baseline;
  }
}

/* From 900px organizer and actions move into their own column. */
@media (min-width: 900px) {
  .event {
    grid-template-columns: 124px minmax(0, 1fr) 284px;
    gap: 0 24px;
  }

  .event-date {
    grid-row: auto;
  }

  .event-main {
    padding-block: 2px;
  }

  .event-side {
    grid-column: 3;
    display: grid;
    align-content: space-between;
    justify-content: stretch;
    justify-items: end;
    padding: 0 0 0 24px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .org {
    flex-direction: row-reverse;
    text-align: right;
  }

  .event-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .event-more {
    grid-column: 2 / -1;
    margin-top: 0;
  }

  .event.is-open .event-more {
    margin-top: 18px;
  }
}

/* Ticket stub: each card reads as a tournament entry ticket. The date is the stub, filling the
   card's edge (top on phones, left from 560px) behind a perforation with two notches, instead of
   a framed tile sitting inside the framed card. */
.event {
  overflow: hidden;
}

.event-date {
  position: relative;
  margin: -16px -16px 0;
  padding: 12px 16px;
  border-radius: 0;
  background-color: var(--stub);
  box-shadow: none;
  border-bottom: 2px dashed var(--stub-perforation);
}

.event-date::before,
.event-date::after {
  content: '';
  position: absolute;
  bottom: -10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
}

.event-date::before {
  left: -9px;
}

.event-date::after {
  right: -9px;
}

.event-date.is-open-date {
  background-color: var(--stub);
  box-shadow: none;
}

.date-month {
  color: var(--accent);
}

.cats-label,
.org-label {
  font-size: 0.75rem;
}

@media (min-width: 560px) {
  .event-date {
    grid-row: 1 / span 3;
    align-self: stretch;
    min-height: 0;
    margin: -20px 0 -20px -20px;
    padding: 26px 10px 20px;
    align-content: start;
    border-bottom: 0;
    border-right: 2px dashed var(--stub-perforation);
  }

  .event-date::before,
  .event-date::after {
    left: auto;
    right: -10px;
    bottom: auto;
  }

  .event-date::before {
    top: -9px;
  }

  .event-date::after {
    bottom: -9px;
  }

  .date-days {
    font-size: 2.5rem;
  }
}

@media (min-width: 900px) {
  .event-date {
    grid-row: 1 / span 2;
  }
}

/* 9. Weekly panel ---------------------------------------------------------- */

.weekly {
  padding-bottom: clamp(48px, 8vw, 96px);
}

.weekly-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4.5vw, 52px);
  border-radius: clamp(24px, 3vw, 32px);
  background: var(--panel-bg);
  color: var(--panel-ink);
  box-shadow: 0 0 0 1px var(--panel-line), 0 32px 64px -44px rgba(60, 46, 16, 0.45);
}

.weekly-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(40% 70% at 100% 0%, rgba(255, 216, 163, 0.16), transparent 70%),
    radial-gradient(36% 60% at 0% 100%, rgba(184, 134, 11, 0.14), transparent 70%);
  pointer-events: none;
}

.weekly-panel > * {
  position: relative;
}

.weekly-head {
  display: grid;
  gap: 8px;
  max-width: 36em;
  margin-bottom: clamp(20px, 3vw, 32px);
}

.weekly-head h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.weekly-head h2:lang(th) {
  line-height: 1.5;
  letter-spacing: 0;
}

.weekly-head p {
  color: var(--panel-ink-2);
}

.weekly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 232px), 1fr));
  gap: 12px;
}

.weekly-card {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 18px;
  border-radius: 18px;
  background: var(--panel-card);
  box-shadow: inset 0 0 0 1px var(--panel-line), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.weekly-when {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--panel-accent);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.weekly-name {
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-family: var(--font-display);
}

.weekly-where {
  font-size: 0.9375rem;
  color: var(--panel-ink-2);
}

.weekly-card .text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-self: start;
  min-height: 44px;
  margin-bottom: -10px;
  color: var(--panel-ink);
}

.weekly-panel :focus-visible {
  outline-color: var(--panel-focus);
}

/* 10. Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 36px 56px;
}

.site-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px 24px;
}

.site-footer-text {
  display: grid;
  gap: 6px;
  flex: 1 1 280px;
  max-width: 64ch;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.site-footer-text p:first-child {
  color: var(--ink);
  font-weight: 500;
}

.site-footer-actions {
  display: grid;
  gap: 10px;
  flex: 0 1 auto;
  font-size: 0.9375rem;
  font-weight: 500;
}

.site-footer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 11. Organizer page ------------------------------------------------------- */

.org-stage {
  position: relative;
}

.org-band {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 0;
  height: clamp(210px, 22vw, 270px);
}

.org-band .hero-shade {
  background: linear-gradient(180deg, rgba(10, 14, 26, 0.84) 0%, rgba(10, 14, 26, 0.84) 34%, rgba(10, 14, 26, 0.55) 100%);
}

/* The breadcrumb sits on the photo, so it uses the hero's light ink (see .crumbs below). */
.crumbs :focus-visible {
  outline-color: var(--hero-ink);
}

#organizer-root {
  padding-bottom: clamp(48px, 8vw, 96px);
}

.crumbs {
  padding-top: clamp(12px, 2vw, 24px);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  color: var(--hero-ink-2);
}

.crumbs li + li::before {
  content: '/';
  margin-right: 10px;
  color: var(--hero-ink-2);
}

.crumb-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-left: -6px;
  padding: 0 10px 0 4px;
  border-radius: var(--r-control);
  color: var(--hero-ink);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.16s, color 0.16s;
}

.crumb-link:hover {
  background: rgba(250, 248, 243, 0.14);
  color: var(--hero-gold);
}

.profile {
  padding-top: clamp(8px, 1.5vw, 16px);
}

.profile-card {
  display: grid;
  gap: 20px;
  padding: clamp(20px, 4vw, 40px);
  border-radius: clamp(24px, 3vw, 32px);
  background: var(--surface);
  box-shadow: var(--shadow-float), var(--highlight);
}

.profile-logo {
  width: 80px;
  height: 80px;
  border-radius: 22px;
  object-fit: contain;
}

.profile-logo:not(.is-clear) {
  box-shadow: 0 0 0 1px var(--line), 0 10px 24px -10px rgba(60, 46, 16, 0.35);
}

/* A transparent logo gets its depth from a soft shadow that follows its own outline. */
.profile-logo.is-clear {
  border-radius: 0;
  filter: drop-shadow(0 8px 14px rgba(10, 14, 26, 0.16));
}

.profile-logo.org-initials {
  font-size: 1.75rem;
  letter-spacing: -0.01em;
}

.profile-main {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.profile-kind {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-main h1 {
  margin-top: -6px;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.875rem);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
}

.profile-main h1:lang(th),
.profile-main h1 :lang(th) {
  line-height: 1.45;
  letter-spacing: 0;
}

.profile-desc {
  max-width: 40em;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.org-section {
  padding-top: clamp(32px, 5vw, 52px);
  padding-bottom: 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.section-title:lang(th) {
  line-height: 1.5;
  letter-spacing: 0;
}

.org-missing {
  padding-top: clamp(32px, 6vw, 72px);
}

.org-missing h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* Past tournaments: a quiet ledger rather than full cards. */

.past-list {
  margin: 0;
  padding: 4px 0;
  list-style: none;
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-card), var(--highlight);
}

.past-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'date tag' 'name name' 'place place';
  align-items: center;
  gap: 4px 12px;
  padding: 14px 18px;
}

.past-row + .past-row {
  border-top: 1px solid var(--line);
}

.js .past-list.is-collapsed .is-extra {
  display: none;
}

.past-date {
  grid-area: date;
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  font-family: var(--font-mono);
}

.past-name {
  grid-area: name;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: 1.0625rem;
}

.past-row .tag {
  grid-area: tag;
  justify-self: end;
}

.past-place {
  grid-area: place;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.past-toggle {
  margin-top: 12px;
}

.past-toggle .icon {
  transition: transform 0.25s var(--ease);
}

.past-toggle[aria-expanded='true'] .icon {
  transform: rotate(180deg);
}

@media (min-width: 640px) {
  .profile-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: clamp(20px, 3vw, 36px);
  }

  .profile-logo {
    width: 112px;
    height: 112px;
    border-radius: 28px;
  }
}

@media (min-width: 820px) {
  .past-row {
    grid-template-columns: 168px minmax(0, 1fr) 92px minmax(0, 220px);
    grid-template-areas: 'date name tag place';
    gap: 20px;
    padding: 12px 22px;
  }

  .past-row .tag {
    justify-self: start;
  }
}

/* 12. Dialogs and forms ---------------------------------------------------- */

html:has(dialog[open]) {
  overflow: hidden;
}

.dialog {
  width: min(600px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 26px;
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: var(--shadow-float), 0 60px 120px -40px rgba(10, 14, 26, 0.5);
  overflow: hidden;
}

.dialog::backdrop {
  background: rgba(10, 14, 26, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.dialog[open] {
  animation: dialog-in 0.28s var(--ease);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 24px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 16px 14px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(160deg, var(--accent-tint), transparent 70%);
}

.dialog-head h3 {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}

.dialog-head h3:lang(th) {
  line-height: 1.5;
  letter-spacing: 0;
}

.dialog-head p {
  margin-top: 4px;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 20px 24px;
  overflow-y: auto;
}

.field {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}

.field-label {
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.field-optional {
  font-weight: 400;
  color: var(--ink-2);
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--control-line);
  border-radius: var(--r-control);
  background: var(--surface-solid);
  color: var(--ink);
  font: inherit;
  line-height: 1.4;
  transition: border-color 0.16s, box-shadow 0.16s;
}

textarea.input {
  resize: vertical;
}

.input:hover {
  border-color: var(--ink);
}

.input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-control);
}

.input[aria-invalid] {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px var(--error);
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.field-error {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--error);
}

.field .seg {
  width: 100%;
}

.field .seg label {
  flex: 1 1 0;
}

/* Honeypot for bots: off-screen, not focusable, hidden from assistive tech. */
.field-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--line);
}

.form-status {
  flex: 1 1 200px;
  min-height: 1.5em;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.form-status.is-success {
  color: var(--good);
  font-weight: 600;
}

.form-status.is-error {
  color: var(--error);
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

@media (max-width: 559px) {
  /* Status takes its own line so Cancel and Send stay side by side. */
  .form-status {
    flex-basis: 100%;
  }

  .dialog-foot .btn {
    flex: 1 1 auto;
  }
}

@media (min-width: 560px) {
  .dialog-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field,
  .dialog-body > fieldset {
    grid-column: 1 / -1;
  }

  .field.field-half {
    grid-column: auto;
  }
}

/* 13. Without JavaScript ---------------------------------------------------
   The listing is server-rendered, so the page still works: details are shown open and the
   controls that need scripting are removed rather than left inert. */

.no-js .finder,
.no-js .btn-details,
.no-js .past-toggle,
.no-js .lang-switch,
.no-js #theme-toggle,
.no-js [data-open-dialog],
.no-js .site-footer-actions {
  display: none;
}

.js .no-js-only {
  display: none;
}

.no-js .event-more {
  grid-template-rows: 1fr;
  margin-top: 0;
}

.no-js .event-more-inner {
  visibility: visible;
  opacity: 1;
}

/* 14. Motion and small screens --------------------------------------------- */

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes ping {
  0% {
    opacity: 0.7;
    transform: scale(0.5);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.25);
  }
}

@media (max-width: 719px) {
  .site-header {
    position: static;
  }

  html {
    scroll-padding-top: 16px;
  }

  .header-link,
  .search-key {
    display: none;
  }

  .seg-field,
  .seg {
    width: 100%;
  }

  .seg label {
    flex: 1 1 auto;
    padding-inline: 6px;
    font-size: 0.875rem;
  }

  .atmosphere-board {
    right: -420px;
    opacity: 0.8;
  }
}

/* Filter sheet pieces exist only for phones; a month with nothing to show under the other
   filters is dimmed, not removed, so the month list never jumps. */
.sheet-head,
.sheet-foot,
.filters-toggle {
  display: none;
}

.months label.is-empty {
  opacity: 0.5;
}

@keyframes sheet-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@media (max-width: 719px) {
  /* Phones: the first tournament must reach the first screen, so the hero tightens and the
     finder folds down to search plus one Filters button that opens a bottom sheet. */
  .hero-inner {
    padding-top: 20px;
    padding-bottom: 60px;
  }

  .eyebrow {
    margin-bottom: 10px;
  }

  .hero-lede {
    margin-top: 10px;
    font-size: 0.9375rem;
    line-height: 1.5;
  }

  .hero-stats {
    margin-top: 14px;
    padding-top: 12px;
    gap: 6px 20px;
  }

  .hero-stat {
    flex-direction: row-reverse;
    align-items: baseline;
    gap: 6px;
  }

  .hero-stat dd {
    font-size: 1.25rem;
  }

  .finder-row {
    flex-wrap: nowrap;
  }

  /* The phone hides the "/" hint, so the field gets its right padding back. */
  .search-field input {
    padding-right: 14px;
  }

  /* Inside the open sheet the controls stack, one full-width row each. */
  .finder.is-open .finder-row {
    flex-direction: column;
    align-items: stretch;
  }

  .finder.is-open .search-field {
    flex: none;
  }

  .finder.is-open .switch {
    align-self: flex-start;
  }

  .finder:not(.is-open) .seg-field,
  .finder:not(.is-open) .switch,
  .finder:not(.is-open) .months-field {
    display: none;
  }

  .filters-toggle {
    display: inline-flex;
    flex: none;
    height: 50px;
    border-radius: 14px;
    background: var(--surface-solid);
    color: var(--ink);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--control-line);
  }

  .filters-toggle .icon {
    width: 20px;
    height: 20px;
  }

  .filters-toggle.is-active {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: none;
  }

  .finder.is-open {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    max-height: 88vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--surface-solid);
    animation: sheet-up 0.24s var(--ease);
  }

  .finder.is-open .filters-toggle {
    display: none;
  }

  .finder.is-open .sheet-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 6px;
    background: var(--surface-solid);
  }

  .sheet-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 500;
  }

  .finder.is-open .sheet-foot {
    position: sticky;
    bottom: calc(-16px - env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    margin-top: 4px;
    padding: 12px 0 16px;
    background: var(--surface-solid);
    border-top: 1px solid var(--line);
  }

  .sheet-foot .btn-primary {
    flex: 1;
    min-height: 50px;
  }

  .sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(10, 14, 26, 0.55);
  }

  html.sheet-open {
    overflow: hidden;
  }

  /* The sheet and its backdrop live in the finder's stacking layer; lift it over the sticky bar. */
  html.sheet-open .finder-wrap {
    z-index: 70;
  }

  /* The count and Clear stay in view while the list scrolls, so every filter change shows. */
  .result-bar {
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
    margin-inline: calc(-1 * var(--page-pad));
    padding: 6px var(--page-pad);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }

  .result-bar .result-count {
    flex: 1 1 auto;
    min-width: 0;
  }

  .result-bar .btn {
    flex: none;
    padding-inline: 10px;
  }
}

@media (max-width: 420px) {
  .brand-name {
    font-size: 1.0625rem;
  }

  .brand {
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .brand-sub {
    display: none;
  }

  .brand-name {
    font-size: 0.9375rem;
  }

  .lang-btn {
    min-width: 44px;
    padding: 0 8px;
  }

  .brand-logo {
    width: 40px;
  }

  .seg label {
    padding-inline: 4px;
    font-size: 0.8125rem;
  }
}

@media (max-width: 350px) {
  .brand-name {
    white-space: normal;
    line-height: 1.1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .seg input:checked + label,
  .months input:checked + label,
  .lang-btn[aria-pressed='true'] {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }

  .event,
  .finder,
  .tag {
    border: 1px solid CanvasText;
  }
}
