/* CaddieStats public site — one hand-written stylesheet, no framework.
   Palette and feel mirror the dashboard (dashboard/src/index.css): near-black
   ground, grass-green accent. Light theme is the default; dark is applied via
   a `.dark` class on <html> (same mechanism as the app, same `caddie-theme`
   localStorage key — same origin, so the choice carries between the site and
   the signed-in app). See nav.js for the toggle and the anti-flicker inline
   script in templates/base.html. */

:root {
  --app: #eef3ec;
  --surface: #ffffff;
  --elevated: #f3f7f1;
  --sunken: #e8eee6;
  --line: rgba(19, 33, 26, 0.12);
  --line-strong: rgba(19, 33, 26, 0.24);
  --fg: #13211a;
  --fg-soft: rgba(19, 33, 26, 0.62);
  --fg-faint: rgba(19, 33, 26, 0.42);
  --accent: #0e5c40;
  --accent-ink: #ffffff;
  --amber: #8a5a00;
  --coral: #b3261e;
  --focus: #19a974;
  --shadow: 0 1px 2px rgba(16, 40, 28, 0.06), 0 10px 26px -14px rgba(16, 40, 28, 0.22);
  --radius: 14px;
  --maxw: 68ch;
  color-scheme: light;
}

html.dark {
  --app: #0a0d0b;
  --surface: #171c16;
  --elevated: #1f261d;
  --sunken: #070a08;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);
  --fg: #ffffff;
  --fg-soft: rgba(255, 255, 255, 0.66);
  --fg-faint: rgba(255, 255, 255, 0.46);
  --accent: #2ecc71;
  --accent-ink: #06130c;
  --amber: #f5a623;
  --coral: #ff6b5e;
  --focus: #2ecc71;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--app);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(128, 128, 128, 0.05) 0 28px,
    transparent 28px 56px
  );
  background-attachment: fixed;
}

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

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

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

h1, h2, h3 { line-height: 1.2; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0 0 0.5em; }
h2 { font-size: clamp(1.35rem, 3.5vw, 1.7rem); margin: 2em 0 0.6em; }
h3 { font-size: 1.1rem; margin: 1.6em 0 0.4em; }
p, ul, ol { margin: 0 0 1em; }

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Long-form pages get a narrower reading column. */
main.wrap { padding-top: 28px; padding-bottom: 56px; }
.prose { max-width: var(--maxw); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
/* Support page: paragraphs inside a section read as plain line breaks.
   The h2 top margin still separates the sections. */
.prose--tight p { margin-bottom: 0; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---- header / nav ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--app) 88%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  flex-wrap: wrap;
}
.site-header__right { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--fg);
  text-decoration: none;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 9px;
}
.brand:hover { background: var(--elevated); text-decoration: none; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--fg-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}
.site-nav a[aria-current="page"] { color: var(--fg); background: var(--elevated); }

/* ---- mobile nav (the "Menu" dropdown) ----
   Below 720px the five nav links wrapped onto their own rows and ate a third
   of a phone screen. Now the header is one slim row (brand left; theme toggle
   and a labelled Menu button right) and the links drop down in a full-width
   panel under it — modelled on Mark's markscally.ie, at his request. The
   button is hidden on desktop and the nav is a plain inline row there,
   exactly as before. */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.nav-toggle:hover { filter: brightness(1.08); }
.nav-toggle[aria-expanded="true"] {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.nav-toggle svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 719px) {
  .site-header__inner { flex-wrap: nowrap; gap: 10px; }
  .site-header__right { flex-wrap: nowrap; gap: 6px; flex: none; }
  .brand { min-width: 0; }
  .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .nav-toggle { display: inline-flex; }

  /* Positioned against .site-header itself (sticky counts as positioned),
     not the padded .wrap inside it, so the panel runs edge to edge. */
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 2px;
    padding: 8px 20px 14px;
    background: var(--app);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 24px -18px rgba(0, 0, 0, 0.45);
  }
  .site-nav--open { display: flex; }
  .site-nav a {
    justify-content: flex-end;
    min-height: 48px;
    padding: 0 14px;
    font-size: 1.05rem;
    font-weight: 700;
  }
}
/* 320px phones: the labelled button leaves the wordmark a few pixels short,
   so tighten everything on that row rather than let it truncate. */
@media (max-width: 359px) {
  .site-header__inner { gap: 6px; }
  .site-header__right { gap: 0; }
  .brand { gap: 7px; }
  .brand img { width: 24px; height: 24px; }
  .nav-toggle { padding: 0 10px; gap: 6px; }
}

/* ---- theme toggle ---- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--fg-soft);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--elevated); color: var(--fg); }
.theme-toggle svg { width: 20px; height: 20px; }
/* assets/nav.js shows one icon at a time by setting/removing `hidden`. Spelled
   out here rather than trusting the browser's own [hidden] rule to reach an
   <svg>. */
.theme-toggle svg[hidden] { display: none; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 28px 0 48px;
  color: var(--fg-faint);
  font-size: 0.9rem;
}
.site-footer__legal { margin: 0; }
.site-footer__legal a { color: var(--fg-soft); }

/* ---- cards / layout blocks ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card + .card { margin-top: 16px; }

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* The hero runs the full content width, so the headline and lede sit across
   both columns of the .feature grid below rather than lining up with the
   left-hand one. */
.hero {
  padding: 32px 0 8px;
}
.hero p.lede { font-size: 1.15rem; color: var(--fg-soft); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fg-faint);
  margin-bottom: 6px;
}

.muted { color: var(--fg-soft); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 11px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  background: var(--elevated);
  color: var(--fg);
}
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--fg); }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; }

.btn--google {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--fg);
}
.btn--google svg { width: 18px; height: 18px; }
#google-slot:not(:empty) { margin-bottom: 18px; }

/* ---- forms ---- */
.form { max-width: 26rem; }
.form + .form { margin-top: 16px; }
.field { margin-bottom: 16px; }
.field > label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}
.field .hint { font-size: 0.85rem; color: var(--fg-soft); margin: 4px 0 0; }
.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px; /* iOS zooms in below 16px */
  color: var(--fg);
  background: var(--sunken);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}
.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.checkbox input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex: none;
}
.checkbox label { font-weight: 500; }

/* Honeypot: off-screen, not display:none (some bots skip display:none). */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field-error {
  color: var(--coral);
  font-size: 0.88rem;
  margin: 6px 0 0;
  font-weight: 600;
}
.form-error {
  background: color-mix(in srgb, var(--coral) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--coral) 40%, transparent);
  color: var(--coral);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-weight: 600;
}
.form-notice {
  background: color-mix(in srgb, var(--focus) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--focus) 35%, transparent);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.pw-field { position: relative; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  min-height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
}

.altlink { font-size: 0.95rem; }

/* ---- feature blocks (landing) ---- */
.feature {
  display: grid;
  gap: 18px;
  align-items: center;
  margin: 28px 0;
}
@media (min-width: 720px) {
  .feature { grid-template-columns: 1fr 1fr; }
  .feature:nth-child(even) .feature__media { order: 2; }
}
.feature__media img {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--sunken);
}
/* A cut-out render (transparent PNG) rather than a screenshot: no card frame
   behind it, and held back from filling the column. */
.feature__media--bare img {
  border: none;
  background: none;
  border-radius: 0;
  display: block;
  margin: 0 auto;
  max-width: 260px;
  height: auto;
}
/* The closing call-to-action card on the landing page follows the last
   feature block; .feature's own 28px margin is too tight to read as a new
   section, so give the card extra air above it. */
.feature + .card { margin-top: 52px; }
.fignote { font-size: 0.8rem; color: var(--fg-faint); margin-top: 6px; }
/* Feature bullets (home page): tighter than the browser default. */
.feature ul { padding-left: 1.2em; }
.feature li { margin: 0.35em 0; }

/* ---- tables (watches, courses) ---- */
.table-scroll { overflow-x: auto; }
table.data {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th { font-weight: 700; }
table.data caption { text-align: left; color: var(--fg-soft); margin-bottom: 8px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--elevated);
  color: var(--fg-soft);
}
.tag--ok { background: color-mix(in srgb, var(--focus) 18%, transparent); color: var(--accent); }
.tag--no { background: color-mix(in srgb, var(--coral) 15%, transparent); color: var(--coral); }

/* ---- pairing code ---- */
.paircode {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: clamp(2rem, 9vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  padding: 16px 10px;
  text-align: center;
  background: var(--sunken);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}

/* ---- courses search (W11: stars + coverage + the detail panel) ---- */
.course-list { list-style: none; padding: 0; margin: 16px 0 40px; }
.course-list li {
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.6em auto;
  align-items: center;
  gap: 4px 12px;
}
/* `display: grid` above beats the UA stylesheet's `[hidden]{display:none}`,
   the same way `display:flex` used to — without this, courses.js's search
   filter (which just sets li.hidden) has no visible effect. */
.course-list li[hidden] { display: none; }
.course-list .dist { color: var(--fg-faint); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.course-row-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.course-row-btn:hover .course-name,
.course-row-btn:focus-visible .course-name { text-decoration: underline; }
.stars { color: var(--amber); letter-spacing: 1px; white-space: nowrap; font-size: 0.95em; }
.stars[aria-label="not yet rated"] { color: var(--fg-faint); font-size: 0.85rem; letter-spacing: normal; }
#star-legend ul { margin: 10px 0 0; padding-left: 1.1em; }
#star-legend li { margin-bottom: 6px; }
.course-detail {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.92rem;
  line-height: 1.6;
}
@media (max-width: 560px) {
  .course-list li { grid-template-columns: minmax(0, 1fr) 4.6em; }
  .course-list .dist { grid-column: 1 / -1; text-align: left; }
}
#report-box { margin-top: 24px; }
.course-detail dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 6px 0 0; }
.course-detail dt { color: var(--fg-soft); }
.course-detail dd { margin: 0; }

.stat-row { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 8px 0 0; }
.stat-row b { font-size: 1.2rem; }

.todo-banner {
  background: #b3261e;
  color: #fff;
  padding: 12px 16px;
  font-weight: 700;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- install (Add to Home Screen) ---- */
/* Unused since the home page's install card was removed (the offer lives in
   the app, on Profile). Kept alongside assets/install.js in case it returns:
   these styles cover the manual-steps panel it opens on browsers with no
   install prompt of their own. */
.install__how {
  margin: 4px auto 0;
  max-width: 30rem;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--fg-soft);
  font-size: 0.95rem;
}
.install__title { font-weight: 700; color: var(--fg); margin: 0 0 6px; }
.install__how ol { margin: 0; padding-left: 20px; }
.install__how li { margin-bottom: 6px; }
