/* components.css — every named component in the app.
 * Values come from tokens.css. No raw colours or sizes here — only
 * structural rules that reference token variables. */

/* ── Ascent row (session detail climb list) ─────────────── */

.ascent-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  margin-bottom: 6px;
}

.ascent-row .grade-tile {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  background: var(--ink); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
  flex-shrink: 0;
}

.ascent-row[data-result="flash"]   .grade-tile { background: var(--amber); color: var(--ink); }
.ascent-row[data-result="send"]    .grade-tile { background: var(--blue); }
.ascent-row[data-result="project"] .grade-tile { background: var(--red); }
.ascent-row[data-result="repeat"]  .grade-tile { background: var(--ink-3); }

.ascent-row .ascent-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

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

.ascent-row .ascent-actions a {
  font-size: 0.8rem;
  color: var(--ink-3);
}

.ascent-row .ascent-actions button {
  height: auto;
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  box-shadow: none;
  border-radius: var(--r-chip);
}

/* ── Empty state ─────────────────────────────────────────── */

.empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--r-card);
  padding: 2.5rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--ink-3);
}

.empty .empty-label {
  font-weight: 500;
  font-size: 1rem;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
}

.empty .empty-hint {
  font-size: 0.875rem;
  max-width: 260px;
}

/* ── Stat card ───────────────────────────────────────────── */

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 18px var(--pad-card);
  display: flex;
  gap: 0;
}

.stat-card .stat {
  flex: 1;
  padding-inline: 12px;
  border-right: 1px solid var(--line-soft);
}

.stat-card .stat:first-child { padding-left: 4px; }
.stat-card .stat:last-child  { border-right: none; }

.stat-card .stat .v {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-card .stat .l {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

/* ── Result option cards (ascent form) ───────────────────── */

.result-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.ascent-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;

  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-input);
  cursor: pointer;
  transition: border-color 0.1s, box-shadow 0.1s;
}

.ascent-result .result-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  color: var(--white);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}

.ascent-result[data-result="flash"]   .result-icon { background: var(--amber); color: var(--ink); }
.ascent-result[data-result="send"]    .result-icon { background: var(--blue); }
.ascent-result[data-result="project"] .result-icon { background: var(--red); }
.ascent-result[data-result="repeat"]  .result-icon { background: var(--ink-3); }

.ascent-result .result-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ascent-result .result-label { font-weight: 600; font-size: 15px; color: var(--ink); }
.ascent-result .result-desc  { font-size: 11px; color: var(--ink-3); }

/* Selected — border colour matches the result accent */
.ascent-result[data-result="flash"][aria-selected="true"]   { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.ascent-result[data-result="send"][aria-selected="true"]    { border-color: var(--blue);  box-shadow: 0 0 0 3px var(--blue-soft); }
.ascent-result[data-result="project"][aria-selected="true"] { border-color: var(--red);   box-shadow: 0 0 0 3px var(--red-soft); }
.ascent-result[data-result="repeat"][aria-selected="true"]  { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--line); }

/* ── Attempts stepper ────────────────────────────────────── */

.stepper {
  margin-top: 10px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  display: flex;
  align-items: center;
}

.stepper .stepper-label { flex: 1; font-size: 14px; color: var(--ink-2); }
.stepper .stepper-ctrl  { display: flex; align-items: center; gap: 14px; }

.stepper .stepper-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--line-soft); color: var(--ink);
  font-family: var(--font-mono); font-weight: 600; font-size: 18px;
  border: none; box-shadow: none; padding: 0;
  line-height: 1;
}

.stepper .stepper-btn.inc { background: var(--ink); color: var(--white); }
.stepper .stepper-btn:disabled { opacity: 0.3; }

.stepper .stepper-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 20px;
  min-width: 28px;
  text-align: center;
}

/* ── Color tile grid (ascent form) ───────────────────────── */

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 1.25rem;
}

.color-tile {
  aspect-ratio: 1;
  border-radius: var(--r-tile);
  border: none;
  outline: 3px solid transparent;
  outline-offset: 2px;
  padding: 8px;
  cursor: pointer;
  box-shadow: none;
  display: flex;
  align-items: flex-end;
  transition: outline-color 0.12s;
}

.color-tile[aria-selected="true"] { outline-color: var(--ink); }

.color-tile .tile-label {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--white);
  text-shadow: 0 1px 3px var(--ink-overlay);
  pointer-events: none;
  line-height: 1.2;
}

/* Inline swatch dot (location list, ascent row) */
.color-swatch-sm {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  vertical-align: middle;
  margin-right: 0.3rem;
  flex-shrink: 0;
}

/* ── Drag handle (color reorder) ─────────────────────────── */

.drag-handle {
  cursor: grab;
  color: var(--ink-3);
  user-select: none;
  font-size: 1.1rem;
}

.drag-handle:active { cursor: grabbing; }

/* ── Grade pyramid (stats) ───────────────────────────────── */

.pyramid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 28rem;
  margin-top: 0.75rem;
}

.pyramid-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pyramid-grade {
  width: 2.5rem;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}

.pyramid-bar-wrap {
  flex: 1;
  background: var(--line-soft);
  border-radius: 3px;
  height: 1.25rem;
  overflow: hidden;
}

.pyramid-bar {
  height: 100%;
  border-radius: 3px;
  min-width: 4px;
}

.pyramid-bar--flash   { background: var(--amber); }
.pyramid-bar--send    { background: var(--blue); }
.pyramid-bar--repeat  { background: var(--ink-3); }
.pyramid-bar--project { background: var(--red); }

.pyramid-count {
  width: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-3);
  flex-shrink: 0;
}

/* ── Color preset picker ─────────────────────────────────── */

.color-picker-wrap {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  padding: 0;
  cursor: pointer;
  box-shadow: none;
  outline: 2.5px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.1s, transform 0.12s;
  flex-shrink: 0;
}

.color-preset[aria-selected="true"] {
  outline-color: var(--rust);
  transform: scale(1.15);
}

.color-preset--custom {
  background: var(--line-soft);
  border-style: dashed;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Table card wrapper ──────────────────────────────────── */

.table-card {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}

.table-card table { margin: 0; }

.table-card tbody tr:last-child td { border-bottom: none; }

/* ── Session row (sessions list) ────────────────────────── */

.session-row {
  display: grid;
  grid-template-columns: auto 6rem 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  margin-bottom: 6px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.12s;
}

.session-row:hover { border-color: var(--ink-3); }

.session-row .session-date {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
}

.session-row .session-loc {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--ink);
}

.session-row .session-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

/* ── Grade chips (ascent form) ───────────────────────────── */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1.25rem;
}

.grade-chip {
  min-width: 48px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}

.grade-chip[aria-selected="true"] {
  background: var(--rust);
  color: var(--bg);
  border-color: var(--rust);
  box-shadow: 0 6px 16px -8px var(--rust);
}

.grade-chip[hidden] { display: none; }

/* ── RPE chip (1–10 intensity scale) ────────────────────── */

.rpe-chip {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}

/* Unselected tints — hint at intensity zone */
.rpe-chip[data-rpe="4"],
.rpe-chip[data-rpe="5"],
.rpe-chip[data-rpe="6"] {
  border-color: color-mix(in oklab, var(--amber), var(--line) 50%);
  color: var(--amber);
}
.rpe-chip[data-rpe="7"],
.rpe-chip[data-rpe="8"],
.rpe-chip[data-rpe="9"],
.rpe-chip[data-rpe="10"] {
  border-color: color-mix(in oklab, var(--red), var(--line) 50%);
  color: var(--red);
}

/* Selected states */
.rpe-chip[aria-selected="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}
.rpe-chip[data-rpe="4"][aria-selected="true"],
.rpe-chip[data-rpe="5"][aria-selected="true"],
.rpe-chip[data-rpe="6"][aria-selected="true"] {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}
.rpe-chip[data-rpe="7"][aria-selected="true"],
.rpe-chip[data-rpe="8"][aria-selected="true"],
.rpe-chip[data-rpe="9"][aria-selected="true"],
.rpe-chip[data-rpe="10"][aria-selected="true"] {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
  box-shadow: 0 4px 12px -6px var(--red);
}

/* ── Form section spacing ────────────────────────────────── */

.form-section { margin-bottom: 1.25rem; }

/* ── Page header (title + action button row) ─────────────── */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h1 { margin: 0; }

/* ── Result colour utilities (stats numbers) ─────────────── */

.result-flash   { color: var(--amber); }
.result-send    { color: var(--blue); }
.result-repeat  { color: var(--ink-3); }
.result-project { color: var(--red); }

/* ── Ascent list controls (sort + filter chips) ──────────── */

.ascent-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 0.75rem;
}

.ascent-controls .ctrl-sep {
  width: 1px;
  height: 18px;
  background: var(--line);
  flex-shrink: 0;
}

.ctrl-chip {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--card);
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.1s, background 0.1s, color 0.1s;
}

.ctrl-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.ctrl-chip[data-filter="flash"].active   { background: var(--amber);  border-color: var(--amber);  color: var(--ink); }
.ctrl-chip[data-filter="send"].active    { background: var(--blue);   border-color: var(--blue);   color: var(--white); }
.ctrl-chip[data-filter="project"].active { background: var(--red);    border-color: var(--red);    color: var(--white); }
.ctrl-chip[data-filter="repeat"].active  { background: var(--ink-3);  border-color: var(--ink-3);  color: var(--white); }

/* ── choss brand — wordmark ──────────────────────────────── */
.wordmark { display: inline-flex; align-items: center; gap: 8px; }
.wordmark-rock { width: 22px; height: 24px; flex-shrink: 0; overflow: visible; }
.wordmark-rock .hold-body  { fill: var(--ink); }
.wordmark-rock .hold-inner { fill: var(--bg); }
.wordmark-rock .hold-bolt  { fill: var(--rust); }
.wordmark-text {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.045em;
  color: var(--ink);
  line-height: 1;
}

/* Rust period — voice accent on page titles + wordmark */
.dot { color: var(--rust); }

/* ── Menu glyphs in the top nav ──────────────────────────── */
.nav-ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 5px; }
.act-ic { width: 15px; height: 15px; vertical-align: middle; }
header nav a { color: var(--ink-2); display: inline-flex; align-items: center; }
header nav a:hover,
header nav a[aria-current="page"] { color: var(--rust); }

/* ── Page voice — terse title + mono deck ────────────────── */
.page-title {
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1.02;
  margin: 0 0 0.25rem;
  color: var(--ink);
}
.page-deck {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin: 0 0 1.5rem;
}

/* ── Session pip — organic hold, shape alternates per row ── */
.session-pip {
  width: 16px; height: 16px;
  background: var(--pip, var(--ink-3));
  -webkit-mask: var(--m-round) center / contain no-repeat;
          mask: var(--m-round) center / contain no-repeat;
  flex-shrink: 0;
  align-self: center;
}
.session-pip[data-shape="elong"] {
  width: 18px; height: 11px;
  -webkit-mask-image: var(--m-elong); mask-image: var(--m-elong);
}
.session-pip[data-shape="point"] {
  width: 15px; height: 16px;
  -webkit-mask-image: var(--m-point); mask-image: var(--m-point);
}

/* ── Hold-type glyphs (filled silhouettes) ───────────────── */
.hold-ic {
  width: 18px; height: 18px;
  display: inline-block;
  flex-shrink: 0;
  color: var(--ink-2);
  vertical-align: middle;
}
.hold-ic path { fill: currentColor; stroke: none; }

/* ── Stroke glyphs (wall angle + movement) ───────────────── */
.line-ic {
  width: 20px; height: 20px;
  display: inline-block;
  flex-shrink: 0;
  color: var(--ink-2);
  vertical-align: middle;
}
.line-ic .mv {
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.line-ic .solid {
  fill: currentColor; stroke: var(--line); stroke-width: 1;
  stroke-linejoin: round; vector-effect: non-scaling-stroke;
}
.line-ic .ground {
  fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; opacity: 0.28;
  vector-effect: non-scaling-stroke;
}
.line-ic .mv-fill { fill: currentColor; stroke: none; }

/* Glyph cluster in an ascent row's meta line */
.ascent-glyphs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: middle;
}
.ascent-glyphs .hold-ic,
.ascent-glyphs .line-ic { width: 16px; height: 16px; }
