/* caddiwise.com's pages (#610): the header, footer, page heads, reading text, cards and buttons
   every page shares. Colours, type and spacing come from /tokens.css (linked first). The home
   page adds /home/home.css; My golf, society days and seasons add their own. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 17px/1.6 var(--font-text); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
img, svg, video, canvas, picture { max-width: 100%; }
img { height: auto; }
a { color: var(--fairway); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
h1 { font-weight: 800; }
h2, h3 { font-weight: 700; }
p, li { text-wrap: pretty; }
code { font-family: var(--font-mono); font-size: 0.92em; }
/* Long URLs and codes wrap rather than push the page sideways on a phone. */
code, p a, li a { overflow-wrap: anywhere; }
::selection { background: color-mix(in srgb, var(--fairway) 28%, transparent); }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 999px;
  background: var(--fairway); color: var(--on-fairway); font-weight: 700; text-decoration: none; transition: top 0.2s var(--ease); }
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header: sticky glass, the logo and a few links ---------- */
.site-header { position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: 10px; }
.brand img { width: 32px; height: 32px; display: block; }
.brand .wordmark { font-size: 22px; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: clamp(14px, 3vw, 28px); }
.site-nav a { color: var(--slate); text-decoration: none; font-size: 15px; font-weight: 500; white-space: nowrap; padding: 6px 0; transition: color 0.2s var(--ease); }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); }
/* The home page's header sits on the navy hero: dark glass, light text, both colour schemes. */
.site-header.on-dark { background: color-mix(in srgb, var(--stage) 72%, transparent); border-bottom-color: rgb(255 255 255 / 0.08); color: #fff; }
.site-header.on-dark .wordmark { color: #fff; }
.site-header.on-dark .wordmark span { color: var(--stage-green); }
.site-header.on-dark .site-nav a { color: rgb(255 255 255 / 0.72); }
.site-header.on-dark .site-nav a:hover { color: #fff; }
@media (max-width: 420px) {
  .site-header .wrap { gap: 10px; padding: 0 16px; }
  .brand { gap: 8px; }
  .brand img { width: 28px; height: 28px; }
  .brand .wordmark { font-size: 19px; }
  .site-nav { gap: 13px; }
  .site-nav a { font-size: 14px; }
}

/* ---------- Pages: a big head, then reading text ---------- */
.page { flex: 1; width: 100%; max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(56px, 8vw, 112px); }
.page.wide { max-width: calc(960px + 2 * var(--gutter)); }
.eyebrow { margin: 0 0 12px; font: 700 13px/1.2 var(--font-text); letter-spacing: 0.1em; text-transform: uppercase; color: var(--fairway); }
:where(.page) h1 { font-size: clamp(40px, 7vw, 64px); margin: 0 0 18px; }
.lead { font-size: clamp(19px, 2.3vw, 22px); line-height: 1.5; color: var(--slate); margin: 0 0 24px; }
:where(.page) h2 { font-size: clamp(23px, 3vw, 30px); margin: 2.2em 0 0.5em; }
:where(.page) h3 { font-size: 20px; margin: 1.8em 0 0.4em; }
:where(.page) p, :where(.page) li { color: var(--ink); }
:where(.page) ul { padding-left: 1.2em; }
:where(.page) li { margin: 0.35em 0; }
:where(.page) li::marker { color: var(--fairway); }
:where(.page) hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
:where(.page) em { color: var(--slate); }
.small { font-size: 14px; color: var(--slate); }
.muted { color: var(--slate); }

/* A long policy: a pill-shaped contents list that wraps. */
.toc { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 28px 0 8px; }
.toc a { display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.toc a:hover { background: var(--mint); }

/* ---------- Cards, buttons, codes ---------- */
.card { background: var(--card); border-radius: var(--radius-l); padding: 22px 24px; margin: 20px 0; }
.card p:first-child { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 24px;
  border: 0; border-radius: 999px; background: var(--fairway); color: var(--on-fairway); font: 600 17px/1.2 var(--font-text);
  text-decoration: none; cursor: pointer; transition: transform 0.2s var(--ease), filter 0.2s var(--ease); }
.button:hover { filter: brightness(1.07); }
.button:active { transform: scale(0.97); }
.button.secondary { background: var(--raised); color: var(--ink); }
.code { font: 700 clamp(30px, 8vw, 44px)/1.2 var(--font-mono); letter-spacing: 0.08em; margin: 24px 0; color: var(--ink); }
.code.inline { font-size: 1.1rem; margin: 0; }

/* The call-to-action slot: "in testing" now. To switch to a download, swap the .cta-soon line for
   <a class="button cta-get" href="…">Get CaddiWise</a> where it appears (home, twice). */
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.cta-soon { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 10px 18px 10px 14px; border-radius: 999px;
  font-weight: 600; font-size: 16px; background: var(--card); color: var(--ink); }
.cta-soon::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fairway);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--fairway) 25%, transparent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--card); color: var(--slate); font-size: 14px; }
.site-footer .wrap { padding-top: 40px; padding-bottom: 40px; display: grid; gap: 28px; }
.site-footer .foot-top { display: flex; flex-wrap: wrap; gap: 20px 40px; justify-content: space-between; align-items: flex-start; }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 24px; }
.site-footer nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.site-footer nav a:hover { color: var(--fairway); }
.site-footer p { margin: 0 0 6px; max-width: 860px; }
.site-footer .credits a { color: inherit; }

/* ---------- Components (#612): the controls every page builds from ----------
   Low specificity (:where) so a page can still tune one; colours, radii and type from tokens.css. */

/* Text fields, selects and text areas */
:where(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=file], [type=submit], [type=button]), select, textarea).field,
:where(.form) :where(input:not([type=checkbox], [type=radio], [type=range], [type=color], [type=file], [type=submit], [type=button]), select, textarea) {
  min-height: var(--control-h); padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); color: var(--ink); font: 400 var(--fs-m)/1.3 var(--font-text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease); }
:where(textarea).field, :where(.form) textarea { min-height: 96px; resize: vertical; }
:where(.field, .form input, .form select, .form textarea):hover { border-color: color-mix(in srgb, var(--slate) 45%, var(--line)); }
:where(.field, .form input, .form select, .form textarea):focus { outline: none; border-color: var(--fairway); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fairway) 28%, transparent); }
:where(.field, .form input, .form select, .form textarea)::placeholder { color: color-mix(in srgb, var(--slate) 80%, transparent); }
:where(.form) label { display: block; font: 600 var(--fs-s)/1.3 var(--font-text); color: var(--ink); margin: 0 0 6px; }
:where(.form) .hint { display: block; font-size: var(--fs-s); color: var(--slate); margin-top: 6px; }
:where(.form) .error { color: var(--clay); font-size: var(--fs-s); }
input[type=checkbox], input[type=radio] { accent-color: var(--fairway); width: 18px; height: 18px; }

/* Button sizes and kinds (.button is above): secondary (raised), ghost (outline), danger, small. */
.button.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.button.ghost:hover { background: var(--raised); filter: none; }
.button.danger { background: var(--clay); color: #fff; }
.button.small { min-height: var(--control-h-s); padding: 6px 14px; font-size: var(--fs-m); }
.button:disabled, .button[aria-disabled=true] { opacity: 0.45; cursor: default; transform: none; filter: none; }
.button:focus-visible { outline: none; box-shadow: var(--focus); }
.link-button { border: 0; background: none; padding: 0; color: var(--fairway); font: inherit; font-weight: 600; cursor: pointer; }
.link-button:hover { text-decoration: underline; }

/* Chips and pills: small labels, and toggles when they're buttons. */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 12px; border: 0; border-radius: 999px;
  background: var(--raised); color: var(--slate); font: 600 var(--fs-s)/1.2 var(--font-text); }
.chip.good { background: var(--mint); color: var(--fairway); }
.chip.bad { background: color-mix(in srgb, var(--clay) 14%, transparent); color: var(--clay); }
.chip.warn { background: color-mix(in srgb, var(--flag) 20%, transparent); color: var(--flag-ink); }
button:where(.chip) { cursor: pointer; color: var(--ink); }
button:where(.chip[aria-pressed=true]) { background: var(--pine); color: #fff; }

/* A segmented control: a pill track with the chosen option raised. */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--raised); }
.segmented button { border: 0; border-radius: 999px; padding: 6px 14px; background: transparent; color: var(--slate); font: 600 var(--fs-s)/1.2 var(--font-text); cursor: pointer; }
.segmented button[aria-pressed=true], .segmented button[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* Tables: hairline rows, quiet headers, tabular figures. */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { font: 600 var(--fs-xs)/1.2 var(--font-text); letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tbody tr { transition: background 0.15s var(--ease); }
.table tbody tr:hover { background: color-mix(in srgb, var(--raised) 55%, transparent); }

/* A raised card on the page background (style.css's .card is the flat one). */
.panel { background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: var(--radius-l); padding: 22px 24px; box-shadow: var(--shadow); }

/* Dialogs */
dialog.sheet { border: 0; border-radius: var(--radius-l); padding: 26px; max-width: min(480px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
dialog.sheet::backdrop { background: rgb(6 12 22 / 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog.sheet h2 { font-size: var(--fs-h3); margin: 0 0 10px; }

/* States: empty, loading, error and notices. */
.state { text-align: center; padding: 40px 24px; color: var(--slate); border-radius: var(--radius-l); background: var(--card); }
.state strong { display: block; font: 700 var(--fs-h3)/1.2 var(--font-display); color: var(--ink); margin-bottom: 6px; }
.state.error { background: color-mix(in srgb, var(--clay) 8%, var(--card)); }
.notice { border-radius: var(--radius); padding: 12px 16px; background: var(--mint); color: var(--fairway); font-weight: 600; }
.notice.error { background: color-mix(in srgb, var(--clay) 12%, transparent); color: var(--clay); }
.spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin 0.8s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-style: dotted; } }

/* Figures: Outfit with tabular numbers. */
.figure { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1; }
kbd { font: 600 var(--fs-xs)/1 var(--font-mono); padding: 3px 6px; border-radius: 6px; background: var(--raised); box-shadow: inset 0 -1px 0 var(--line); color: var(--ink); }

/* ---------- Page heads (#612): a soft full-width band behind the title, with faint contour
   rings in the brand green, on every inner page (support, privacy, data, leaderboards…). ---------- */
body { overflow-x: clip; }
.page-head, .board-head { position: relative; isolation: isolate; padding-bottom: clamp(24px, 4vw, 40px); margin-bottom: clamp(28px, 4vw, 44px); }
.page-head::before, .board-head::before { content: ""; position: absolute; z-index: -1; top: calc(-1 * clamp(40px, 8vw, 96px)); bottom: 0; left: 50%; width: 100vw; translate: -50% 0;
  background:
    repeating-radial-gradient(ellipse 120% 90% at 92% 0%, transparent 0 28px, color-mix(in srgb, var(--fairway) 7%, transparent) 28px 29.5px),
    radial-gradient(70% 120% at 100% 0%, color-mix(in srgb, var(--fairway) 10%, transparent), transparent 70%),
    var(--card);
  border-bottom: 1px solid var(--line); }
.page-head > :last-child, .board-head > :last-child { margin-bottom: 0; }
.page-head h1, .board-head h1 { margin-bottom: 14px; }

/* Long documents (privacy, data): each section starts under a hairline. */
.prose h2 { padding-top: 1.1em; margin-top: 1.3em; border-top: 1px solid var(--line); }
.prose .page-head + p, .prose .page-head + h2 { border-top: 0; }
.prose ul { padding-left: 1.3em; }
.prose code { padding: 1px 6px; border-radius: 6px; background: var(--raised); font-size: 0.86em; }

/* Support: the answers as cards, two across on a wide screen. */
.faq { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.faq-item { padding: 24px 26px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); box-shadow: var(--shadow); }
:where(.faq-item) h2 { margin: 0 0 8px; font-size: var(--fs-h3); }
.faq-item p { margin: 0; color: var(--ink); }

/* A code to type or open (friend links, editor sign-in): a ticket-like card. */
.code-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin: 0 0 28px; padding: 22px 26px;
  border-radius: var(--radius-l); background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); box-shadow: var(--shadow-lift); }
.code-card .code { margin: 0; color: var(--ink); }
.code-card p:last-child { margin: 0; }

/* 404: a golf ball, a long way from the fairway. */
.page.lost { text-align: left; }
.lost-ball { width: 72px; height: 72px; margin: 0 0 28px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 18%, #E9EDF2 45%, #C9D0D8 100%);
  box-shadow: inset -6px -8px 14px rgb(14 22 36 / 0.14), 0 16px 26px -8px rgb(14 22 36 / 0.3); }
