/* Delo Sports — palette taken from a US hard court: blue court, green surround,
   white lines, optic-yellow ball. Delo Motion uses grip-tape graphite. */
:root {
  --court: #1f4f82;
  --court-deep: #173c64;
  --surround: #2f6b4e;
  --ball: #d9ee3a;
  --line: #ffffff;
  --paper: #f2f4f6;
  --ink: #14202e;
  --muted: #56616f;
  --grip: #26282c;
  --grip-soft: #34373c;
  --rule: #cfd5dc;
  --danger: #b3261e;

  --font: "Archivo", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.88em; word-break: break-all; }
:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ball); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }

h1, h2, h3 { margin: 0; line-height: 1.05; font-weight: 800; }
h2 { font-size: clamp(2rem, 4.2vw, 3.25rem); font-variation-settings: "wdth" 118; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; font-variation-settings: "wdth" 108; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  border: 2px solid transparent; border-radius: 999px;
  font-weight: 700; font-variation-settings: "wdth" 110; text-decoration: none;
  transition: background-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-ball { background: var(--ball); color: var(--ink); }
.btn-ball:hover { background: #e6f76a; }
.btn-ghost { border-color: var(--line); color: var(--line); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-line { border-color: currentColor; }
.btn-line:hover { background: var(--ball); border-color: var(--ball); color: var(--ink); }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; font-size: 1.6rem; line-height: 1;
}
.icon-btn:hover { background: rgba(20,32,46,.08); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 12px var(--gutter);
  background: var(--court-deep); color: var(--line);
}
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-size: 1.2rem; font-variation-settings: "wdth" 125; }
.wordmark svg { width: 28px; height: 28px; fill: var(--ball); stroke: var(--court-deep); stroke-width: 1.6; }
.wordmark svg path { fill: none; }
.site-header nav { display: flex; gap: 22px; margin-left: auto; }
.site-header nav a { text-decoration: none; font-weight: 600; opacity: .85; }
.site-header nav a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.header-actions { display: flex; gap: 10px; }
.wallet-btn, .cart-btn {
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,.5); background: transparent; color: var(--line); font-weight: 700;
}
.wallet-btn:hover, .cart-btn:hover { border-color: var(--line); }
.wallet-btn.connected { border-color: var(--ball); }
.cart-btn { display: flex; align-items: center; gap: 8px; }
.cart-count {
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
  background: var(--ball); color: var(--ink); font-size: .85rem; line-height: 24px; text-align: center;
}
.cart-count.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.3); } }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center;
  min-height: min(86vh, 780px); overflow: hidden; background: var(--surround); color: var(--line);
}
.court { width: 100%; height: min(80vh, 720px); padding: 24px 0; }
.court-surface { fill: var(--court); }
.court-lines, .net { fill: none; stroke: var(--line); stroke-width: 5; }
.net { stroke-width: 3; stroke-dasharray: 2 6; opacity: .75; }
.ball { fill: var(--ball); }
.hero-copy {
  grid-column: 1; grid-row: 1;
  padding: clamp(48px, 8vh, 96px) var(--gutter);
  padding-left: max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter)));
}
.court { grid-column: 2; grid-row: 1; }
.hero h1 {
  max-width: 13ch;
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  font-weight: 850; line-height: .94; letter-spacing: -0.015em;
  font-variation-settings: "wdth" 125;
  text-wrap: balance;
}
.hero p { max-width: 54ch; margin: 22px 0 28px; font-size: 1.15rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; }

/* The one orchestrated moment: court lines chalk in, then the ball lands. */
@media (prefers-reduced-motion: no-preference) {
  .court-lines * { stroke-dasharray: 3000; stroke-dashoffset: 3000; animation: chalk 1.4s cubic-bezier(.6,0,.2,1) forwards; }
  .court-lines path:nth-child(2) { animation-delay: .25s; }
  .court-lines path:nth-child(3) { animation-delay: .45s; }
  .court-lines path:nth-child(4) { animation-delay: .6s; }
  .ball { animation: land 1.1s .9s cubic-bezier(.3,0,.3,1) both; transform-box: fill-box; transform-origin: center; }
  @keyframes chalk { to { stroke-dashoffset: 0; } }
  @keyframes land {
    0% { transform: translate(-160px, -420px) scale(1.8); opacity: 0; }
    15% { opacity: 1; }
    70% { transform: translate(0, 0) scale(1); }
    82% { transform: translate(18px, 30px) scale(1.1); }
    100% { transform: translate(26px, 52px) scale(1); }
  }
}

/* ---------- about ---------- */
.about { padding: clamp(64px, 10vw, 128px) var(--gutter); }
.about-grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px clamp(24px, 5vw, 80px);
}
.about-body p { max-width: 64ch; margin: 0 0 1em; }
.about-body .lede { font-size: 1.3rem; line-height: 1.45; font-weight: 500; }
.facts { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0; margin: 12px 0 0; border-top: 5px solid var(--court); }
.facts div { flex: 1 1 180px; padding: 16px 20px 0 0; }
.facts dt { color: var(--muted); font-size: .95rem; }
.facts dd { margin: 4px 0 0; font-size: 1.6rem; font-weight: 800; font-variation-settings: "wdth" 115; line-height: 1.15; }

/* ---------- companies ---------- */
.company { position: relative; overflow: hidden; color: var(--line); padding: clamp(56px, 8vw, 104px) var(--gutter); }
.company-court { background: var(--court); }
.company-grip {
  background-color: var(--grip);
  /* grip-tape grain */
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1.2px);
  background-size: 5px 5px;
}
.company-inner { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; }
.company-inner > * { max-width: 58ch; }
.company h3 { font-size: clamp(2.4rem, 6vw, 4.5rem); font-weight: 900; font-variation-settings: "wdth" 125; letter-spacing: -0.015em; }
.company-tagline { margin: 8px 0 20px; font-size: 1.3rem; font-weight: 600; color: var(--ball); }
.company p { margin-top: 0; }
.company .btn { margin-top: 12px; }
.company-art {
  position: absolute; right: max(-60px, calc((100vw - var(--max)) / 2 - 60px)); top: 50%; transform: translateY(-50%);
  width: clamp(240px, 36vw, 460px); fill: none; stroke: rgba(255,255,255,.22); stroke-width: 6;
}

/* ---------- shop ---------- */
.shop { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(64px, 10vw, 120px) var(--gutter); }
.shop-head { display: flex; flex-wrap: wrap; align-items: end; gap: 16px 32px; margin-bottom: 32px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 2px solid var(--rule); background: transparent; font-weight: 600;
}
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.price-note { flex-basis: 100%; margin: 0; color: var(--muted); }

.products { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 40px 28px; }
.products-loading, .products-error { grid-column: 1 / -1; color: var(--muted); }
.product { display: flex; flex-direction: column; }
.product[hidden] { display: none; }
.product-art { aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 6px; }
.product-art svg { width: 62%; height: 70%; fill: none; stroke: var(--line); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.product-art .accent { stroke: var(--ball); }
.product-art .fill-ball { fill: var(--ball); stroke: none; }
.product[data-company="tennis"] .product-art { background: var(--court); }
.product[data-company="motion"] .product-art { background: var(--grip); }
.product-company { margin: 14px 0 2px; color: var(--muted); font-size: .9rem; font-weight: 600; }
.product h3 { font-size: 1.3rem; }
.product-desc { margin: 8px 0 12px; }
.specs { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.specs li { padding: 2px 10px; border: 1.5px solid var(--rule); border-radius: 999px; font-size: .85rem; color: var(--muted); }
.product-buy { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 2px solid var(--ink); }
.price { font-size: 1.5rem; font-weight: 800; font-variation-settings: "wdth" 118; line-height: 1.1; }
.price small { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); font-variation-settings: "wdth" 100; }
.product-buy .btn { min-height: 44px; padding: 0 18px; background: var(--ink); color: var(--paper); }
.product-buy .btn:hover { background: var(--court); }
.product-buy .btn[disabled] { background: var(--rule); color: var(--muted); cursor: not-allowed; }
.stock-low { color: var(--danger); font-weight: 600; font-size: .9rem; margin: 0 0 8px; }

/* ---------- paying ---------- */
.paying { background: var(--surround); color: var(--line); padding: clamp(64px, 10vw, 120px) var(--gutter); }
.paying > * { max-width: var(--max); margin-left: auto; margin-right: auto; }
.steps { list-style: none; padding: 0; margin-top: 40px; margin-bottom: 40px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; counter-reset: step; }
.steps li { counter-increment: step; border-top: 5px solid var(--line); padding-top: 14px; }
.steps li::before {
  content: counter(step); display: block; margin-bottom: 10px;
  font-size: 3rem; font-weight: 900; line-height: 1; color: var(--ball); font-variation-settings: "wdth" 125;
}
.steps p { margin: 8px 0 0; max-width: 40ch; }
.paying-note { max-width: var(--max); padding: 16px 20px; border: 2px solid rgba(255,255,255,.4); border-radius: 6px; }
.paying-note code { color: var(--ball); }

/* ---------- footer ---------- */
.site-footer {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px 48px;
  padding: 48px var(--gutter) 32px; background: var(--ink); color: #c9d1db;
}
.site-footer p { margin: 0 0 8px; max-width: 56ch; }
.footer-mark { color: var(--line); font-weight: 900; font-size: 1.3rem; font-variation-settings: "wdth" 125; }
.copyright { grid-column: 1 / -1; font-size: .9rem; opacity: .7; }

/* ---------- cart drawer ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(20,32,46,.5); }
.cart {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw); display: flex; flex-direction: column;
  background: var(--paper); box-shadow: -8px 0 32px rgba(20,32,46,.25);
}
@media (prefers-reduced-motion: no-preference) {
  .cart:not([hidden]) { animation: slide-in .25s ease-out; }
  @keyframes slide-in { from { transform: translateX(100%); } }
}
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 2px solid var(--ink); }
.cart-head h2 { font-size: 1.6rem; }
.cart-items { list-style: none; margin: 0; padding: 8px 20px; overflow-y: auto; flex: 1; }
.cart-items li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.cart-items .empty { display: block; border: 0; color: var(--muted); padding-top: 24px; }
.cart-line-name { font-weight: 700; }
.cart-line-total { font-weight: 700; text-align: right; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--rule); background: transparent; }
.qty output { min-width: 28px; text-align: center; font-weight: 700; }
.remove { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: .9rem; justify-self: end; }
.cart-foot { padding: 16px 20px 20px; border-top: 2px solid var(--ink); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0 0 16px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; font-weight: 600; }
.totals .grand { color: var(--ink); font-weight: 800; font-size: 1.15rem; }

/* ---------- checkout dialog ---------- */
.checkout {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  padding: 28px; border: 0; border-radius: 8px; background: var(--paper); color: var(--ink);
}
.checkout::backdrop { background: rgba(20,32,46,.6); }
.checkout h2 { font-size: 1.8rem; margin-bottom: 20px; padding-right: 40px; }
.checkout-close-form { position: absolute; top: 16px; right: 16px; margin: 0; }
#shipping-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full, .full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .95rem; }
.field input {
  min-height: 44px; padding: 8px 12px; border: 2px solid var(--rule); border-radius: 6px;
  background: #fff; font: inherit;
}
.field input:focus { border-color: var(--court); outline: none; box-shadow: 0 0 0 3px rgba(31,79,130,.25); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field small { color: var(--muted); }
.form-error { margin: 0; color: var(--danger); font-weight: 600; }
.form-error:empty { display: none; }
.quote { margin: 8px 0 12px; padding: 18px 20px; border-radius: 6px; background: var(--court); color: var(--line); }
.quote-amount { margin: 0; font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 850; font-variation-settings: "wdth" 120; line-height: 1.1; }
.quote-meta { margin: 6px 0 0; opacity: .85; font-size: .95rem; }
.pay-to { margin: 0 0 16px; }
.fine { color: var(--muted); font-size: .9rem; margin-bottom: 0; }
.progress { height: 10px; margin: 16px 0; border-radius: 5px; background: var(--rule); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--surround); transition: width .4s; }

/* ---------- order page ---------- */
.order-page { max-width: 720px; margin: 0 auto; padding: 56px var(--gutter) 96px; }
.order-page h1 { font-size: clamp(2rem, 5vw, 3rem); font-variation-settings: "wdth" 120; margin-bottom: 12px; }
.status-pill { display: inline-block; padding: 4px 14px; border-radius: 999px; font-weight: 700; background: var(--rule); }
.status-pill[data-status="paid"] { background: var(--surround); color: var(--line); }
.status-pill[data-status="confirming"] { background: var(--ball); }
.status-pill[data-status="failed"], .status-pill[data-status="underpaid"] { background: var(--danger); color: var(--line); }
.order-page table, .admin table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.order-page th, .order-page td, .admin th, .admin td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.order-page td:last-child, .order-page th:last-child { text-align: right; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .site-header nav { display: none; }
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .court { grid-column: 1; grid-row: 1; height: 340px; padding: 28px 0 0; }
  .hero-copy { grid-row: 2; padding-top: 32px; }
  .header-actions { margin-left: auto; }
  .about-grid { grid-template-columns: 1fr; }
  .facts { grid-column: 1; }
  .company-art { opacity: .5; right: -100px; }
}
@media (max-width: 520px) {
  .wordmark span { display: none; }
  .wallet-btn { padding: 0 12px; font-size: .9rem; }
  #shipping-form { grid-template-columns: 1fr; }
  .checkout { padding: 20px; }
}
