/* =====================================================================
   Luiz Schneiger Beach Tennis — sistema de design (fonte única de tokens)

   Layout: quadra de areia. Superfície calma e alinhada à esquerda; o único
   momento forte é a "faixa-quadra" (areia + fita branca de demarcação + linha
   da rede) que abre as páginas com o nome e o agendamento. Laranja da bola só
   para a ação principal. Cartão só para o que é objeto (produto, horário).
   ===================================================================== */

:root {
  /* ---- cor (tema claro: tarde de sol) ---- */
  --bg: #f4f7fa;            /* papel com leve viés azul do céu */
  --surface: #ffffff;
  --surface-2: #eaf0f6;     /* preenchimento discreto: campos, faixas */
  --ink: #0f1c2e;           /* azul-marinho quase preto */
  --muted: #536175;
  --line: #d6dfe9;
  --brand: #2867c9;         /* azul da marca, com contraste AA sobre branco */
  --brand-ink: #ffffff;
  --brand-soft: #e3ecfa;
  --ball: #f28a1f;          /* laranja da bola de beach tennis */
  --ball-ink: #1b1206;
  --court: #e7d7b4;         /* areia da quadra */
  --court-ink: #23190a;
  --tape: #ffffff;          /* fita de demarcação */
  --net: rgba(15, 28, 46, .22);
  --grain: rgba(80, 55, 15, .07);

  /* estados de vaga (semânticos, separados do acento) */
  --ok: #17603f;      --ok-bg: #dcf1e5;
  --warn: #7a4a00;    --warn-bg: #fdecc8;
  --last: #9b1c1c;    --last-bg: #fde0de;
  --full: #4d5868;    --full-bg: #e4e9ef;
  --danger: #b42318;

  --shadow-1: 0 1px 2px rgba(15, 28, 46, .06), 0 4px 14px rgba(15, 28, 46, .06);
  --shadow-2: 0 10px 40px rgba(15, 28, 46, .18);
  --scrim: rgba(9, 16, 27, .55);
  /* qual variante do logo aparece (a mão preta some no fundo escuro) */
  --logo-claro: block;
  --logo-escuro: none;

  /* ---- tipografia ---- */
  --font-display: "Big Shoulders Display", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: .875rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.55rem;
  --step-3: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  --step-4: clamp(2.6rem, 1.6rem + 4.6vw, 4.6rem);

  /* ---- forma e espaço ---- */
  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 18px;
  --space-1: .5rem;
  --space-2: .75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3.5rem;
  --space-7: 5rem;
  --wrap: 1120px;
  --header-h: 64px;
  --tabbar-h: 62px;

  --z-raised: 10;
  --z-header: 100;
  --z-tabbar: 110;
  --z-modal: 1000;
  --z-toast: 1100;

  /* ---- aliases do CSS antigo (rede de segurança durante a migração) ---- */
  --first-color: var(--brand);
  --first-color-alt: var(--brand);
  --first-color-second: var(--brand);
  --first-color-lighter: var(--line);
  --title-color: var(--ink);
  --text-color: var(--muted);
  --text-color-light: var(--muted);
  --input-color: var(--surface-2);
  --body-color: var(--bg);
  --container-color: var(--surface);
  --container-color-alt: var(--surface-2);
  --body-font: var(--font-body);
  --header-height: var(--header-h);
  --z-fixed: var(--z-header);
  --z-tooltip: var(--z-raised);
  --h1-font-size: var(--step-3);
  --h2-font-size: var(--step-2);
  --h3-font-size: var(--step-1);
  --normal-font-size: var(--step-0);
  --small-font-size: var(--step--1);
  --smaller-font-size: .8rem;
  --font-medium: 500;
  --font-semi-bold: 600;
}

/* tema escuro (sessão noturna sob as luzes da arena): sistema sem escolha */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1420;
    --surface: #121e2f;
    --surface-2: #19283c;
    --ink: #e8eef6;
    --muted: #9db0c6;
    --line: #26384f;
    --brand: #74abff;
    --brand-ink: #071425;
    --brand-soft: #172a45;
    --ball: #ff9a3d;
    --ball-ink: #1b1206;
    --court: #152741;
    --court-ink: #e8eef6;
    --tape: rgba(255, 255, 255, .5);
    --net: rgba(232, 238, 246, .2);
    --grain: rgba(255, 255, 255, .035);
    --ok: #7fdcaa;    --ok-bg: #123526;
    --warn: #ffcf7a;  --warn-bg: #3a2a0c;
    --last: #ffaaa3;  --last-bg: #431a18;
    --full: #b2bfcf;  --full-bg: #223247;
    --danger: #ff8a80;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-2: 0 10px 40px rgba(0, 0, 0, .55);
    --scrim: rgba(3, 7, 13, .7);
    --logo-claro: none;
    --logo-escuro: block;
    color-scheme: dark;
  }
}
/* mesma paleta escura, para a escolha explícita vencer nos dois sentidos */
:root[data-theme="dark"] {
  --bg: #0b1420;
  --surface: #121e2f;
  --surface-2: #19283c;
  --ink: #e8eef6;
  --muted: #9db0c6;
  --line: #26384f;
  --brand: #74abff;
  --brand-ink: #071425;
  --brand-soft: #172a45;
  --ball: #ff9a3d;
  --ball-ink: #1b1206;
  --court: #152741;
  --court-ink: #e8eef6;
  --tape: rgba(255, 255, 255, .5);
  --net: rgba(232, 238, 246, .2);
  --grain: rgba(255, 255, 255, .035);
  --ok: #7fdcaa;    --ok-bg: #123526;
  --warn: #ffcf7a;  --warn-bg: #3a2a0c;
  --last: #ffaaa3;  --last-bg: #431a18;
  --full: #b2bfcf;  --full-bg: #223247;
  --danger: #ff8a80;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  --shadow-2: 0 10px 40px rgba(0, 0, 0, .55);
  --scrim: rgba(3, 7, 13, .7);
  --logo-claro: none;
  --logo-escuro: block;
  color-scheme: dark;
}

/* ============================== fontes (hospedadas aqui) ============================== */
/* fontes variaveis: um arquivo latino por familia cobre todos os pesos e todos
   os acentos do portugues (U+0000-00FF) */
@font-face {
  font-family: "Big Shoulders Display";
  font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../vendor/fonts/big-shoulders-display-latin.woff2) format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal; font-weight: 300 900; font-display: swap;
  src: url(../vendor/fonts/figtree-latin.woff2) format("woff2");
}

/* ============================== base ============================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
/* :where() zera a especificidade: uma classe simples da pagina vence o reset */
:where(ul[class], ol[class]) { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.1; text-wrap: balance; }
h1, h2, .display {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .005em;
}
h1 { font-size: var(--step-4); line-height: .95; }
h2 { font-size: var(--step-3); }
h3 { font-family: var(--font-body); font-size: var(--step-1); font-weight: 700; line-height: 1.25; }
p { margin: 0; }
.prose { max-width: 65ch; }
.prose > * + * { margin-top: .9em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* rótulo curto acima de títulos */
.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand);
}

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand); color: var(--brand-ink); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: max(16px, env(safe-area-inset-left, 0px)); top: -100px;
  z-index: var(--z-toast); padding: .6rem 1rem; border-radius: var(--radius-s);
  background: var(--ink); color: var(--bg); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: calc(env(safe-area-inset-top, 0px) + 8px); }

/* ============================== layout ============================== */
.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * max(16px, env(safe-area-inset-left, 0px)));
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.section { padding-block: var(--space-6); }
.section--tight { padding-block: var(--space-5); }
.section--band { background: var(--surface-2); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.grid-auto { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid-2 { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: center; } }
.grid-2 > *, .grid-auto > * { min-width: 0; }

/* cabeçalho de seção: rótulo + título + linha de apoio */
.section-head { display: grid; gap: .35rem; margin-bottom: var(--space-5); max-width: 60ch; }
.section-head p { color: var(--muted); }

/* ============================== faixa-quadra ============================== */
/* areia com granulação, fita branca de demarcação e a linha da rede ao centro */
.court {
  position: relative;
  isolation: isolate;
  background-color: var(--court);
  background-image: radial-gradient(var(--grain) 1px, transparent 1.2px);
  background-size: 5px 5px;
  color: var(--court-ink);
  overflow: hidden;
}
.court::before {               /* linhas laterais e de fundo */
  content: "";
  position: absolute;
  inset: 14px max(14px, env(safe-area-inset-right, 0px)) 14px max(14px, env(safe-area-inset-left, 0px));
  border: 3px solid var(--tape);
  border-radius: 2px;
  pointer-events: none;
  z-index: -1;
}
.court::after {                /* a rede: malha vertical no meio da quadra */
  content: "";
  position: absolute;
  top: 14px; bottom: 14px; left: 50%;
  width: 6px; transform: translateX(-50%);
  background: repeating-linear-gradient(to bottom, var(--net) 0 3px, transparent 3px 7px);
  pointer-events: none;
  z-index: -1;
}
@media (max-width: 859px) { .court::after { display: none; } }
.court h1, .court h2 { color: var(--court-ink); }
/* azul da marca sobre a areia fica em 3,8:1 (reprova AA em texto pequeno) */
.court .eyebrow { color: var(--court-ink); }
/* a fita fica a 14px da borda: o conteudo precisa de folga para nao encostar nela */
.court > .wrap {
  padding-left: max(36px, calc(env(safe-area-inset-left, 0px) + 28px));
  padding-right: max(36px, calc(env(safe-area-inset-right, 0px) + 28px));
}

/* ============================== botões ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 46px; padding: .6rem 1.15rem;
  border: 2px solid transparent; border-radius: 10px;
  font-weight: 700; font-size: var(--step-0); line-height: 1.1; text-decoration: none;
  cursor: pointer; transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn--ball { background: var(--ball); color: var(--ball-ink); }
.btn--ball:hover { background: color-mix(in srgb, var(--ball) 88%, var(--ink)); }
.btn--brand { background: var(--brand); color: var(--brand-ink); }
.btn--brand:hover { background: color-mix(in srgb, var(--brand) 88%, var(--ink)); }
.btn--quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--quiet:hover { border-color: var(--ink); }
.btn--wide { width: 100%; }
.btn i { font-size: 1.05em; }

/* botão só de ícone (tema, carrinho, fechar) */
.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }
a.icon-btn { text-decoration: none; }
/* sobre a areia a borda --line some: borda e texto derivam da tinta da quadra */
.court .btn--quiet { color: var(--court-ink); border-color: color-mix(in srgb, var(--court-ink) 32%, transparent); }
.court .btn--quiet:hover { border-color: var(--court-ink); }

/* ============================== chips de estado ============================== */
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .6rem; border-radius: 999px;
  font-size: .8rem; font-weight: 700; line-height: 1.4; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.chip--ok { background: var(--ok-bg); color: var(--ok); }
.chip--warn { background: var(--warn-bg); color: var(--warn); }
.chip--last { background: var(--last-bg); color: var(--last); }
.chip--full { background: var(--full-bg); color: var(--full); }
.chip--brand { background: var(--brand-soft); color: var(--brand); }
/* ponto de cor da categoria (a cor vem do dado, via style="--cat: ...");
   o anel interno mantem cores claras (#FFC107) visiveis sobre fundo claro */
.dot {
  width: .7rem; height: .7rem; border-radius: 50%; flex: none;
  background: var(--cat, var(--brand));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 18%, transparent);
}

/* ============================== cartão (só para objetos) ============================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
}

/* ============================== formulários ============================== */
.field { display: grid; gap: .35rem; }
.field > label, .label { font-size: var(--step--1); font-weight: 700; color: var(--ink); }
.field .hint { font-size: .82rem; color: var(--muted); }
.input, .field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea {
  width: 100%; min-height: 46px; padding: .6rem .8rem;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 96px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}
[aria-invalid="true"] { border-color: var(--danger) !important; }
.input:disabled, .field input:disabled, .field select:disabled, .field textarea:disabled {
  background: var(--surface-2); color: var(--muted); cursor: not-allowed;
}
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; font-size: var(--step--1); font-weight: 700; color: var(--ink); }
.check { display: flex; align-items: center; gap: .55rem; min-height: 40px; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--brand); }

/* ============================== cabeçalho ============================== */
body::before {               /* faixa da área segura no topo, na cor do cabeçalho */
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: calc(var(--z-header) + 1); background: var(--surface);
}
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: var(--z-header);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__bar { display: flex; align-items: center; gap: var(--space-3); min-height: var(--header-h); }
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--ink); text-decoration: none; margin-right: auto;
}
.brand img { width: 28px; height: auto; }
.logo--claro { display: var(--logo-claro); }
.logo--escuro { display: var(--logo-escuro); }
.brand__name { display: grid; line-height: 1; }
.brand__name strong { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; letter-spacing: .01em; }
.brand__name small { font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.site-header__actions { display: flex; align-items: center; gap: .25rem; }

/* navegação principal: topo no desktop, barra de abas na base no celular */
.site-nav__list { display: flex; gap: .25rem; }
.site-nav__link {
  position: relative;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem .75rem; border-radius: 8px;
  color: var(--muted); font-weight: 600; text-decoration: none;
}
.site-nav__link:hover { color: var(--ink); background: var(--surface-2); }
.site-nav__link[aria-current="page"] { color: var(--ink); }
.site-nav__link[aria-current="page"]::after {   /* fita da quadra sob o item ativo */
  content: ""; position: absolute; left: .75rem; right: .75rem; bottom: .1rem;
  height: 3px; border-radius: 2px; background: var(--brand);
}
.site-nav__link i { font-size: .95rem; }

@media (min-width: 860px) {
  .site-nav__link i { display: none; }
}

@media (max-width: 859px) {
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  /* backdrop-filter faz do cabecalho o "bloco de contencao" dos filhos fixos:
     a barra de abas (dentro dele) iria para o topo em vez da base da tela */
  .site-header { backdrop-filter: none; background: var(--surface); }
  .site-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .site-nav__list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; }
  .site-nav__link {
    flex-direction: column; justify-content: center; gap: .2rem;
    min-height: var(--tabbar-h); padding: .35rem .15rem; border-radius: 0;
    font-size: .75rem; font-weight: 600; text-align: center; line-height: 1.1;  /* 12px: minimo legivel */
  }
  .site-nav__link i { font-size: 1.15rem; }
  .site-nav__link:hover { background: transparent; }
  .site-nav__link[aria-current="page"] { color: var(--brand); }
  .site-nav__link[aria-current="page"]::after { left: 30%; right: 30%; top: 0; bottom: auto; }
  .brand__name small { display: none; }
}

/* contador do carrinho no botão do cabeçalho */
.cart-count {
  position: absolute; top: 4px; right: 2px;
  min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--ball); color: var(--ball-ink);
  font-size: .7rem; font-weight: 800; line-height: 1;
}

/* ============================== rodapé ============================== */
.site-footer { margin-top: var(--space-6); background: var(--surface); border-top: 1px solid var(--line); }
.site-footer__grid {
  display: grid; gap: var(--space-5);
  grid-template-columns: 1fr;
  padding-block: var(--space-5);
}
@media (min-width: 760px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer h2 { font-size: var(--step-1); font-family: var(--font-body); font-weight: 700; margin-bottom: .6rem; }
.site-footer__links { display: grid; gap: .35rem; }
.site-footer__links a { color: var(--muted); text-decoration: none; }
.site-footer__links a:hover { color: var(--ink); text-decoration: underline; }
.site-footer__social { display: flex; gap: .25rem; margin-top: .6rem; }
.site-footer__about { margin-top: .75rem; max-width: 36ch; }
.site-footer__legal {
  border-top: 1px solid var(--line); padding-block: var(--space-3);
  font-size: .82rem; color: var(--muted);
}
/* © à esquerda, engrenagem do painel discreta no canto direito */
.site-footer__legal-linha { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.footer-admin { color: var(--muted); text-decoration: none; }
.footer-admin:hover, .footer-admin:focus-visible { color: var(--ink); }

/* ============================== diálogo / gaveta / toast ============================== */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-modal); }
.dialog-box {
  background: var(--surface); color: var(--ink);
  border-radius: var(--radius-l); box-shadow: var(--shadow-2);
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-toast);
  width: max-content; max-width: calc(100vw - 32px);   /* com left:50% a largura travaria em 50vw */
  padding: .7rem 1.1rem; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: var(--shadow-2);
}
@media (max-width: 859px) {
  .toast { bottom: calc(var(--tabbar-h) + var(--space-3) + env(safe-area-inset-bottom, 0px)); }
}

/* voltar ao topo */
.scrollup {
  position: fixed; z-index: var(--z-raised);
  right: max(16px, calc(env(safe-area-inset-right, 0px) + 12px));
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  text-decoration: none; opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s;
}
.scrollup.show-scroll { opacity: 1; visibility: visible; transition: opacity .2s ease, visibility 0s; }
@media (max-width: 859px) {
  .scrollup { bottom: calc(var(--tabbar-h) + var(--space-3) + env(safe-area-inset-bottom, 0px)); }
}

/* ============================== movimento ============================== */
/* 0s (e nao .01ms): uma duracao minima ainda transforma "visibility" em
   transicao real, e o focus() logo apos abrir um dialogo falha em silencio */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 0s !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
}
