/* GKR Karate tournaments. White paper, black ink, GKR red. Mobile first. */

:root {
  --paper: #ffffff;
  --paper-2: #f4f4f5;
  --ink: #141414;
  --muted: #55555c;
  --faint: #86868d;
  --line: #e4e4e7;
  --red: #d4112c;
  --red-dark: #a50d22;
  --green: #12733b;
  --r: 14px;
  --r-sm: 9px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; }
a { color: var(--ink); text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--red-dark); }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { margin: 0 0 0.5em; line-height: 1.08; letter-spacing: -0.01em; font-weight: 800; }
h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); text-transform: uppercase; }
h2, .h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); text-transform: uppercase; }
h3, .h3 { font-size: 1.2rem; text-transform: none; letter-spacing: 0; }
h2 small, .h3 small, legend small, label small { font-size: 0.82rem; font-weight: 500; text-transform: none; letter-spacing: 0; }
p { margin: 0 0 1em; }
code { font: 0.88em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 5px; }

.container { width: min(100% - 2.5rem, 1120px); margin-inline: auto; }
.narrow { max-width: 760px; }
.form-narrow { max-width: 620px; }
.section { padding: clamp(2rem, 6vw, 4rem) 0; }
.section-tight { padding-bottom: 0; }
.section-alt { background: var(--paper-2); }
.spaced { margin-top: 2.2rem; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.88rem; }
.lead { font-size: 1.1rem; color: var(--muted); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kicker { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); margin-bottom: 0.6rem; }
.grid-2 { display: grid; gap: 2rem; }
@media (min-width: 820px) { .grid-2 { grid-template-columns: 1fr 1fr; gap: 3rem; } }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; flex-wrap: wrap; padding-block: 0.6rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.8rem; }
.brand img { height: 34px; width: auto; display: block; }
.admin-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; font-size: 0.92rem; }
.admin-nav a { text-decoration: none; font-weight: 600; }
.admin-nav form { margin: 0; }
.site-footer { border-top: 1px solid var(--line); padding: 1.4rem 0; color: var(--faint); font-size: 0.85rem; }
.site-footer .container { display: flex; justify-content: space-between; }
.site-footer a { color: var(--faint); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.7rem 1.4rem;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
.danger { color: var(--red-dark); }

/* Tournament page */
.hero { padding: clamp(2.5rem, 8vw, 5rem) 0 clamp(2rem, 5vw, 3rem); border-bottom: 1px solid var(--line); }
.hero-meta { display: flex; flex-direction: column; gap: 0.15rem; font-size: 1.15rem; margin: 1rem 0 1.6rem; }
.hero-meta span { color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.notice { background: var(--paper-2); border-left: 4px solid var(--ink); padding: 0.9rem 1.1rem; border-radius: var(--r-sm); }
.success { background: #eef8f1; border-left: 4px solid var(--green); padding: 1.2rem 1.3rem; border-radius: var(--r-sm); margin-bottom: 1.5rem; }
.success h1 { margin-bottom: 0.3em; }
.success p:last-child { margin: 0; }
.success-line { color: var(--green); font-weight: 600; }
.error { color: var(--red-dark); font-size: 0.9rem; font-weight: 600; }
.error ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.error:empty, .validation-summary-valid { display: none; }

.price-list, .ruled, .item-list, .division-list { list-style: none; margin: 0; padding: 0; }
.price-list li, .ruled li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.price-list span { display: flex; flex-direction: column; font-weight: 600; }
.price-list small { font-weight: 400; color: var(--muted); font-size: 0.86rem; }
.price-list b { font-size: 1.15rem; white-space: nowrap; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.timeline time { font-weight: 800; color: var(--red); }
.timeline p { margin: 0.15rem 0 0; color: var(--muted); }

.accordion { border-bottom: 1px solid var(--line); }
.accordion summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; cursor: pointer; font-weight: 700; list-style: none; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary::after { content: "+"; font-size: 1.4rem; font-weight: 400; line-height: 1; color: var(--red); }
.accordion[open] summary::after { content: "\2212"; }
.accordion summary small { margin-left: auto; color: var(--muted); font-weight: 400; }
.accordion > p { color: var(--muted); padding-bottom: 0.4rem; }
.division-list { columns: 1; padding-bottom: 1rem; }
.division-list li { padding: 0.22rem 0; font-size: 0.93rem; break-inside: avoid; }
.division-list em { color: var(--muted); font-size: 0.85em; }
@media (min-width: 700px) { .division-list { columns: 2; column-gap: 2rem; } }

.mobile-cta { position: sticky; bottom: 0; padding: 0.75rem 1.25rem; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.mobile-cta .btn { width: 100%; }
@media (min-width: 700px) { .mobile-cta { display: none; } }

/* Cards, tags, lists */
.card-list { display: grid; gap: 0.9rem; margin-top: 1.5rem; }
.card { border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.3rem; }
.card-link { display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-decoration: none; }
.card-link:hover { border-color: var(--ink); color: var(--ink); }
.card p { margin: 0; }
.tag { display: inline-block; padding: 0.18rem 0.6rem; border-radius: 999px; background: var(--paper-2); color: var(--muted); font-size: 0.76rem; font-weight: 700; white-space: nowrap; }
.tag-open { background: #eef8f1; color: var(--green); }

.item-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.item-list li > div:first-child { display: flex; flex-direction: column; }
.item-list .muted { font-size: 0.9rem; }
.item-actions, .row-actions { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.item-actions form, .row-actions form { margin: 0; }
td.row-actions { justify-content: flex-end; }

/* Forms */
.form { display: grid; gap: 1rem; margin-top: 1.2rem; }
.form-wide { max-width: 980px; }
.form label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.93rem; }
.form label small { color: var(--muted); }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .search input[name=q] {
  width: 100%; min-height: 48px; padding: 0.65rem 0.85rem;
  border: 1.5px solid #c9c9cf; border-radius: var(--r-sm); background: #fff; color: var(--ink);
  font: inherit; font-size: 1rem;
}
.form textarea { min-height: 0; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--ink); outline: 2px solid var(--red); outline-offset: 1px; }
.form input[readonly] { background: var(--paper-2); }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 560px) { .field-row { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); } }
.form fieldset, .choice-group { border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem 1.3rem; margin: 0; display: grid; gap: 1rem; }
.form legend, .choice-group legend { padding: 0 0.5rem; font-weight: 800; font-size: 1.05rem; }
.choice-group legend small { display: block; color: var(--muted); }
.form label.check, .form label.choice { display: flex; align-items: flex-start; gap: 0.7rem; font-weight: 500; cursor: pointer; }
.check input, .choice input { width: 22px; height: 22px; margin: 0.1rem 0 0; flex: none; accent-color: var(--red); }
.choice { padding: 0.75rem 0.9rem; border: 1.5px solid var(--line); border-radius: var(--r-sm); }
.choice:has(input:checked) { border-color: var(--ink); background: var(--paper-2); }
.choice.is-locked { cursor: default; color: var(--muted); }
.choice.is-locked small { display: block; font-size: 0.82rem; }
.line-actions { display: flex; align-items: center; gap: 0.8rem; justify-content: flex-end; }
.line-actions form { margin: 0; }
.choice-group { gap: 0.6rem; }
.qty-row { display: grid; grid-template-columns: 1fr 5.5rem; gap: 1rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.qty-row > div { display: flex; flex-direction: column; }
.qty-row .muted { font-size: 0.88rem; }
.qty-row input { text-align: center; }

.add-panel { margin: 1.4rem 0; }
.add-panel > summary { list-style: none; width: fit-content; }
.add-panel > summary::-webkit-details-marker { display: none; }
.add-panel[open] > summary { border-color: var(--line); color: var(--muted); }
.flow-nav { display: grid; gap: 1rem; justify-items: center; margin-top: 1.8rem; text-align: center; }
.flow-back { display: inline-block; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; color: var(--muted); margin-bottom: 0.8rem; }
.flow-back::before { content: "\2190\00a0"; }
.flow-head { margin-bottom: 1.6rem; }

.steps { list-style: none; display: flex; gap: 0.35rem; padding: 0; margin: 0 0 1rem; overflow-x: auto; }
.steps li { flex: 1; min-width: 0; }
.steps a { display: flex; flex-direction: column; gap: 0.3rem; padding-top: 0.55rem; border-top: 4px solid var(--line); text-decoration: none; color: var(--faint); font-size: 0.74rem; font-weight: 700; }
.steps b { font-size: 0.74rem; }
.steps span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps .is-done a { border-color: var(--ink); color: var(--ink); }
.steps .is-current a { border-color: var(--red); color: var(--red); }

/* Summary, facts, tables */
.summary { width: 100%; border-collapse: collapse; margin: 1rem 0 1.4rem; }
.summary td, .summary th { padding: 0.6rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.summary td.num { text-align: right; }
.summary-head th { padding-top: 1.2rem; font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--ink); }
.summary small { display: block; color: var(--muted); }
.summary tfoot th { font-weight: 600; }
.summary tfoot tr:first-child > * { border-top: 2px solid var(--ink); font-size: 1.1rem; }

.facts { display: grid; gap: 0; margin: 1rem 0; }
.facts > div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 0.9rem; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1 { margin: 0; }
.tabs { display: flex; gap: 1.4rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; overflow-x: auto; }
.tabs a { padding: 0.7rem 0; text-decoration: none; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.is-current { color: var(--ink); border-color: var(--red); }

.table { width: 100%; border-collapse: collapse; font-size: 0.94rem; display: block; overflow-x: auto; }
@media (min-width: 900px) { .table { display: table; } }
.table th, .table td { padding: 0.7rem 0.8rem 0.7rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; padding-right: 0; }
.table-compact th, .table-compact td { padding-block: 0.4rem; }
.table tr.is-off td { color: var(--faint); }
.table a { font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.8rem; margin-bottom: 1.8rem; }
.stats div { border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; display: flex; flex-direction: column; }
.stats b { font-size: 1.7rem; line-height: 1.1; }
.stats span { color: var(--muted); font-size: 0.85rem; }
.search { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; flex: 1; }
.search input[name=q] { max-width: 340px; }
.search .check { display: flex; gap: 0.4rem; align-items: center; font-size: 0.9rem; }
.chip-form { display: inline; }
.chip { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 0.15rem 0.6rem; font: inherit; font-size: 0.82rem; cursor: pointer; margin: 0 0.2rem 0.3rem 0; }
.chip.is-off { color: var(--faint); text-decoration: line-through; }
.code { background: var(--ink); color: #f4f4f5; padding: 1rem 1.2rem; border-radius: var(--r-sm); overflow-x: auto; font: 0.85rem/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.key { font-size: 1rem; user-select: all; word-break: break-all; }
.email-preview { border: 1px solid var(--line); border-radius: var(--r); padding: 1.5rem; }
