/* =========================================================
   TennisSpace â€” design tokens
   Dark court / lime accent â€” "sport digitale"
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --ink: #f5f5f3;
  --ink-soft: #9a9a9a;
  --lime: #d7ff3f;
  --lime-deep: #b9e62a;
  --line: rgba(255, 255, 255, 0.12);
  --line-light: rgba(255, 255, 255, 0.22);

  /* legacy names kept so older markup still resolves to the new palette */
  --clay: #d7ff3f;
  --clay-deep: #b9e62a;
  --court: #d7ff3f;
  --court-deep: #0a0a0a;
  --chalk: #f5f5f3;
  --chalk-dim: #9a9a9a;
  --gold: #d7ff3f;

  --font-display: "Archivo Black", "Arial Black", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --radius: 6px;
  --max-width: 1200px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.02;
  margin: 0 0 0.5em;
  color: var(--ink);
}

h1 { font-size: clamp(2.6rem, 6vw, 4.8rem); }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
h3 { font-size: 1.25rem; }

p { max-width: 62ch; color: var(--ink-soft); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--lime);
  display: inline-block;
}

/* ---------- header / nav ---------- */

.site-header {
  background: var(--bg);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.brand {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand span { color: var(--lime); }
.brand:hover { text-decoration: none; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}
.site-nav a.active {
  color: var(--ink);
  border-bottom: 2px solid var(--lime);
  text-decoration: none;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.pill {
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-light); color: var(--ink); text-decoration: none; }

.btn-clay {
  background: var(--lime);
  border-color: var(--lime);
  color: #0a0a0a;
}
.btn-clay:hover { background: var(--lime-deep); border-color: var(--lime-deep); color: #0a0a0a; }

.btn-ghost {
  background: transparent;
  border-color: var(--line-light);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--line-light); }

.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- hero ---------- */

.hero {
  background: var(--bg);
  color: var(--ink);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero .container {
  position: relative;
  padding-top: 56px;
  padding-bottom: 56px;
}

.hero-score {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.hero-score .num {
  font-family: var(--font-display);
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  color: var(--lime);
  line-height: 0.9;
}

.hero-score .label {
  font-size: 1rem;
  color: var(--ink-soft);
  max-width: 30ch;
  font-family: var(--font-body);
}

.hero p.lede {
  color: var(--ink-soft);
  font-size: 1.15rem;
  max-width: 58ch;
}

.hero-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* hero split layout (home) */
.hero-split {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
}
.hero-media {
  position: relative;
  aspect-ratio: 4 / 3.2;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(160deg, #1a1a1a, #0a0a0a);
  border: 1px solid var(--line);
}
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-media--ring::after {
  content: "";
  position: absolute;
  border: 2px solid var(--lime);
  border-radius: 50%;
  width: 55%;
  height: 55%;
  top: 8%;
  right: -10%;
  opacity: 0.55;
  pointer-events: none;
}
@media (max-width: 860px) {
  .hero-split { grid-template-columns: 1fr; }
}

/* ---------- sections ---------- */

.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.section-head p { margin: 6px 0 0; color: var(--ink-soft); }

.court-rule {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0 0 28px;
}

/* ---------- cards / grid ---------- */

.grid {
  display: grid;
  gap: 20px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 760px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--ink);
}

.card h3 { margin-bottom: 6px; color: var(--ink); }
.card .meta { color: var(--ink-soft); font-size: 0.9rem; }
.card:hover { border-color: var(--line-light); }
a.card:hover { text-decoration: none; }

/* feature card w/ icon badge + arrow footer (home) */
.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.feature-card:hover {
  text-decoration: none;
  border-color: var(--lime);
  transform: translateY(-2px);
}
a.feature-card:hover .feature-arrow { color: var(--lime); }
.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--lime);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lime);
  flex-shrink: 0;
}
.feature-card h3 { margin-bottom: 2px; }
.feature-card p { margin: 0; font-size: 0.92rem; }
.feature-arrow {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  color: var(--ink-soft);
}

/* community photo strip */
.community-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.community-grid .ph {
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}
.community-grid .ph img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
  .community-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- ranking table ---------- */

.rank-table {
  width: 100%;
  border-collapse: collapse;
}

.rank-table th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-light);
  color: var(--ink-soft);
}

.rank-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}

.rank-table tr:hover td { background: rgba(215, 255, 63, 0.04); }

.rank-pos {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--ink-soft);
  width: 48px;
}

.rank-table tr:nth-child(1) .rank-pos { color: var(--lime); }
.rank-table tr:nth-child(2) .rank-pos,
.rank-table tr:nth-child(3) .rank-pos { color: var(--ink); }

.player-name { font-weight: 600; }

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-bar select, .filter-bar input {
  font-family: var(--font-body);
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

/* ---------- forms ---------- */

.form-card {
  max-width: 440px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--surface-2);
  color: var(--ink);
}
.field input:focus, .field select:focus, button:focus, a:focus {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

.form-msg { font-size: 0.9rem; margin-top: 10px; }
.form-msg.error { color: #ff6b6b; }
.form-msg.ok { color: var(--lime); }

/* ---------- gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  border: 1px solid var(--line);
}

.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

.gallery-item .cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: #fff;
  font-size: 0.82rem;
}

/* ---------- gironi ---------- */

.girone {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 16px;
}
.girone h4 {
  font-family: var(--font-display);
  font-weight: 400;
  padding: 12px 16px;
  margin: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
}
.girone ol { margin: 0; padding: 12px 16px 12px 34px; color: var(--ink); }
.girone li { padding: 4px 0; display: flex; justify-content: space-between; gap: 10px; }
.girone select { font-size: 0.85rem; padding: 3px 6px; }

/* ---------- bracket (fase a eliminazione diretta) ---------- */

.bracket {
  display: flex;
  align-items: stretch;
  gap: 36px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.bracket-round-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.bracket-round-body {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
}

.bracket-pair {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  position: relative;
  flex: 1;
  padding-right: 28px;
  margin: 14px 0;
}

.bracket-pair::after {
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  right: 0;
  width: 28px;
  border: 1px solid var(--line-light);
  border-left: none;
}

.bracket-pair-last::after { display: none; }

.bracket-match {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 200px;
  margin: 6px 0;
}

.bracket-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.bracket-row.bracket-winner {
  color: var(--lime);
  font-weight: 700;
}

/* ---------- footer ---------- */

.site-footer {
  background: var(--bg);
  color: var(--ink-soft);
  padding: 36px 0;
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
}
.site-footer a { color: var(--ink); }

/* ---------- utility ---------- */

.hidden { display: none !important; }
.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
.tag {
  display: inline-block;
  font-size: 0.78rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  margin-right: 6px;
  border: 1px solid var(--line);
}
.tag.clay { background: rgba(215,255,63,0.1); color: var(--lime); border-color: rgba(215,255,63,0.3); }
.tag.court { background: var(--surface-2); color: var(--ink); }