/* Winter Dragon dashboard: the alpine-route system (sketched in sketches/dashboard/).
   The white-blue-white marker means "you are here" or "chosen", nothing else. */

:root {
  --snow: #f4f7f9;
  --paper: #ffffff;
  --granite: #26323b;
  --slate: #5e6b74;
  --line: #c3cfd6;
  --ice: #dce8ef;
  --route: #1e5aa0;
  --route-dark: #174680;
  --ember: #b83a2b;

  --font: "Archivo", system-ui, sans-serif;
  --narrow: 72%;

  /* 1.25 scale on a 17px base */
  --step-0: 1.0625rem;
  --step-1: 1.328rem;
  --step-2: 1.66rem;
  --step-3: 2.075rem;
  --step-4: 2.594rem;
  --step-5: 3.6rem;

  --radius-panel: 8px;
  --radius-control: 4px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { background: var(--snow); color: var(--granite); }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.5;
}

h1, h2, h3, h4 {
  margin: 0;
  font-stretch: var(--narrow);
  font-weight: 700;
  line-height: 1.1;
}

p { margin: 0; }

a { color: var(--route); text-underline-offset: 0.2em; }

:focus-visible { outline: 3px solid var(--route); outline-offset: 3px; }

code {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.9em;
}

.measure { max-width: 34rem; }
.secondary { color: var(--slate); }

/* The route marker */

.marker {
  display: inline-block;
  flex: none;
  width: 1.6rem;
  height: 0.95rem;
  border: 1px solid var(--line);
  background: linear-gradient(var(--paper) 0 33%, var(--route) 33% 67%, var(--paper) 67%);
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-height: 4.25rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.wordmark {
  font-size: var(--step-1);
  font-stretch: 62%;
  font-weight: 800;
  color: var(--granite);
  text-decoration: none;
}

.site-nav { display: flex; gap: 1.5rem; align-self: stretch; }

.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--granite);
  text-decoration: none;
  font-weight: 500;
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset: auto -0.4rem -1px -0.4rem;
  height: 6px;
  background: linear-gradient(90deg, var(--paper) 0 20%, var(--route) 20% 80%, var(--paper) 80%);
  border-inline: 1px solid var(--line);
}

.account {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-inline-start: auto;
  font-weight: 500;
}

.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--route);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
}

/* Buttons and fields */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.2rem;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button-primary { background: var(--route); color: var(--paper); }
.button-primary:hover { background: var(--route-dark); }
.button-quiet { background: var(--paper); color: var(--granite); border-color: var(--line); }
.button-quiet:hover { border-color: var(--slate); }
.button-danger { background: var(--ember); color: var(--paper); }
.button-small { padding: 0.35rem 0.7rem; font-size: 0.9rem; }

.field { display: grid; gap: 0.35rem; }
.field label, .field legend { font-weight: 600; padding: 0; }
.field-hint { font-size: 0.9rem; color: var(--slate); }

.input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--granite);
  font: inherit;
}

.input:hover { border-color: var(--slate); }
textarea.input { resize: vertical; min-height: 6rem; }

.choices { display: flex; flex-wrap: wrap; gap: 0.4rem; border: 0; margin: 0; padding: 0; }
.choices legend { margin-bottom: 0.35rem; }

.choice input { position: absolute; opacity: 0; }

.choice span {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  cursor: pointer;
}

.choice input:checked + span {
  border-color: var(--route);
  box-shadow: inset 0 -3px 0 var(--route);
  font-weight: 600;
}

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

/* Page frame */

.page {
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem) 5rem;
}

.page-title { font-size: var(--step-4); margin-bottom: 0.75rem; }
.page-lead { font-size: var(--step-1); line-height: 1.4; color: var(--slate); max-width: 36rem; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  padding: 1.5rem;
}

.site-footer {
  padding: 2rem clamp(1rem, 4vw, 3rem);
  border-top: 1px solid var(--line);
  color: var(--slate);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

/* Landing */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  min-height: calc(100vh - 4.5rem);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 1.5rem;
  padding: 3rem clamp(1rem, 5vw, 5rem);
}

.hero-title { font-size: clamp(var(--step-4), 5.4vw, 4.6rem); font-stretch: 62%; font-weight: 800; line-height: 0.98; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.terrain {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--ice);
}

.terrain-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.terrain-lines path { fill: none; stroke: #b9cfdb; stroke-width: 1.4; }

.signpost { position: relative; width: min(30rem, 86%); padding-block: 1rem 6rem; }

.signpost-pole {
  position: absolute;
  inset: 0 auto 0 50%;
  width: 1.1rem;
  translate: -50% 0;
  background: var(--granite);
}

.signpost-plate {
  position: relative;
  margin: 0 auto 1.25rem;
  width: fit-content;
  padding: 0.6rem 1.2rem;
  background: var(--paper);
  border: 2px solid var(--granite);
  text-align: center;
}

.signpost-plate strong { display: block; font-size: var(--step-1); font-stretch: 62%; font-weight: 800; }
.signpost-plate span { font-size: 0.85rem; color: var(--slate); }

.signpost-arms { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }

.arm {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 88%;
  padding: 0.85rem 2.6rem 0.85rem 1.1rem;
  background: var(--paper);
  color: var(--granite);
  text-decoration: none;
  clip-path: polygon(0 0, calc(100% - 1.7rem) 0, 100% 50%, calc(100% - 1.7rem) 100%, 0 100%);
  transform-origin: 50% 50%;
  transition: translate 160ms ease-out;
}

.arm-right { margin-inline-start: 12%; }

.arm-left {
  flex-direction: row-reverse;
  padding: 0.85rem 1.1rem 0.85rem 2.6rem;
  clip-path: polygon(1.7rem 0, 100% 0, 100% 100%, 1.7rem 100%, 0 50%);
}

.arm-name { font-size: var(--step-2); font-stretch: var(--narrow); font-weight: 700; line-height: 1; }
.arm-time { margin-inline-start: auto; color: var(--slate); font-stretch: var(--narrow); font-size: var(--step-1); white-space: nowrap; }
.arm-left .arm-time { margin-inline: 0 auto; }

.arm-right:hover { translate: 6px 0; }
.arm-left:hover { translate: -6px 0; }
.arm:focus-visible { outline-offset: -3px; }

@keyframes swing-in {
  from { rotate: -7deg; opacity: 0; }
  to { rotate: 0deg; opacity: 1; }
}

.signpost-arms li { animation: swing-in 520ms cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.signpost-arms li:nth-child(2) { animation-delay: 90ms; }
.signpost-arms li:nth-child(3) { animation-delay: 180ms; }
.signpost-arms li:nth-child(4) { animation-delay: 270ms; }

.features {
  max-width: 76rem;
  margin: 0 auto;
  padding: 4rem clamp(1rem, 4vw, 3rem);
}

.features h2 { font-size: var(--step-3); margin-bottom: 2rem; }

.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2rem 3rem;
  margin: 0;
}

.feature-list dt { font-size: var(--step-1); font-stretch: var(--narrow); font-weight: 700; }
.feature-list dt code { font-stretch: 100%; font-weight: 400; color: var(--slate); font-size: 0.75em; margin-inline-start: 0.4rem; }
.feature-list dd { margin: 0.35rem 0 0; color: var(--slate); }

/* Your data */

.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-block: 2.5rem;
}

.profile .avatar { width: 3.5rem; height: 3.5rem; font-size: 1.2rem; }
.profile-name { font-size: var(--step-2); font-stretch: var(--narrow); font-weight: 700; }

.records { border-top: 1px solid var(--line); }
.record { border-bottom: 1px solid var(--line); }

.record summary {
  display: grid;
  grid-template-columns: 14rem 1fr auto;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.1rem 0.25rem;
  cursor: pointer;
  list-style: none;
}

.record summary::-webkit-details-marker { display: none; }
.record-name { font-size: var(--step-1); font-stretch: var(--narrow); font-weight: 700; }
.record-toggle { color: var(--route); font-weight: 600; }
.record[open] .record-toggle-show, .record:not([open]) .record-toggle-hide { display: none; }

.record-body { padding: 0 0.25rem 1.5rem 15.75rem; }

.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th { text-align: left; font-weight: 600; color: var(--slate); padding: 0.4rem 1rem 0.4rem 0; border-bottom: 1px solid var(--line); }
.table td { padding: 0.55rem 1rem 0.55rem 0; border-bottom: 1px solid var(--ice); vertical-align: top; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.danger-zone {
  margin-top: 4rem;
  padding: 2rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--ember);
  border-radius: var(--radius-panel);
  background: var(--paper);
  display: grid;
  gap: 1rem;
  max-width: 46rem;
}

.danger-zone h2 { font-size: var(--step-3); }
.danger-zone ul { margin: 0; padding-left: 1.2rem; }

.confirm { display: grid; gap: 1rem; padding-top: 0.5rem; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.audit { list-style: none; margin: 0; padding: 0; display: grid; }

.audit li {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--ice);
}

.audit .dot { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 2px solid var(--line); justify-self: center; }
.audit .done .dot { background: var(--route); border-color: var(--route); }

[hidden] { display: none !important; }

/* Reminders */

.reminders {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(19rem, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  margin-top: 3rem;
  align-items: start;
}

.route-day { font-size: var(--step-1); color: var(--slate); margin: 2rem 0 0.25rem 2.75rem; }
.route-day:first-child { margin-top: 0; }

.route-list { position: relative; }
.route { list-style: none; margin: 0; padding: 0; }

.route-list::before {
  content: "";
  position: absolute;
  inset: 3.4rem auto 2rem 0.75rem;
  border-left: 3px dotted var(--line);
}

.stop {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  padding-block: 0.9rem;
}

.stop-pin {
  position: relative;
  margin: 0.35rem 0 0 0.25rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--snow);
}

.stop-next .stop-pin { border: 0; border-radius: 0; width: 1.6rem; height: 0.95rem; margin: 0.45rem 0 0 0; }
.stop-next .stop-pin { border: 1px solid var(--line); background: linear-gradient(var(--paper) 0 33%, var(--route) 33% 67%, var(--paper) 67%); }

.stop-time { font-size: var(--step-2); font-stretch: var(--narrow); font-weight: 700; line-height: 1.1; }
.stop-text { margin-top: 0.3rem; max-width: 34rem; }
.stop-meta { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 0.6rem; font-size: 0.9rem; color: var(--slate); }
.stop-meta a { font-weight: 600; }
.stop-meta .remove { color: var(--ember); }

.repeat-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-control);
  background: var(--ice);
  color: var(--granite);
}

.add-form { position: sticky; top: 1.5rem; display: grid; gap: 1.25rem; }
.add-form h2 { font-size: var(--step-2); }
.when-row { display: grid; grid-template-columns: 1fr 9.5rem; gap: 0.5rem; }

/* Tournament */

.tournament-head {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 3rem;
  align-items: end;
  justify-content: space-between;
}

.status-line { display: flex; align-items: center; gap: 0.6rem; font-weight: 600; margin-top: 0.75rem; }

.live-dot { width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--route); box-shadow: 0 0 0 4px #1e5aa033; }

.facts { display: flex; gap: 2.5rem; margin: 0; }
.facts div { display: grid; }
.facts dt { color: var(--slate); font-size: 0.9rem; }
.facts dd { margin: 0; font-size: var(--step-2); font-stretch: var(--narrow); font-weight: 700; }

.tournament-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18rem;
  gap: 2.5rem;
  margin-top: 3rem;
  align-items: start;
}

.bracket-scroll { overflow-x: auto; padding-bottom: 1rem; }

.bracket {
  display: grid;
  grid-template-columns: repeat(3, minmax(11rem, 1fr)) minmax(7rem, 0.6fr);
  gap: 2.5rem;
  min-width: 44rem;
}

.round { display: flex; flex-direction: column; }
.round h3 { font-size: var(--step-1); margin-bottom: 1rem; }
.round-body { flex: 1; display: flex; flex-direction: column; min-height: 30rem; }

.pair { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: space-around; }

/* the bracket arm joining a pair to the match it feeds */
.pair::after {
  content: "";
  position: absolute;
  top: 25%;
  bottom: 25%;
  right: -1.25rem;
  width: 1.25rem;
  border: 2px solid var(--line);
  border-left: 0;
}

.round-final .pair::after { display: none; }

.match {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
}

.round + .round .match::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -1.25rem;
  width: 1.25rem;
  border-top: 2px solid var(--line);
}

.match-live { border-color: var(--route); box-shadow: 0 0 0 1px var(--route); }

.match-head { display: flex; justify-content: space-between; padding: 0.3rem 0.7rem; font-size: 0.8rem; color: var(--slate); border-bottom: 1px solid var(--ice); }
.match-live .match-head { color: var(--route); font-weight: 600; }

.team { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.7rem; }
.team + .team { border-top: 1px solid var(--ice); }
.team-name { flex: 1; }
.team-won .team-name { font-weight: 700; }
.team-lost .team-name { color: var(--slate); text-decoration: line-through; text-decoration-color: var(--line); }
.team-tbd .team-name { color: var(--slate); font-style: italic; }
.team .marker { width: 1.2rem; height: 0.7rem; }

.summit { display: flex; flex-direction: column; }
.summit h3 { font-size: var(--step-1); margin-bottom: 1rem; }
.summit-body { flex: 1; display: grid; place-items: center start; min-height: 30rem; }

.summit-flag { display: grid; gap: 0.4rem; justify-items: start; color: var(--slate); }

.summit-peak {
  width: 6rem;
  height: 4rem;
  background: var(--ice);
  clip-path: polygon(0 100%, 42% 18%, 55% 36%, 68% 0, 100% 100%);
}

.side { display: grid; gap: 1.5rem; }
.side h2 { font-size: var(--step-1); margin-bottom: 0.75rem; }
.organiser { display: grid; gap: 0.9rem; }
.organiser-actions { display: grid; gap: 0.5rem; }
.organiser .button { justify-content: center; }

.teams { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.teams li { display: grid; }
.teams strong { font-stretch: var(--narrow); font-size: 1.1rem; }
.teams span { font-size: 0.9rem; color: var(--slate); }
.teams .out strong { color: var(--slate); }

/* Small screens */

@media (max-width: 860px) {
  .hero, .reminders, .tournament-layout { grid-template-columns: 1fr; }
  .hero { min-height: 0; }
  .terrain { padding-block: 2rem; }
  .site-header { flex-wrap: wrap; gap: 1rem; }
  .site-nav { order: 3; width: 100%; overflow-x: auto; }
  .site-header { padding-block: 0.75rem 0; }
  .site-nav a { padding-block: 0.6rem; }
  .record summary { grid-template-columns: 1fr auto; }
  .record summary .secondary { grid-column: 1 / -1; grid-row: 2; }
  .record-body { padding-left: 0.25rem; }
  .add-form { position: static; }
  .site-header .button-quiet { display: none; }
  .arm-name { font-size: var(--step-1); }
  .arm-time { font-size: var(--step-0); }
  .signpost { width: min(30rem, 94%); }
}

@media (prefers-reduced-motion: reduce) {
  .signpost-arms li { animation: none; }
  .arm { transition: none; }
}

/* What the served pages add to the sketch: real forms where the sketch had links. */

img.avatar { object-fit: cover; }
.sign-out { display: inline; margin: 0; }
.stop-meta form { display: inline; margin: 0; }
.stop-meta button.remove { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; }
.field-error { font-size: 0.9rem; font-weight: 600; color: var(--granite); }
.input.every-days { display: inline-block; width: 4.5rem; padding: 0.2rem 0.4rem; }
.input.confirm-name { max-width: 20rem; }
.deletion-start { margin-top: 1rem; }
.audit { margin-top: 1rem; }
