/* BJJ Gym Guide shared styles. Layout: one centered column (max 1180px) of full-width bands; a sticky header carries a belt-styled scroll progress bar. */
:root {
  --bg: #F3F5F9;          /* gi cotton, cool */
  --surface: #FFFFFF;
  --sunk: #E9EDF4;
  --ink: #10151F;
  --muted: #576072;
  --line: #D9DFE9;
  --mat: #1C3FA0;         /* blue belt, competition mat */
  --mat-ink: #FFFFFF;
  --mat-soft: #E1E8F8;
  --link: #1C3FA0;
  --bar: #C3242E;         /* black belt rank bar */
  --ok: #1B7347; --ok-soft: #E0F1E7;
  --board: #0B0F17; --board-ink: #F4F6FA; --board-dim: #8892A6; --board-line: #232B3A;
  --tape: #F4F3EE; --belt: #16181D;
  --f-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --r: 10px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);  /* entering and pressing */
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);  /* sheets that slide in */
  --shadow: 0 1px 2px rgb(16 21 31 / .06), 0 8px 24px rgb(16 21 31 / .06);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0C1018; --surface: #141A25; --sunk: #1A2130; --ink: #E8ECF3; --muted: #98A2B5; --line: #263042;
  --mat: #3A62D6; --mat-ink: #FFFFFF; --mat-soft: #1A2647; --link: #8EA9F7; --bar: #F0626A;
  --ok: #73D3A0; --ok-soft: #14301F; --board: #05070C; --board-line: #1D2432;
  --belt: #2A303C; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3); color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0C1018; --surface: #141A25; --sunk: #1A2130; --ink: #E8ECF3; --muted: #98A2B5; --line: #263042;
  --mat: #3A62D6; --mat-ink: #FFFFFF; --mat-soft: #1A2647; --link: #8EA9F7; --bar: #F0626A;
  --ok: #73D3A0; --ok-soft: #14301F; --board: #05070C; --board-line: #1D2432;
  --belt: #2A303C; --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3); color-scheme: dark }

* { box-sizing: border-box }
[hidden] { display: none !important }
html { scroll-behavior: smooth; scroll-padding-top: 84px }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--f-body); margin: 0; -webkit-font-smoothing: antialiased }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 40; background: var(--surface) }
a { color: var(--link) }
button, input, select { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px }
h1, h2, h3 { text-wrap: balance; margin: 0 }
p { margin: 0 }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0 }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
.band { padding-block: clamp(56px, 9vw, 112px) }
.band.alt { background: var(--surface); border-block: 1px solid var(--line) }

/* Type scale: 13 / 16 / 19 / 26 / 40 / 64 / 104 */
.eyebrow { font: 600 13px/1 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px }
.eyebrow .tag { background: var(--belt); color: var(--tape); padding: 5px 8px; border-radius: 3px; letter-spacing: .08em }
.display { font: 900 clamp(52px, 10vw, 104px)/.86 var(--f-display); text-transform: uppercase; letter-spacing: -.005em }
.h2 { font: 800 clamp(36px, 5.6vw, 64px)/.92 var(--f-display); text-transform: uppercase }
.h3 { font: 800 26px/1.05 var(--f-display); text-transform: uppercase; letter-spacing: .01em }
.lede { font-size: 19px; color: var(--muted); max-width: 58ch }
.small { font-size: 13px; color: var(--muted) }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums }

/* Header */
header.site { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line) }
header.site .wrap { display: flex; align-items: center; gap: 20px; padding-block: 12px }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; flex: none }
.brand b { font: 900 26px/1 var(--f-display); text-transform: uppercase; letter-spacing: .02em }
.brand .knot { width: 30px; height: 30px; flex: none }
.crumb { display: none; font: 700 15px var(--f-body); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0 }
nav.main { display: flex; gap: 4px; margin-left: auto; align-items: center }
nav.main a { white-space: nowrap; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 8px }
@media (hover: hover) { nav.main a:hover { background: var(--sunk) } }
nav.main a[aria-current="page"] { background: var(--mat-soft); color: var(--link) }
.beltbar { height: 8px; background: var(--belt); position: relative; overflow: hidden }
.beltbar .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--tape) 14%, var(--belt)); transition: width .15s linear }
.beltbar .rank { position: absolute; top: 0; bottom: 0; right: 9%; width: 13%; background: var(--bar); display: flex; gap: 5px; justify-content: center; align-items: stretch; padding-inline: 4px }
.beltbar .rank i { width: 4px; background: var(--tape); transform: scaleY(0); transition: transform .3s cubic-bezier(.3,1.6,.5,1) }
.beltbar .rank i.on { transform: scaleY(1) }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .16s var(--ease-out), border-color .16s, background-color .16s }
@media (hover: hover) and (pointer: fine) { .btn:hover { border-color: var(--ink); transform: translateY(-1px) } }
.btn:active { transform: scale(.97) }
.btn:disabled { opacity: .6; cursor: progress; transform: none }
.btn.primary { background: var(--mat); border-color: var(--mat); color: var(--mat-ink) }
@media (hover: hover) { .btn.primary:hover { background: color-mix(in srgb, var(--mat) 86%, var(--ink)) } }
.btn.ink { background: var(--ink); border-color: var(--ink); color: var(--bg) }
.btn.sm { padding: 8px 14px; font-size: 14px }
.btn svg { width: 18px; height: 18px }

/* Search field */
.searchbox { display: flex; gap: 6px; padding: 6px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); max-width: 560px }
.searchbox:focus-within { border-color: var(--mat) }
.searchbox input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 6px 10px 16px; font-size: 17px; outline: none }
.chips { display: flex; flex-wrap: wrap; gap: 8px }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink); text-decoration: none; transition: transform .16s var(--ease-out), border-color .15s, background-color .15s }
@media (hover: hover) { .chip:hover { border-color: var(--ink) } }
.chip:active { transform: scale(.97) }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg) }
.chip small { font: 500 12px var(--f-mono); color: var(--muted); margin-left: 4px }
.chip[aria-pressed="true"] small { color: inherit; opacity: .7 }

.pill { display: inline-flex; align-items: center; gap: 5px; font: 600 12px/1 var(--f-body); padding: 5px 8px; border-radius: 5px; background: var(--sunk); color: var(--ink) }
.pill.ok { background: var(--ok-soft); color: var(--ok) }
.pill.mat { background: var(--mat-soft); color: var(--link) }

/* Scoreboard (always dark, like the real thing): home page */
.board { color: var(--board-ink); font-family: var(--f-mono) }
.board .top { display: flex; justify-content: space-between; align-items: center; font-size: 12px; letter-spacing: .14em; color: var(--board-dim); text-transform: uppercase; padding-bottom: 14px; border-bottom: 1px solid var(--board-line) }
.board .clock { color: #FFD34D }
.board .row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-areas: "flag who pts" "flag who sub"; column-gap: clamp(14px, 3vw, 32px); align-items: center; padding-block: clamp(18px, 3vw, 28px); border-bottom: 1px solid var(--board-line); color: inherit; text-decoration: none }
.board .row:last-of-type { border-bottom: 0; padding-bottom: 0 }
.board .flag { grid-area: flag; align-self: stretch; border-radius: 3px }
.board .who { grid-area: who; font: 800 clamp(34px, 5vw, 56px)/.9 var(--f-display); text-transform: uppercase; letter-spacing: .01em; color: var(--board-ink) }
.board .who small { display: block; font: 500 13px/1.4 var(--f-mono); letter-spacing: .02em; color: var(--board-dim); text-transform: none; margin-top: 8px }
.board .pts { grid-area: pts; font: 700 clamp(44px, 8vw, 96px)/1 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.03em; color: var(--board-ink); text-align: right }
.board .sub { grid-area: sub; display: flex; gap: 16px; justify-content: flex-end; font-size: 12px; color: var(--board-dim); margin-top: 8px; font-variant-numeric: tabular-nums }
.board .sub b { color: #FFD34D; font-weight: 600 }
@media (hover: hover) and (pointer: fine) { .board a.row:hover .who { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px } }
.board a.row:focus-visible { outline-color: #FFD34D }
@media (max-width: 560px) { .board .row { grid-template-columns: 8px minmax(0, 1fr); grid-template-areas: "flag who" "flag pts" "flag sub" } .board .pts, .board .sub { text-align: left; justify-content: flex-start } .board .pts { margin-top: 14px } }

/* Belt stripe tag used on cards */
.beltchip { display: inline-block; width: 46px; height: 10px; border-radius: 2px; background: var(--belt); position: relative; vertical-align: middle }
.beltchip::after { content: ""; position: absolute; right: 6px; top: 0; bottom: 0; width: 14px; background: var(--bar) }
.beltchip.white { background: #EDEDE8; box-shadow: inset 0 0 0 1px #c9c9c2 } .beltchip.blue { background: #2347B8 } .beltchip.purple { background: #6B3FA6 } .beltchip.brown { background: #7A4A27 }
.beltchip.white::after, .beltchip.blue::after, .beltchip.purple::after, .beltchip.brown::after { background: #111 }

/* Footer */
footer.site { padding-block: 48px; border-top: 1px solid var(--line); background: var(--surface) }
footer.site .wrap { display: grid; grid-template-columns: 1.4fr repeat(2, 1fr); gap: 32px }
footer.site h2 { margin: 0 0 10px; font: 600 12px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted) }
footer.site ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px }
footer.site a { color: var(--ink); text-decoration: none } footer.site a:hover { text-decoration: underline }

details.faq { border-top: 1px solid var(--line); padding-block: 18px }
details.faq:last-child { border-bottom: 1px solid var(--line) }
details.faq summary { cursor: pointer; font-weight: 700; font-size: 19px; list-style: none; display: flex; justify-content: space-between; gap: 16px }
details.faq summary::-webkit-details-marker { display: none }
details.faq summary::after { content: "+"; font: 500 24px/1 var(--f-mono); color: var(--muted); transition: transform .2s }
details.faq[open] summary::after { transform: rotate(45deg) }
details.faq p { margin-top: 10px; color: var(--muted); max-width: 68ch }


@media (max-width: 760px) {
  nav.main { display: none }
  body { padding-bottom: 68px }
  .crumb { display: inline }
  .brand b { font-size: 22px }
  footer.site .wrap { grid-template-columns: 1fr 1fr } footer.site .wrap > :first-child { grid-column: 1 / -1 }
}
@media (max-width: 420px) { nav.main .btn { display: none } }

/* Account link, added to the header by auth.js only when accounts are switched on */
header.site a.acct { flex: none; white-space: nowrap; font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; padding: 7px 14px; border: 1.5px solid var(--line); border-radius: 999px; margin-left: -12px }
header.site a.acct:hover { border-color: var(--ink) }
header.site a.acct[aria-current="page"] { border-color: var(--mat); color: var(--link) }
@media (max-width: 760px) { header.site a.acct { margin-left: auto } }
/* Small forms (account page, plan bar) */
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 600 }
.field input, .field select { height: 46px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg); padding: 0 12px; font-size: 16px; font-weight: 500; min-width: 0; width: 100% }
.field input:focus, .field select:focus { outline: 2px solid var(--mat); outline-offset: 1px }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto } *, *::before, *::after { transition-property: opacity, color, background-color, border-color, box-shadow !important; animation: none !important } .btn:active, .chip:active { transform: none } .reveal.pending { transform: none; opacity: 1 } }

/* Phone tab bar: the main way around the site on small screens */
.tabbar { display: none; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: max(4px, env(safe-area-inset-left, 0px)); padding-right: max(4px, env(safe-area-inset-right, 0px)) }
.tabbar a { display: grid; justify-items: center; gap: 3px; padding: 9px 0 8px; font: 600 11px/1 var(--f-body); color: var(--muted); text-decoration: none; position: relative }
.tabbar a svg { width: 22px; height: 22px }
.tabbar a[aria-current="page"] { color: var(--link) }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--bar) }
@media (max-width: 760px) { .tabbar { display: grid } }

/* UX pass: page titles, loading skeletons, touch sizes, toasts */
.h1 { font: 900 clamp(44px, 7vw, 76px)/.9 var(--f-display); text-transform: uppercase }
.skel { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--sunk), color-mix(in srgb, var(--sunk) 40%, var(--surface)), var(--sunk)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite }
@keyframes shimmer { to { background-position: -200% 0 } }
.btn.sm svg { width: 16px; height: 16px }
.chip { display: inline-flex; align-items: center; min-height: 38px }
@media (pointer: coarse) { .chip, .btn.sm { min-height: 44px } .seg button, .countries button { min-height: 44px } }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 15px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); transition: transform .15s var(--ease-out), opacity .15s var(--ease-out); pointer-events: none; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis }
.toast.show { transform: translate(-50%, 0); opacity: 1; transition-duration: .22s }
@media (max-width: 760px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)) } }
.brand .knot rect, .brand .knot path { stroke: var(--ink); stroke-opacity: .25 }

/* Form feedback written next to the button that sent it, so it stays until the next try */
.formmsg { font-size: 15px; font-weight: 600; color: var(--ok) } .formmsg.bad { color: var(--bar) } .formmsg:empty { display: none }
/* A small named dialog (naming a plan), used instead of the browser's prompt() */
dialog.ask { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgb(0 0 0 / .45) }
dialog.ask form { display: grid; gap: 16px } dialog.ask .row { display: flex; gap: 8px; justify-content: flex-end }
dialog::backdrop { background: rgb(5 7 12 / .6) }
/* Dialogs grow in from slightly smaller, centred, rather than appearing from nowhere */
dialog[open] { opacity: 1; transform: none; transition: opacity .2s var(--ease-out), transform .2s var(--ease-out) }
@starting-style { dialog[open] { opacity: 0; transform: scale(.97) } }
/* Moving between pages fades the content while the header and tab bar stay put. Browsers without
   cross-page view transitions just change page as before. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto }
  header.site { view-transition-name: site-header }
  .tabbar { view-transition-name: site-tabs }
  ::view-transition-old(root) { animation: vt-out .12s var(--ease-out) both }
  ::view-transition-new(root) { animation: vt-in .22s var(--ease-out) both }
}
@keyframes vt-out { to { opacity: 0 } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px) } }
