/* The Bracket Doctor — shared stylesheet.
   The site is one painted pickleball court seen from above: court green
   surface, white line paint as every rule, the off-white apron outside the
   lines for dense tasks. Tokens first, then base, then components. */

/* ---------- Fonts (self-hosted, latin) ---------- */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/Barlow-400.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/Barlow-500.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/Barlow-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/Barlow-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/BarlowCondensed-600.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/BarlowCondensed-700.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/BarlowCondensed-800.woff2') format('woff2'); }

/* ---------- Tokens ---------- */
:root {
  --court: #1E7A46;        /* playing surface */
  --court-deep: #155C34;   /* pressed / hover on green */
  --kitchen: #2E9A5A;      /* non-volley zone: a lighter painted band, lettered in ink (4.7:1) */
  --line: #FFFFFF;         /* line paint on green */
  --apron: #F4F2EA;        /* out of bounds */
  --surface: #FFFFFF;
  --ink: #17201B;
  --muted: #5C665F;
  --rule: #DCD9CE;         /* hairline on the apron */
  --green-soft: #DDF0E3;
  --green-ink: #155C34;
  --amber: #B8690F;        /* matches in play, nothing else */
  --amber-ink: #8A4E0B;
  --amber-soft: #FBEAD2;
  --ball: #D9F24F;         /* live dot + focus ring only */
  --red: #B42318;
  --red-soft: #FBEAEA;

  --line-w: clamp(3px, 0.28vw, 5px);
  --net-w: clamp(10px, 0.9vw, 14px);
  --radius: 6px;
  --radius-sm: 4px;

  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-text: 'Barlow', system-ui, sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 220ms;

  --gutter: clamp(16px, 4vw, 48px);
  --box-pad: clamp(20px, 3vw, 44px);
  --max: 1280px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--apron);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--court);
  scrollbar-color: var(--court) var(--apron);
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); line-height: 0.95; letter-spacing: -0.005em; text-transform: uppercase; }
p { margin: 0; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--ball); color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.on-green :focus-visible, .court :focus-visible, .head :focus-visible { outline-color: var(--ball); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Apron strip (header) ---------- */
.strip {
  background: var(--apron);
  padding: 12px var(--gutter);
}
.strip__in {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.strip__logo img { height: 56px; width: auto; }
.strip__nav { margin-left: auto; display: flex; align-items: center; gap: clamp(12px, 2vw, 28px); }
.strip__nav a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 2px;
  border-bottom: 3px solid transparent;
  transition: border-color var(--dur) var(--ease-out);
}
.strip__nav a:hover, .strip__nav a[aria-current="page"] { border-bottom-color: var(--court); }
.strip__nav a.btn { color: #fff; border-bottom: var(--line-w) solid var(--court); padding: 0 14px; }
.strip__nav a.btn:hover { color: #fff; border-bottom-color: var(--court-deep); }
@media (max-width: 640px) {
  .strip__logo img { height: 44px; }
  .strip__nav a { font-size: 16px; }
  .strip__nav .hide-sm { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--radius);
  border: var(--line-w) solid var(--court);
  background: var(--court);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.btn:hover { background: var(--court-deep); border-color: var(--court-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--rule); border-color: var(--rule); color: var(--muted); cursor: not-allowed; }
.btn--paint, .court a.btn--paint { background: #fff; color: var(--court-deep); border-color: #fff; }
.btn--paint:hover { background: var(--apron); border-color: var(--apron); color: var(--court-deep); }
.btn--ghost, .court a.btn--ghost { background: transparent; color: #fff; border-color: #fff; }
.btn--ghost:hover, .court a.btn--ghost:hover { background: #fff; color: var(--court-deep); }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 17px; }
.btn--block { display: flex; width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* ---------- Tags (line-marked labels) ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--green-soft);
  color: var(--green-ink);
}
.tag--amber { background: var(--amber-soft); color: var(--amber-ink); }
.tag--gray { background: #ECEAE2; color: var(--muted); }
.tag--red { background: var(--red-soft); color: var(--red); }
.tag--paint { background: #fff; color: var(--court-deep); }
.tag--outline { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,0.85); }

/* ---------- Live dot ---------- */
.live {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase;
}
.live::before {
  content: ''; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ball); border: 2px solid var(--ink);
}
.live--on-green::before { border-color: var(--ink); }

/* ---------- The court ---------- */
.court {
  position: relative;
  background: var(--court);
  color: #fff;
  margin: 0 auto;
  max-width: calc(var(--max) + 2 * var(--line-w));
  border-left: var(--line-w) solid var(--line);
  border-right: var(--line-w) solid var(--line);
  border-top: var(--line-w) solid var(--line);
}
.court--closed { border-bottom: var(--line-w) solid var(--line); }
.court a { color: #fff; }
.court__half {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.court__half::after {
  /* centre service line */
  content: '';
  position: absolute; top: 0; bottom: 0; left: calc(50% - var(--line-w) / 2);
  width: var(--line-w);
  background: var(--line);
  transform-origin: top;
}
.court__half--single { grid-template-columns: 1fr; }
.court__half--single::after { display: none; }
.court__box { position: relative; padding: var(--box-pad); min-width: 0; }
.court__kitchen {
  position: relative;
  background: var(--kitchen);
  padding: clamp(18px, 2.4vw, 30px) var(--box-pad);
}
/* The kitchen is lettered in ink like a painted sign; only the court numerals and the
   numerals stay in white line paint. */
.court__kitchen { color: var(--ink); }
.court__kitchen .step__n { color: #fff; }
.court__kitchen .lede { font-size: clamp(1.15rem, 1.6vw, 1.35rem); font-weight: 600; line-height: 1.4; }
.court__kitchen p { font-weight: 600; }
.court__kitchen .live::before { border-color: var(--ink); }
.court__kitchen::before {
  /* kitchen line */
  content: '';
  position: absolute; left: 0; right: 0; top: calc(-1 * var(--line-w));
  height: var(--line-w);
  background: var(--line);
  transform-origin: left;
}
.court__kitchen--near::before { top: 0; }
.court__kitchen--far::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--line-w);
  background: var(--line);
  transform-origin: right;
}
.court__net {
  position: relative;
  height: var(--net-w);
  background-color: var(--ink);
  /* Net mesh: an authored 8px diamond tile. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath d='M0 4L4 0L8 4L4 8Z' fill='none' stroke='rgba(255,255,255,0.28)' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 8px 8px;
  transform-origin: center;
}
.court__net::after {
  /* centre strap */
  content: '';
  position: absolute; top: -2px; bottom: -2px; left: calc(50% - 10px); width: 20px;
  background: var(--line);
}
.court__baseline { height: var(--line-w); background: var(--line); }
@media (max-width: 760px) {
  .court { margin: 0 10px; }
  .court__half { grid-template-columns: 1fr; }
  .court__half::after { display: none; }
  .court__box + .court__box { border-top: var(--line-w) solid var(--line); }
}

/* Line boxes inside the court */
.lbox {
  border: var(--line-w) solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}

/* Paint-on choreography: lines draw once on load. */
.paint .court__half::after { animation: paint-y 700ms var(--ease-out) 150ms both; }
.paint .court__kitchen::before { animation: paint-x 700ms var(--ease-out) 350ms both; }
.paint .court__kitchen--far::after { animation: paint-x 700ms var(--ease-out) 450ms both; }
.paint .court__net { animation: paint-net 600ms var(--ease-out) 550ms both; }
.paint .court { animation: paint-frame 900ms var(--ease-out) both; }
@keyframes paint-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes paint-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes paint-net { from { transform: scaleX(0.02); } to { transform: scaleX(1); } }
@keyframes paint-frame { from { border-color: var(--court); } to { border-color: var(--line); } }
@media (prefers-reduced-motion: reduce) {
  .paint .court__half::after, .paint .court__kitchen::before, .paint .court__kitchen--far::after, .paint .court__net, .paint .court { animation: none; }
}

/* ---------- Display type on the court ---------- */
.display-xl { font-size: clamp(2.6rem, 6.4vw, 6rem); font-weight: 800; line-height: 0.9; text-wrap: balance; }
.display-l { font-size: clamp(2rem, 4.2vw, 3.6rem); font-weight: 800; line-height: 0.92; text-wrap: balance; }
.display-m { font-size: clamp(1.5rem, 2.6vw, 2.2rem); font-weight: 700; line-height: 0.95; }
.display-s { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.02em; }
.lede { font-size: clamp(1.05rem, 1.5vw, 1.3rem); font-weight: 500; max-width: 34ch; line-height: 1.4; }
.label {
  font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase;
}
.label--muted { color: var(--muted); }

/* ---------- Apron sections ---------- */
.apron { padding: clamp(32px, 5vw, 64px) var(--gutter); }
.apron__in { max-width: var(--max); margin: 0 auto; }
.rule-top { border-top: var(--line-w) solid var(--ink); padding-top: 14px; }

/* ---------- Cards on the apron ---------- */
.card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card--quiet { border-color: var(--rule); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 15px; }
.field .hint { font-size: 14px; color: var(--muted); }
.input, .field input, .field textarea, .field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 17px;
  transition: box-shadow var(--dur) var(--ease-out);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .input:focus { outline: 3px solid var(--court); outline-offset: 2px; }
.on-green .field input:focus, .on-green .field textarea:focus { outline-color: var(--ball); }
.field input::placeholder, .field textarea::placeholder { color: #6E776F; }
.on-green .field label { color: #fff; }
.on-green .field .hint { color: rgba(255,255,255,0.85); }
.on-green .field input, .on-green .field textarea { border-color: #fff; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.required { color: var(--court); }
.on-green .required { color: var(--ball); }

/* ---------- Notices ---------- */
.notice {
  border: 2px solid var(--ink); border-radius: var(--radius); background: #fff;
  padding: 22px 24px;
}
.notice h2, .notice h3 { margin-bottom: 8px; }
.notice--error { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.notice--ok { border-color: var(--court); background: var(--green-soft); color: var(--green-ink); }

/* ---------- Footer ---------- */
.foot {
  background: var(--apron);
  padding: 28px var(--gutter) 40px;
  color: var(--muted);
  font-size: 15px;
}
.foot__in {
  max-width: var(--max); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: center;
}
.foot a { color: var(--ink); font-weight: 600; }
.foot__spacer { flex: 1; }
@media (max-width: 640px) { .foot__spacer { display: none; } }

/* ---------- Events board (home + cash games) ---------- */
.board { display: flex; flex-direction: column; gap: 12px; }
.ev {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px 16px;
  align-items: start;
  padding: 14px 16px;
  border: var(--line-w) solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: #fff;
  transition: background var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.court .ev { color: #fff; }
.court .ev:hover { background: var(--court-deep); color: #fff; transform: translateY(-2px); }
.ev__date { text-align: center; font-family: var(--font-display); line-height: 1; }
.ev__date b { display: block; font-size: 38px; font-weight: 800; }
.ev__date span { display: block; font-size: 14px; font-weight: 700; letter-spacing: 0.08em; margin-top: 2px; }
.ev__name { font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1; text-transform: uppercase; }
.ev__meta { font-size: 15px; font-weight: 500; margin-top: 4px; }
.ev > div { min-width: 0; }
.ev__divs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ev__divs .tag { white-space: normal; height: auto; min-height: 26px; padding: 3px 9px; line-height: 1.25; text-align: left; }
.ev__cta { align-self: center; }
.ev.ev--apron { border-color: var(--ink); color: var(--ink); background: #fff; }
.ev.ev--apron:hover { background: var(--green-soft); color: var(--ink); transform: translateY(-2px); }
.ev--apron .tag--outline { color: var(--green-ink); border-color: var(--green-ink); }
@media (max-width: 480px) {
  .ev { grid-template-columns: 56px 1fr; }
  .ev__cta { grid-column: 1 / -1; }
  .ev__date b { font-size: 32px; }
  .ev__name { font-size: 21px; }
}
.board__empty { padding: 18px; border: var(--line-w) dashed rgba(255,255,255,0.7); border-radius: var(--radius-sm); font-weight: 500; }
.board__empty b { display: block; font-family: var(--font-display); font-size: 22px; text-transform: uppercase; }
.on-apron .board__empty { border-color: var(--rule); color: var(--muted); }
.on-apron .board__empty b { color: var(--ink); }

/* ---------- Steps (how it works) ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 28px; }
.step { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.step__n {
  font-family: var(--font-display); font-weight: 800; font-size: 44px; line-height: 0.85;
}
.step b { display: block; font-family: var(--font-display); font-size: 21px; text-transform: uppercase; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.step p { font-size: 17px; font-weight: 600; line-height: 1.45; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 14px; } }

/* ---------- Sticky green head (live pages) ---------- */
.head {
  background: var(--court);
  color: #fff;
  border-bottom: var(--line-w) solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.head__in { max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter) 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 34px; padding: 0 12px;
  border: 2px solid rgba(255,255,255,0.85); border-radius: var(--radius-sm);
  background: transparent; color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: 0.03em; text-transform: uppercase;
  cursor: pointer;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.chip[aria-pressed="true"], .chip.active { background: #fff; color: var(--court-deep); border-color: #fff; }
.tabs { display: flex; gap: 0; }
.tab {
  flex: 1; min-height: 44px;
  background: none; border: 0; border-bottom: var(--line-w) solid transparent;
  color: rgba(255,255,255,0.8);
  font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.tab[aria-selected="true"], .tab.active { color: #fff; border-bottom-color: var(--ball); }
