/* RallyWorks Sports — site styles. No external fonts, no frameworks. */

:root {
  --bg: #f6f6f3;
  --bg-2: #ecece8;
  --surface: #ffffff;
  --ink: #0d0e0c;
  --ink-2: #3f4245;
  --ink-3: #686b6f;
  --line: #dcdcd6;
  --accent: #ff5a1f;

  --dark: #0d0e0c;
  --on-dark: #f6f6f3;
  --on-dark-2: #a9aba6;
  --line-dark: #2a2c29;

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --container: 1240px;
  --gutter: clamp(20px, 4vw, 48px);
  --section-pad: clamp(80px, 11vw, 160px);
  --header-h: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--header-h);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, ol, ul, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.on-dark :focus-visible {
  outline-color: var(--on-dark);
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--on-dark);
  border-radius: 6px;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Wordmark ---------- */

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.wordmark-light {
  font-weight: 400;
  color: var(--ink-3);
}

.on-dark .wordmark-light {
  color: var(--on-dark-2);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
}

.nav-list {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 36px);
  font-size: 0.9375rem;
}

.nav-list a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.nav-list a:hover {
  color: var(--ink);
}

.nav-list .nav-cta {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-list .nav-cta:hover {
  background: var(--ink);
  color: var(--on-dark);
}

@media (max-width: 640px) {
  .nav-optional {
    display: none;
  }
}

/* ---------- Shared type ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: var(--accent);
}

.section-title {
  font-size: clamp(2rem, 1.25rem + 2.6vw, 3.25rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.032em;
  text-wrap: balance;
}

/* ---------- Buttons & links ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-dark);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--ease);
}

.button:hover {
  background: #2a2c29;
}

.button svg,
.contact-email svg {
  flex: none;
  transition: transform 0.25s var(--ease);
}

.button:hover svg {
  transform: translateY(2px);
}

.text-link {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}

.text-link:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(40px, 7vw, 104px) clamp(72px, 9vw, 128px);
}

.hero-grid {
  display: grid;
  gap: clamp(48px, 6vw, 72px);
}

@media (min-width: 960px) {
  .hero-grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: end;
  }
}

.hero-title .eyebrow {
  margin-bottom: clamp(24px, 3vw, 36px);
}

.hero-headline {
  display: block;
  font-size: clamp(2.6rem, 1.1rem + 5.4vw, 5.75rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.042em;
  text-wrap: balance;
}

.hero-lede {
  margin-top: clamp(24px, 3vw, 36px);
  max-width: 34em;
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-2);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
  margin-top: clamp(32px, 4vw, 48px);
}

/* Court visual */

.hero-visual {
  position: relative;
  aspect-ratio: 4 / 5;
  background: var(--bg-2);
  border-radius: 6px;
  overflow: hidden;
}

@media (max-width: 959px) {
  .hero-visual {
    aspect-ratio: 16 / 11;
    max-height: 420px;
  }
}

.court {
  position: absolute;
  inset: 9%;
  width: 82%;
  height: 82%;
}

.court-line {
  fill: none;
  stroke: var(--ink);
  stroke-opacity: 0.42;
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.court-net {
  stroke-opacity: 0.85;
  stroke-width: 1.6;
}

.court-post {
  fill: var(--ink);
  fill-opacity: 0.85;
}

.court-trajectory {
  fill: none;
  stroke: var(--ink);
  stroke-opacity: 0.2;
  stroke-width: 1;
  stroke-dasharray: 2 5;
  vector-effect: non-scaling-stroke;
}

.court-hit {
  fill: var(--bg-2);
  stroke: var(--ink);
  stroke-opacity: 0.35;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.ball {
  fill: var(--accent);
}

.ball-halo {
  fill: var(--accent);
  fill-opacity: 0.16;
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--section-pad);
}

.section--rule {
  padding-top: 0;
}

.section--rule > .container > :first-child {
  border-top: 1px solid var(--line);
  padding-top: var(--section-pad);
}

.section-head {
  margin-bottom: clamp(48px, 6vw, 88px);
}

.section-head .eyebrow {
  margin-bottom: 20px;
}

/* What we do */

.pillars {
  display: grid;
  gap: 48px;
  counter-reset: pillar;
}

@media (min-width: 820px) {
  .pillars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(28px, 3vw, 48px);
  }
}

.pillar {
  position: relative;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.pillar::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
}

.pillar-num {
  display: block;
  margin-bottom: clamp(28px, 4vw, 56px);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.pillar h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.4vw, 1.4375rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.018em;
}

.pillar p {
  margin-top: 14px;
  max-width: 36ch;
  color: var(--ink-2);
}

/* About */

.split {
  display: grid;
  gap: 32px 48px;
}

@media (min-width: 960px) {
  .split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

.split .eyebrow {
  margin-bottom: 20px;
}

.about-lead {
  max-width: 32em;
  font-size: clamp(1.25rem, 1rem + 0.85vw, 1.625rem);
  line-height: 1.45;
  letter-spacing: -0.012em;
}

.facts {
  display: grid;
  margin-top: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--line);
}

@media (min-width: 640px) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 40px;
  }
}

.facts > div {
  padding-block: 20px;
  border-bottom: 1px solid var(--line);
}

.facts dt {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.facts dd {
  font-size: 1rem;
}

.facts a {
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}

.facts a:hover {
  text-decoration-color: var(--ink);
}

/* Contact */

.on-dark {
  background: var(--dark);
  color: var(--on-dark);
}

.on-dark .eyebrow {
  color: var(--on-dark-2);
}

.contact .eyebrow {
  margin-bottom: 20px;
}

.contact {
  padding-block: clamp(96px, 13vw, 176px);
}

.contact-intro {
  margin-top: 20px;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  color: var(--on-dark-2);
}

.contact-email {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3em;
  margin-top: clamp(28px, 4vw, 48px);
  padding-bottom: 0.12em;
  font-size: clamp(1.3rem, 0.6rem + 5vw, 4.25rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  transition: color 0.25s var(--ease);
}

.contact-email svg {
  width: 0.62em;
  height: 0.62em;
}

.contact-email:hover {
  color: #ffffff;
}

.contact-email:hover svg {
  transform: translate(3px, -3px);
  color: var(--accent);
}

.contact-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 28px;
  min-height: 40px;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: transparent;
  color: var(--on-dark);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
}

.copy-button[hidden] {
  display: none;
}

.copy-button:hover {
  border-color: var(--on-dark-2);
}

.copy-status {
  font-size: 0.875rem;
  color: var(--on-dark-2);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 40px 48px;
  border-top: 1px solid var(--line-dark);
  font-size: 0.875rem;
  color: var(--on-dark-2);
}

.footer-inner {
  display: grid;
  gap: 28px;
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 40px;
  }
}

.footer-brand .wordmark {
  color: var(--on-dark);
}

.footer-brand p {
  margin-top: 10px;
}

.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.footer-nav a {
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.footer-nav a:hover {
  color: var(--on-dark);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- Legal pages ---------- */

.legal {
  padding-block: clamp(48px, 7vw, 104px) var(--section-pad);
}

.legal-inner {
  max-width: 760px;
}

.legal h1 {
  margin-top: 20px;
  font-size: clamp(2.25rem, 1.4rem + 3vw, 3.5rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.legal-meta {
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.prose {
  margin-top: clamp(40px, 5vw, 64px);
  padding-top: clamp(32px, 4vw, 48px);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}

.prose > p:first-child {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--ink);
}

.prose h2 {
  margin-top: 48px;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.prose p,
.prose ul {
  margin-top: 14px;
}

.prose ul {
  padding-left: 1.25em;
  list-style: disc;
}

.prose li + li {
  margin-top: 6px;
}

.prose li::marker {
  color: var(--ink-3);
}

.prose a {
  color: var(--ink);
  text-underline-offset: 4px;
}

/* 404 */

.not-found {
  padding-block: clamp(80px, 14vw, 200px);
}

.not-found p {
  margin-top: 20px;
  color: var(--ink-2);
}

.not-found .button {
  margin-top: 36px;
}

/* ---------- Motion (only when the user has not asked for reduced motion) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero-title .eyebrow,
  .hero-headline,
  .hero-lede,
  .hero-actions {
    animation: rise 0.9s var(--ease) both;
  }

  .hero-headline { animation-delay: 0.06s; }
  .hero-lede { animation-delay: 0.14s; }
  .hero-actions { animation-delay: 0.22s; }

  .hero-visual {
    animation: fade 1.1s var(--ease) 0.15s both;
  }

  .court-line {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: draw 1.4s var(--ease) 0.35s both;
  }

  .court-line:nth-of-type(2),
  .court-line:nth-of-type(3) { animation-delay: 0.5s; }
  .court-line:nth-of-type(4),
  .court-line:nth-of-type(5),
  .court-line:nth-of-type(6) { animation-delay: 0.65s; }
  .court-line:nth-of-type(n + 7) { animation-delay: 0.8s; }

  .court-trajectory,
  .court-hit,
  .court-post {
    animation: fade 1s var(--ease) 1.3s both;
  }

  .ball-group {
    animation: fade 0.6s var(--ease) 1.6s both;
  }

  .js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  }

  .js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }

  .js .pillar::before {
    transform: scaleX(0);
    transition: transform 1s var(--ease) 0.25s;
  }

  .js .pillar.is-visible::before {
    transform: scaleX(1);
  }

  .js .pillar:nth-child(2) { transition-delay: 0.08s; }
  .js .pillar:nth-child(3) { transition-delay: 0.16s; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* ---------- Print ---------- */

@media print {
  .site-header { position: static; }
  .hero-visual, .copy-button, .skip-link { display: none !important; }
  .on-dark { background: none; color: var(--ink); }
  .on-dark .eyebrow, .contact-intro, .site-footer { color: var(--ink-2); }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}
