/* GolfCal — design tokens */
:root {
  /* Warm neutrals */
  --bg: #C1D0BC;
  --bg-elev: #ECEFE8;
  --surface: #F7F5EF;
  --ink: #111312;
  --ink-2: rgba(17,19,18,0.66);
  --ink-3: rgba(17,19,18,0.44);
  --ink-4: rgba(17,19,18,0.28);
  --hairline: rgba(17,19,18,0.12);
  --hairline-strong: rgba(17,19,18,0.18);

  /* Accent — fairway green (customizable) */
  --accent-h: 150;
  --accent: #1F6B36;
  --accent-soft: rgba(31,107,54,0.14);
  --accent-ink: #1F6B36;
  /* Hover/active state — ~14% darker than --accent. Added 2026-09-02: two
     .btn-primary:hover rules referenced this without it ever being defined
     (same failure mode as the friends.html CSS-drift bug — see gotchas.md). */
  --accent-strong: #1B5C2E;
  /* Identity sequence — "Twelve Scorecards" (artifact 04abcdf1) §01b. Answers
     WHOSE IS IT, where the score palette answers HOW DID THIS HOLE GO; the two
     must never be confused. Assigned in fixed order and never cycled — there is
     no seventh colour, because "a hue nobody can name is worse than no hue", so
     a seventh scoring unit falls back to its label alone.
     Warm and cool ALTERNATE, and that order is validated rather than chosen by
     taste: grouping the warms put green next to ochre, ΔE 4.8 apart under
     protanopia and so effectively one colour. Alternating lifts the worst
     adjacent pair to ΔE 13.0 (deuteranopia) in light and 9.7 in dark, against a
     floor of 8. Identity is always a SOLID (a rail, a label, a filled disc) and
     score is always a thin ring, so the two never share a shape either. */
  --id1: #0A7A34;
  --id2: #4338CA;
  --id3: #B45309;
  --id4: #0891B2;
  --id5: #BE185D;
  --id6: #65A30D;

  /* Semantic */
  --warn: #B8801E;
  --warn-soft: rgba(184,128,30,0.14);
  --danger: #C0392B;
  --danger-soft: rgba(192,57,43,0.10);
  --info: #2A6FDB;
  --info-soft: rgba(42,111,219,0.10);
  --success: #1F6B36;
  --success-soft: rgba(31,107,54,0.12);

  /* Score colors: the design-language table (docs/site/mobile/product/design-language.md,
     owner 2026-10-18/19), the same in light and dark mode. Under par a solid circle (eagle
     amber with dark ink, birdie red), over par a solid square (bogey blue, double purple,
     triple black); albatross is drawn as an eagle. The shapes live in score-marks.css. */
  --score-eagle: #F59E0B;       /* amber - under par by 2 */
  --score-albatross: #F59E0B;   /* same amber - under par by 3+ */
  --score-birdie: #EF4444;      /* red - under par by 1 */
  --score-par: #d1d5db;         /* neutral gray - at par */
  --score-bogey: #3B82F6;       /* blue - over par by 1 */
  --score-double: #8B5CF6;      /* purple - over par by 2 */
  --score-triple: #111312;      /* black - over par by 3+ */
  /* Edge that keeps the black triple mark visible on a dark card: 1px, the iOS/Android
     hairlineStrong strength (32%). */
  --score-edge: rgba(17,19,18,0.32);
  /* Under/over par as TEXT (to-par figures): the mark fill in light mode, the 400-weight tint
     in dark so the figure keeps AA contrast on the dark surface. */
  --score-birdie-text: #EF4444;
  --score-bogey-text: #3B82F6;
  /* Soft/pastel versions for backgrounds */
  --score-eagle-soft: oklch(94% 0.08 75);
  --score-birdie-soft: oklch(94% 0.06 27);
  --score-par-soft: transparent;
  --score-bogey-soft: oklch(94% 0.05 248);
  --score-double-soft: oklch(94% 0.05 305);
  --score-triple-soft: oklch(91% 0.06 305);
  /* Delta chip colors */
  --delta-good: oklch(45% 0.12 155);     /* green - improvement */
  --delta-good-bg: oklch(94% 0.04 155);
  --delta-bad: oklch(50% 0.16 25);       /* red - regression */
  --delta-bad-bg: oklch(95% 0.04 30);

  /* Shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* Shadow */
  --sh-1: 0 1px 2px rgba(10, 10, 10, 0.04), 0 0 0 0.5px rgba(10, 10, 10, 0.04);
  --sh-2: 0 6px 24px rgba(10, 10, 10, 0.06), 0 1px 2px rgba(10, 10, 10, 0.04);
  --sh-3: 0 24px 60px rgba(10, 10, 10, 0.10), 0 2px 6px rgba(10, 10, 10, 0.05);

  /* Density */
  --pad-sm: 14px;
  --pad-md: 20px;
  --pad-lg: 28px;
  --gap: 16px;

  /* Type */
  --font-ui: -apple-system, "SF Pro Text", "SF Pro Display", system-ui, Helvetica, Arial, sans-serif;
  --font-display: ui-serif, "New York", "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #111312;
  --bg-elev: #202923;
  --surface: #1A211C;
  --ink: #F7F5EF;
  --ink-2: rgba(247,245,239,0.64);
  --ink-3: rgba(247,245,239,0.38);
  --ink-4: rgba(247,245,239,0.24);
  --hairline: rgba(247,245,239,0.12);
  --hairline-strong: rgba(247,245,239,0.18);
  --accent: #74BE82;
  --accent-soft: rgba(116,190,130,0.18);
  --accent-ink: #74BE82;
  --accent-strong: #57B068;
  /* Dark is its OWN steps, not a flip: each hue is re-stepped into the dark
     lightness band and re-validated against the dark surface. The light indigo
     falls out of band on dark — exactly the failure an automatic inversion
     would have shipped. */
  --id1: #16A34A;
  --id2: #6366F1;
  --id3: #B87D0A;
  --id4: #0E9BB5;
  --id5: #DB2777;
  --id6: #6E9C16;
  --warn-soft: rgba(224,169,60,0.16);
  --danger-soft: rgba(229,103,90,0.16);
  --info: #5C97F0;
  --info-soft: rgba(92,151,240,0.16);
  --success-soft: rgba(116,190,130,0.16);
  --sh-1: 0 1px 2px rgba(0,0,0,0.3);
  --sh-2: 0 6px 24px rgba(0,0,0,0.4);
  --sh-3: 0 24px 60px rgba(0,0,0,0.5);
  /* Score colors: identical to light mode (the design-language table has one value per
     bucket); the triple-bogey mark gets a hairline edge from score-marks.css. */
  --score-eagle: #F59E0B;
  --score-albatross: #F59E0B;
  --score-birdie: #EF4444;
  --score-par: #6b7280;
  --score-bogey: #3B82F6;
  --score-double: #8B5CF6;
  --score-triple: #111312;
  --score-edge: rgba(247,245,239,0.32);
  --score-birdie-text: #F87171;
  --score-bogey-text: #60A5FA;
  --score-eagle-soft: oklch(32% 0.08 75);
  --score-birdie-soft: oklch(32% 0.06 27);
  --score-par-soft: oklch(26% 0.01 260);
  --score-bogey-soft: oklch(32% 0.05 248);
  --score-double-soft: oklch(32% 0.05 305);
  --score-triple-soft: oklch(30% 0.06 305);
  --delta-good-bg: oklch(30% 0.05 155);
  --delta-bad-bg: oklch(30% 0.05 30);
}

[data-density="compact"] {
  --pad-sm: 10px;
  --pad-md: 14px;
  --pad-lg: 20px;
  --gap: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: inherit; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--hairline-strong);
  border-radius: 999px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-track { background: transparent; }

/* Common component classes */
.card {
  background: var(--surface);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}

.hairline {
  border-bottom: 0.5px solid var(--hairline);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--hairline);
  color: var(--ink-2);
}
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.warn { background: var(--warn-soft); color: oklch(40% 0.13 70); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.success { background: var(--success-soft); color: var(--success); }

/* Compact club abbreviation chip used in event/score lists. */
.club-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--hairline);
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  border: 0.5px solid transparent;
  transition: background 120ms ease, transform 80ms ease;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn:hover {
  background: var(--hairline);
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn.primary:hover {
  background: oklch(28% 0.02 90);
}
.btn.accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn.accent:hover {
  background: oklch(from var(--accent) calc(l - 0.05) c h);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
}
.btn.sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.btn.lg {
  padding: 14px 20px;
  font-size: 15px;
  border-radius: 14px;
}

.mono {
  font-family: var(--font-mono);
}

.display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.fade-in {
  animation: fadeIn 220ms ease both;
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-anim {
  animation: sheetIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Image placeholders with subtle stripes */
.stripe-ph {
  background:
    repeating-linear-gradient(135deg,
      oklch(90% 0.02 var(--accent-h)) 0 12px,
      oklch(94% 0.015 var(--accent-h)) 12px 24px);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
}

/* Form inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
select,
textarea {
  border: 0.5px solid var(--hairline-strong);
  border-radius: var(--r-md);
  background: var(--bg);
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 120ms ease;
}

/*
 * Safari renders date/time values inside shadow-DOM pseudo-elements that do
 * not inherit `color` from the input. Without explicit styling the value
 * text can appear blank while labels/placeholders remain visible.
 */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
  color: var(--ink);
  font-family: inherit;
  line-height: 1.4;
}

input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit,
input[type="month"]::-webkit-datetime-edit,
input[type="week"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="time"]::-webkit-datetime-edit-hour-field,
input[type="time"]::-webkit-datetime-edit-minute-field,
input[type="time"]::-webkit-datetime-edit-second-field,
input[type="time"]::-webkit-datetime-edit-meridiem-field,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
input[type="datetime-local"]::-webkit-datetime-edit-second-field,
input[type="datetime-local"]::-webkit-datetime-edit-meridiem-field {
  color: var(--ink);
  padding: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.55;
}

input[type="date"]::-webkit-inner-spin-button,
input[type="time"]::-webkit-inner-spin-button {
  height: auto;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-3);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* Section labels (e.g., "ROUND", "COURSE", "DATE") */
.section-label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* Tabs Component */
.tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  background: var(--hairline);
  border-radius: 12px;
}

.tabs .tab {
  padding: 8px 16px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 120ms ease;
}

.tabs .tab:hover:not(.active) {
  background: rgba(0, 0, 0, 0.05);
}

.tabs .tab.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-1);
}

.tabs .tab-count {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
}

/* Detail Panel (slide-out from right) */
.detail-panel {
  position: fixed;
  top: 0;
  right: -500px;
  width: 500px;
  max-width: 100vw;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--sh-3);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}

.detail-panel.open {
  right: 0;
}

.detail-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
}

.detail-panel-backdrop.show {
  display: block;
}

/* Modal Wizard */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeIn 220ms ease both;
}

.modal-header {
  padding: 32px 32px 24px;
  border-bottom: 0.5px solid var(--hairline);
}

.modal-step {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  font-weight: 500;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}

.modal-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-2);
  transition: all 120ms ease;
}

.modal-close:hover {
  background: var(--hairline);
  color: var(--ink);
}

.modal-body {
  padding: 24px 32px;
}

.modal-footer {
  padding: 20px 32px;
  border-top: 0.5px solid var(--hairline);
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

/* Selection List (for modal wizards) */
.selection-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selection-item {
  padding: 16px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--hairline);
  background: var(--surface);
  cursor: pointer;
  transition: all 120ms ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.selection-item:hover {
  border-color: var(--hairline-strong);
  background: var(--bg);
}

.selection-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.selection-item .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.selection-item.selected .check {
  background: var(--accent);
  border-color: var(--accent);
}

.selection-item-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  background: var(--hairline);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.selection-item-content {
  flex: 1;
  min-width: 0;
}

.selection-item-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.selection-item-meta {
  font-size: 13px;
  color: var(--ink-2);
}

/* Time Slot Grid */
.time-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.time-slot {
  padding: 12px 8px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--hairline);
  background: var(--surface);
  cursor: pointer;
  transition: all 120ms ease;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.time-slot:hover:not(.disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.time-slot.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.time-slot.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--hairline);
}

.time-slot-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.time-slot-indicator.available {
  background: var(--success);
}

.time-slot-indicator.limited {
  background: var(--warn);
}

.time-slot-indicator.full {
  background: var(--danger);
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  background: var(--surface);
  border: 0.5px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  padding: 8px 12px;
  font-size: 12px;
  box-shadow: var(--sh-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
