/* ==========================================================================
   MyHandicapCalc — visual styling
   Mobile-first: base rules target small phone widths, enhanced at 700px+.

   Single accent, one hue family throughout: a vivid, yellow-leaning grass
   green (hue ~100°) chosen to read as sunlit turf rather than a generic
   "brand green" — deliberately warmer/brighter than a corporate forest
   green, and distinct from the cooler kelly/emerald greens common in golf
   branding. Only two steps of it exist (a working tone and its hover/
   emphasis shade); nothing else on the page introduces a second colour.
   Result numbers get no colour of their own — they're set apart by scale,
   weight and a rule in the same green, not a swap to a new hue.
   ========================================================================== */

:root {
  --color-bg: #ffffff;
  --color-surface: #f7f7f4;
  --color-surface-alt: #eef0e9;
  --color-primary: #377915;
  --color-primary-dark: #2b5f11;
  --color-text: #1b1d14;
  --color-text-muted: #5c6259;
  --color-border: #e2e2dc;
  --color-focus: #377915;
  --color-notice-bg: #f2f2ef;
  --color-notice-text: #5c6259;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max-width: 640px;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}

/* Visible, high-contrast focus ring on every interactive element. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

header {
  background: var(--color-primary);
  color: var(--color-bg);
  padding: 1.75rem 1.25rem 1.5rem;
}

/* The wordmark is the one other place the display serif appears —
   a nod to a club-sign masthead, not a random second typeface. */
header h1 {
  font-family: var(--font-display);
  margin: 0 0 0.4rem;
  font-size: 1.6rem;
  font-weight: 400;
}

header p {
  margin: 0;
  max-width: 34rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
}

header h1 .h1-sub {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-body);
  font-size: 1rem;
}

header .trust-note {
  margin-top: 0.6rem;
  font-size: 0.85rem;
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

section {
  padding: 1.75rem 0;
  border-top: 1px solid var(--color-border);
}

section:first-of-type {
  border-top: none;
}

h2 {
  font-family: var(--font-body);
  color: var(--color-primary-dark);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

section > p {
  margin: 0 0 0.75rem;
  color: var(--color-text-muted);
  max-width: 40rem;
}

.hint-text {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0 0 1rem;
}

/* ---- Content sections: how-it-works, glossary, FAQ -------------------- */

.content-section > p {
  color: var(--color-text);
  max-width: 42rem;
}

.content-section dl {
  margin: 0;
  max-width: 42rem;
}

.content-section dt {
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-top: 1.1rem;
}

.content-section dt:first-child {
  margin-top: 0;
}

.content-section dd {
  margin: 0.25rem 0 0;
  color: var(--color-text);
}

h3 {
  font-family: var(--font-body);
  color: var(--color-primary-dark);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}

.content-section h2 + h3 {
  margin-top: 0;
}

/* ---- Form fields -------------------------------------------------- */

.field-group {
  margin-bottom: 0.9rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 380px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin-bottom: 0.3rem;
}

.optional-tag {
  font-weight: 400;
  color: var(--color-text-muted);
}

input[type="number"],
select {
  width: 100%;
  font-size: 1rem; /* 16px minimum avoids iOS auto-zoom on focus */
  font-family: var(--font-body);
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
}

input[type="number"]:focus,
select:focus {
  border-color: var(--color-primary);
}

/* ---- Buttons -------------------------------------------------------- */

.button {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: center;
}

.button-primary {
  background: var(--color-primary);
  color: var(--color-bg);
  border-color: var(--color-primary);
  width: 100%;
}

.button-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.button-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
  width: 100%;
}

.button-secondary:hover {
  background: var(--color-surface-alt);
}

.rounds-actions {
  margin: 0.5rem 0 1.25rem;
}

#hi-calculate,
#ch-calculate {
  margin-top: 0.5rem;
}

/* ---- Round entries (accordion cards) -------------------------------- */

.rounds-container {
  margin-bottom: 0.5rem;
}

.round-entry {
  border-bottom: 1px solid var(--color-border);
  padding: 0.15rem 0;
}

.round-entry[open] {
  border-left: 3px solid var(--color-primary);
  padding-left: 0.75rem;
  background: var(--color-surface);
}

.round-entry-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.1rem;
  cursor: pointer;
  list-style: none;
}

.round-entry-summary::-webkit-details-marker {
  display: none;
}

.round-entry-summary::before {
  content: "▸";
  color: var(--color-primary);
  margin-right: 0.5rem;
  transition: transform 0.15s ease;
  display: inline-block;
}

.round-entry[open] > .round-entry-summary::before {
  transform: rotate(90deg);
}

.round-entry-title {
  font-weight: 700;
  color: var(--color-primary-dark);
  flex-shrink: 0;
}

.round-entry-status {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-entry-body {
  padding: 0.25rem 0.1rem 1.1rem;
}

/* ---- Holes toggle (Section 2) ---------------------------------------- */

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 0.9rem;
}

fieldset legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin-bottom: 0.4rem;
  padding: 0;
}

.holes-toggle {
  display: flex;
  gap: 0.6rem;
}

.holes-option {
  flex: 1;
  margin: 0;
}

.holes-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.holes-option span {
  /* 44px minimum tap target; flex centring keeps the label vertically
     centred now that height is set by min-height rather than padding. */
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  text-align: center;
  padding: 0.6rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.9rem;
}

.holes-option input:checked + span {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-bg);
}

.holes-option input:focus-visible + span {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* ---- Playing Handicap step: follows the Course Handicap result ------- */

.ph-step {
  margin-top: 1.5rem;
}

.ph-step[hidden] {
  display: none;
}

.ad-slot {
  margin: 2rem 0;
}

/* ---- Result panels: the payoff moment -------------------------------- */

.result-panel {
  margin-top: 1.5rem;
}

.result-panel:empty {
  display: none;
}

.result-panel:not(:empty):not(.result-panel-notice) {
  background: var(--color-bg);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.6rem;
}

.result-panel.result-panel-notice {
  color: var(--color-notice-text);
  background: var(--color-notice-bg);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.result-heading {
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

/* No colour swap for the payoff — scale, weight and a rule in the same
   green carry it instead, so the accent stays disciplined to one hue. */
.result-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--color-text);
  display: inline-block;
  padding-bottom: 0.2rem;
  border-bottom: 3px solid var(--color-primary);
}

.result-panel p {
  margin: 0 0 0.6rem;
  color: var(--color-text);
}

.result-panel ul {
  margin: 0 0 0.9rem;
  padding-left: 1.2rem;
  color: var(--color-text);
}

.result-panel li {
  margin-bottom: 0.2rem;
}

.use-index-button {
  margin-top: 0.75rem;
}

.copy-summary-button {
  margin-top: 0.5rem;
}

.copy-status {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ---- Links and policy-page body content ------------------------------ */

a {
  color: var(--color-primary);
}

a:hover {
  color: var(--color-primary-dark);
}

section ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--color-text);
}

section li {
  margin-bottom: 0.4rem;
}

.button-tertiary {
  background: transparent;
  border: none;
  color: var(--color-primary);
  text-decoration: underline;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-body);
}

.button-tertiary:hover {
  color: var(--color-primary-dark);
}

footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

footer p {
  margin: 0 0 0.5rem;
}

/* ---- Cookie consent banner --------------------------------------------- */

#cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  border-top: 3px solid var(--color-primary);
  padding: 1rem 1.25rem;
  z-index: 1000;
}

#cookie-banner[hidden] {
  display: none;
}

.cookie-banner-text {
  margin: 0 0 0.75rem;
  color: var(--color-text);
  font-size: 0.9rem;
  max-width: 640px;
}

.cookie-banner-actions {
  display: flex;
  gap: 0.75rem;
  max-width: 640px;
}

.cookie-banner-actions .button {
  width: auto;
  flex: 1;
}

@media (max-width: 380px) {
  .cookie-banner-actions {
    flex-direction: column;
  }
}

/* ---- Larger screens --------------------------------------------------- */

@media (min-width: 700px) {
  header {
    padding: 2.5rem 2rem 2rem;
  }

  header h1 {
    font-size: 2rem;
  }

  main {
    padding: 0 2rem 4rem;
  }

  section {
    padding: 2.25rem 0;
  }

  h2 {
    font-size: 1.4rem;
  }

  .button-primary,
  .button-secondary {
    width: auto;
  }

  .result-value {
    font-size: 4.25rem;
  }
}
