/* ==========================================================================
   Ground-First Golf Blueprint — Modern Flat Mobile Flash Cards & Engine CSS
   ========================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "ETBook", Georgia, serif;
  
  /* Modern Flat Color Tokens */
  --bg-page: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-hover: #f1f5f9;
  
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  /* Material Functional Tokens */
  --accent-iron: #1976d2;
  --accent-warmup: #0284c7;
  --accent-fairway: #059669;
  --accent-driver: #d97706;
  --accent-wedge: #7c3aed;
  --accent-pair: #4f46e5;
  --accent-emergency: #dc2626;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

html, body {
  background-color: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-sans);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   FLAT HEADER & CATEGORY BAR
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  padding: env(safe-area-inset-top, 0.4rem) 0.85rem 0 0.85rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-badge {
  font-size: 0.675rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--bg-subtle);
  color: var(--accent-iron);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-icon-action {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background 0.12s ease;
}

.btn-icon-action:hover, .btn-icon-action:active {
  background: var(--bg-hover);
}

/* Flat Category Tabs (Pure CSS Anchor Links) */
.category-pills {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.4rem 0 0.5rem 0;
  border-top: 1px solid var(--border-subtle);
}

.category-pills::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: all 0.12s ease;
}

.pill-btn:hover, .pill-btn:active {
  color: #ffffff;
  background: var(--text-main);
  border-color: var(--text-main);
}

.pill-btn.pill-btn-book {
  background: #0f172a;
  color: #ffffff !important;
  border-color: #0f172a;
  font-weight: 800;
  margin-left: 0.25rem;
}

.pill-btn.pill-btn-book:hover {
  background: #1e293b;
  border-color: #1e293b;
}

/* ==========================================================================
   FLAT FLASH CARD STAGE
   ========================================================================== */

.card-deck-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0.75rem 1rem 4.5rem 1rem;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.card-view {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.25rem 0;
  position: relative;
  scroll-margin-top: 105px;
}

/* Card Header Meta */
.card-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.card-step-badge {
  font-size: 0.725rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  color: #ffffff;
}

.card-step-badge.iron-blue { background: var(--accent-iron); }
.card-step-badge.warmup-cyan { background: var(--accent-warmup); }
.card-step-badge.fairway-emerald { background: var(--accent-fairway); }
.card-step-badge.driver-amber { background: var(--accent-driver); }
.card-step-badge.wedge-purple { background: var(--accent-wedge); }
.card-step-badge.pair-blue { background: var(--accent-iron); }
.card-step-badge.pair-teal { background: #0d9488; }
.card-step-badge.pair-emerald { background: var(--accent-fairway); }
.card-step-badge.pair-orange { background: #ea580c; }
.card-step-badge.emergency-crimson { background: var(--accent-emergency); }
.card-step-badge.gateway-purple { background: var(--accent-wedge); }

.card-spec-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.card-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.85rem;
}

/* Flat Primary Focus Cue Box */
.primary-cue-box {
  background: var(--bg-subtle);
  border-left: 4px solid var(--accent-iron);
  border-radius: 0 4px 4px 0;
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.9rem;
}

.primary-cue-box.warmup-cyan { border-left-color: var(--accent-warmup); }
.primary-cue-box.fairway-emerald { border-left-color: var(--accent-fairway); }
.primary-cue-box.driver-amber { border-left-color: var(--accent-driver); }
.primary-cue-box.wedge-purple { border-left-color: var(--accent-wedge); }
.primary-cue-box.emergency-crimson { border-left-color: var(--accent-emergency); }

.primary-cue-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.primary-cue-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
}

/* =========================================================================
   UNIVERSAL BRAIN RESET BANNER (Section 4 Twin-Pillars)
   ========================================================================= */

.brain-reset-banner {
  background: #ffffff;
  border: 2px solid #2563eb;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
}

.brain-reset-header {
  background: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  padding: 0.35rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1e40af;
  text-align: center;
}

.brain-reset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: #bfdbfe;
}

.brain-reset-col {
  background: #ffffff;
  padding: 0.45rem 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brain-reset-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.brain-reset-text {
  display: flex;
  flex-direction: column;
}

.brain-reset-label {
  font-size: 0.85rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.02em;
}

.brain-reset-sub {
  font-size: 0.675rem;
  font-weight: 600;
  color: #64748b;
}

/* =========================================================================
   OPTION 2 ALIGNED SUB-STEP SYSTEM (Stacked Blocks + 4-Column Grids)
   ========================================================================= */

.step-blocks-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

/* Step Card Block */
.step-card-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.step-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
}

.step-card-title {
  font-size: 0.775rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0f172a;
}

.step-card-title.warmup-cyan { color: #0284c7; }
.step-card-title.iron-blue { color: #1976d2; }
.step-card-title.pair-blue { color: #1976d2; }
.step-card-title.emergency-crimson { color: #dc2626; }

.step-card-meta {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Step Sub-Rows (Option 2 Stacked Alignment) */
.step-sub-rows {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.45rem;
  gap: 0.35rem;
}

.step-sub-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
}

.sub-pill-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: #475569;
  white-space: nowrap;
  flex-shrink: 0;
  width: 84px;
  text-align: center;
}

.sub-pill-val {
  display: inline-flex;
  align-items: center;
  font-weight: 750;
  font-size: 0.825rem;
  letter-spacing: -0.01em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  color: #0f172a;
}

/* Category Accent Colors for Secondary Value Pills */
.sub-pill-val.warmup-cyan {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.sub-pill-val.iron-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.sub-pill-val.pair-blue {
  background: #f5f3ff;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.sub-pill-val.emergency-crimson {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.sub-pill-val strong {
  font-weight: 800;
}

/* 4-Column Equal Delta Grid (Strict Horizontal Alignment) */
.grid4-block {
  background: var(--bg-subtle);
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
}

.grid4-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.grid4-step-tag {
  font-size: 0.75rem;
  font-weight: 800;
  color: #1976d2;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.grid4-step-sub {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grid4-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.grid4-col {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 0.35rem 0.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.grid4-col.iron { border-color: #bfdbfe; background: #f8faff; }
.grid4-col.wood { border-color: #a7f3d0; background: #f6fdf9; }
.grid4-col.driver { border-color: #fde68a; background: #fffdf5; }
.grid4-col.wedge { border-color: #ddd6fe; background: #faf8ff; }

.grid4-hdr {
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.grid4-hdr.iron { color: #1e40af; }
.grid4-hdr.wood { color: #065f46; }
.grid4-hdr.driver { color: #92400e; }
.grid4-hdr.wedge { color: #5b21b6; }

.grid4-val {
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.grid4-val strong {
  font-weight: 800;
}

/* Continuous Section Divider */
.section-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 1.25rem 0;
  width: 100%;
}

/* Flat Rule of Thumb */
.rule-of-thumb-box {
  background: #ffffff;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

/* Flat Rationale Affordance Bar */
.rationale-action-bar {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-open-rationale {
  background: transparent;
  border: none;
  color: var(--accent-iron);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0;
  transition: color 0.12s ease;
}

.btn-open-rationale:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* ==========================================================================
   FLAT STICKY BOTTOM THUMB CONTROLLER
   ========================================================================== */

.bottom-controller {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
  padding: 0.5rem 0.85rem calc(env(safe-area-inset-bottom, 0.4rem) + 0.4rem) 0.85rem;
}

.controller-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.btn-bottom-book {
  flex: 2;
  background: #0f172a;
  color: #ffffff !important;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.65rem 0.85rem;
  border-radius: 6px;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
  transition: opacity 0.12s ease;
}

.btn-bottom-book:hover, .btn-bottom-book:active {
  opacity: 0.88;
}

.btn-bottom-top {
  flex: 1;
  max-width: 100px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-body);
  font-size: 0.825rem;
  font-weight: 750;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease;
}

.btn-bottom-top:hover, .btn-bottom-top:active {
  background: var(--bg-hover);
}

.btn-nav-control {
  flex: 1;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.65rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.12s ease;
}

.btn-nav-control:active {
  background: var(--bg-hover);
}

.btn-nav-control.primary {
  background: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.btn-nav-control.primary:active {
  background: #1e293b;
}

.card-counter {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0 0.4rem;
}

/* ==========================================================================
   FLAT SLIDE-UP RATIONALE DRAWER
   ========================================================================== */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.rationale-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  background: #ffffff;
  border-top: 1px solid var(--border-strong);
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-backdrop.open .rationale-sheet {
  transform: translateY(0);
}

.drawer-header {
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-drag-handle {
  width: 32px;
  height: 3px;
  background: #cbd5e1;
  border-radius: 2px;
  margin: 0.4rem auto 0 auto;
}

.drawer-title-group h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.drawer-title-group span {
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--accent-iron);
}

.btn-close-drawer {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 4px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-body {
  padding: 1.15rem;
  overflow-y: auto;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-body);
}

.drawer-snippet {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.7;
  color: #1e293b;
  margin-bottom: 1.15rem;
}

.btn-read-full-chapter {
  display: block;
  text-align: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  text-decoration: none;
  margin-top: 0.85rem;
  transition: background 0.12s ease;
}

.btn-read-full-chapter:hover {
  background: var(--bg-hover);
}
