/* tools/mccready/css/mccready.css
   MacCready Speed-to-Fly — Skyout Paragliding

   Direction: "instrument fascia on a warm field page."
   The readout and the polar chart share one dark navy slab — the instrument you
   read in flight — set into the warm daylight page the rest of skyoutpg.com uses.
   Every label is stamped in mono like instrument labelling; Fraunces appears
   exactly once, in the masthead. The recap table is a cockpit card: the artifact
   an XC pilot actually prints and straps to the cockpit.
*/

:root {
  --color-primary:      #1D3557;
  --color-primary-dark: #0F2035;
  --color-accent:       #C8521A;
  --color-accent-light: #E8784A;
  /* Same clay, darkened for small text on light backgrounds: #C8521A only
     reaches 3.98:1 there, which is fine for the display italic but not for
     11–18px labels, links, or the live slider values. */
  --color-accent-ink:   #A8420F;
  --color-sky:          #3D8FCE;
  --color-sky-light:    #88C4E4;
  --color-valley:       #6B9E4A;
  --color-bg:           #F4F1EB;
  --color-bg-alt:       #EAE6DE;
  --color-surface:      #FFFFFF;
  --color-text:         #1A1614;
  --color-text-muted:   #6E6259;
  --color-text-light:   #9E958C;
  --color-border:       #DDD8D0;
  --color-border-dark:  #C4BDB3;
  --font-heading: 'Fraunces', Georgia, serif;
  --font-body:    'Epilogue', 'Helvetica Neue', sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 12px;

  /* Plot area of the 480x280 SVG viewBox (PAD l48 r16 t16 b32), as percentages.
     The SVG is width-driven with a fixed aspect ratio, so these stay aligned. */
  --plot-l: 10%;
  --plot-r: 3.3333%;
  --plot-t: 5.7143%;
  --plot-b: 11.4286%;
}

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

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

a {
  color: var(--color-accent-ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 82, 26, 0.35);
  padding-bottom: 1px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover { color: var(--color-primary); border-bottom-color: var(--color-primary); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Shell ──────────────────────────────────────────────── */

.mc-app {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 2.5rem) 5rem;
}

.mc-band {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
  margin-top: clamp(2rem, 4vw, 3rem);
}

/* Desktop: the rail carries what you set and what you take away (conditions,
   then the cockpit card); the instrument runs full height beside them.
   Source order stays conditions → readout → card, which is also the right
   reading order once the columns collapse. */
@media (min-width: 900px) {
  .mc-band--work {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    align-content: start;
  }
  .mc-band--work .mc-controls   { grid-column: 1; grid-row: 1; }
  /* start-aligned so the slab ends where the chart ends — no dead navy space */
  .mc-band--work .mc-instrument { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
  .mc-band--work .mc-card       { grid-column: 1; grid-row: 2; }
}

/* ── Masthead ───────────────────────────────────────────── */

.mc-masthead {
  max-width: 44rem;
  border-bottom: 1px solid var(--color-border-dark);
  padding-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.mc-eyebrow {
  margin: 0 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-accent-ink);
}

.mc-masthead h1 {
  margin: 0 0 1.25rem;
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 7vw, 4.25rem);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.03em;
  color: var(--color-primary-dark);
}
.mc-masthead h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--color-accent);
}

.mc-deck {
  margin: 0;
  max-width: 38rem;
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  color: var(--color-text-muted);
}

/* ── Stamped panel labels ───────────────────────────────── */

.mc-panel-label {
  margin: 0 0 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ── Conditions rail ────────────────────────────────────── */

.mc-controls {
  align-self: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

.mc-field { margin-bottom: 1.75rem; }

.mc-field > label,
.mc-slider__head label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-primary-dark);
}

.mc-field > label { margin-bottom: 0.5rem; }

.mc-select { position: relative; }
.mc-select::after {
  content: '';
  position: absolute;
  right: 0.9rem;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.mc-select select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 0.7rem 2.5rem 0.7rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-primary-dark);
  background: var(--color-bg);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.mc-select select:hover { border-color: var(--color-accent); }

.mc-sliders {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1.75rem;
}

.mc-slider__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.mc-slider__value {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent-ink);
  white-space: nowrap;
}
.mc-slider__value .mc-unit {
  margin-left: 0.35em;
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

/* Zero detent, drawn under the track where the centre scale label sits. */
.mc-track { position: relative; padding-bottom: 0.5rem; }
.mc-track--centred::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1px;
  height: 6px;
  background: var(--color-border-dark);
}

.mc-track input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.mc-track input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
}
.mc-track input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
}

.mc-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 22px;
  margin-top: -10px;
  border-radius: 2px;
  background: var(--color-primary-dark);
  border-top: 4px solid var(--color-accent);
  box-shadow: 0 1px 3px rgba(15, 32, 53, 0.35);
}
.mc-track input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 22px;
  border-radius: 2px;
  background: var(--color-primary-dark);
  border: 0;
  border-top: 4px solid var(--color-accent);
  box-shadow: 0 1px 3px rgba(15, 32, 53, 0.35);
}

.mc-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
/* The detent tick already de-emphasises the centre label; colour can't, since
   these endpoints are the only thing naming each slider's range. */

/* ── The instrument ─────────────────────────────────────── */

.mc-instrument {
  /* Scoped palette. chart.js draws with var(--color-sky) / var(--color-accent);
     re-binding them here retunes the SVG for the dark slab without touching JS. */
  --panel-bg:      var(--color-primary-dark);
  --panel-ink:     #FFFFFF;
  /* Alphas are floors set by contrast, not taste: over #0F2035 these composite
     to ~7.6:1 (dim) and ~5.0:1 (faint), so even the 10px mono labels clear
     WCAG AA for normal-weight body text. */
  --panel-dim:     rgba(255, 255, 255, 0.68);
  --panel-faint:   rgba(255, 255, 255, 0.50);
  --panel-line:    rgba(255, 255, 255, 0.13);
  --color-sky:     var(--color-sky-light);
  --color-accent:  var(--color-accent-light);

  background: var(--panel-bg);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--panel-ink);
}

.mc-instrument .mc-panel-label {
  color: var(--panel-faint);
  margin-bottom: 0.75rem;
}

.mc-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-md);
}

.mc-stat-card {
  padding: 1rem 1.25rem 1.15rem;
  min-width: 0;
}

.mc-stat-card > span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--panel-faint);
}

.mc-stat-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 0.35rem;
  color: var(--panel-ink);
}
.mc-stat-value small {
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--panel-dim);
}

/* Primary readout: the whole point of the page. */
.mc-stat-card:first-child {
  position: relative;
  grid-column: 1 / -1;
  padding: 1.35rem 1.25rem 2.4rem;
  border-bottom: 1px solid var(--panel-line);
}
.mc-stat-card:first-child .mc-stat-value {
  font-size: clamp(2.75rem, 9vw, 4rem);
  color: var(--color-accent-light);
  margin-top: 0.5rem;
}
.mc-stat-card:first-child .mc-stat-value small {
  font-size: 0.875rem;
  color: var(--panel-dim);
}
.mc-stat-card:nth-child(3) { border-left: 1px solid var(--panel-line); }

/* Reserved slot, so the full-bar note never shifts the panel. */
.mc-stat-sub {
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 0.95rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--color-accent-light);
}

/* ── Polar chart ────────────────────────────────────────── */

.mc-figure { margin: 1.5rem 0 0; }

.mc-plot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
}

.mc-plot__y,
.mc-plot__x {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--panel-faint);
}
.mc-plot__y {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.mc-plot__x {
  grid-column: 2;
  grid-row: 2;
  text-align: center;
  padding-top: 0.35rem;
}

/* The frame is drawn on the real plot area of the SVG, not around the box. */
.mc-plot__area {
  position: relative;
  grid-column: 2;
  grid-row: 1;
}
.mc-plot__area::before {
  content: '';
  position: absolute;
  left: var(--plot-l);
  right: var(--plot-r);
  top: var(--plot-t);
  bottom: var(--plot-b);
  border-left: 1px solid var(--panel-line);
  border-bottom: 1px solid var(--panel-line);
  pointer-events: none;
}

.mc-chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.mc-figure__caption {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--panel-line);
}
.mc-figure__caption p {
  margin: 0.6rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--panel-dim);
  max-width: 34rem;
}

.mc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mc-legend__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--panel-dim);
}
.mc-legend__item::before {
  content: '';
  width: 22px;
  height: 0;
  flex: none;
}
/* Same variables chart.js draws with, so the swatches track the curve through
   the panel's scoped palette and the print retune. */
.mc-legend__item--polar::before   { border-top: 2px solid var(--color-sky); }
.mc-legend__item--tangent::before { border-top: 2px dashed var(--color-accent); }

/* ── Cockpit card ───────────────────────────────────────── */

.mc-card {
  position: relative;
  align-self: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
}
/* Cut line: this is meant to leave the screen. */
.mc-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  pointer-events: none;
}

.mc-card > * { position: relative; }

.mc-card .mc-panel-label { margin-bottom: 0.4rem; }

.mc-card__note {
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

#mc-recap-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* The caption restates what .mc-card__note already says visibly above the
   table — keep it in the accessibility tree only, not doubled on screen. */
#mc-recap-table caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#mc-recap-table th {
  padding: 0 0.5rem 0.55rem;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: right;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-dark);
}
#mc-recap-table th:first-child { text-align: left; padding-left: 0; }
#mc-recap-table th:last-child  { padding-right: 0; }

#mc-recap-table td {
  padding: 0.5rem 0.5rem;
  font-size: 0.9375rem;
  text-align: right;
  border-bottom: 1px solid var(--color-border);
}
#mc-recap-table td:first-child {
  text-align: left;
  padding-left: 0;
  color: var(--color-text-muted);
}
#mc-recap-table td:last-child {
  padding-right: 0;
  font-weight: 500;
  color: var(--color-primary-dark);
}
#mc-recap-table tbody tr:last-child td { border-bottom: 0; }

/* ── Sources ────────────────────────────────────────────── */

.mc-notes {
  display: grid;
  gap: 0 clamp(1.25rem, 2.5vw, 2rem);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid var(--color-border-dark);
}
@media (min-width: 900px) {
  .mc-notes { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
  .mc-notes .mc-panel-label { grid-column: 1 / -1; }
}

.mc-source-list {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--color-border);
}
.mc-source-list li {
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}
.mc-source-list em { color: var(--color-text); }

.mc-notes__body p {
  margin: 0 0 0.85rem;
  max-width: 34rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

/* ── Narrow screens ─────────────────────────────────────── */

/* Narrow panels wrap the full-bar note onto a second line — deepen the
   reserved slot so it still clears the readout. */
@media (max-width: 700px) {
  .mc-stat-card:first-child { padding-bottom: 3.7rem; }
}

@media (max-width: 460px) {
  .mc-results { grid-template-columns: 1fr; }
  .mc-stat-card:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--panel-line);
  }
  .mc-plot__y { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}

/* ── Print: the cockpit card, on paper ──────────────────── */

@media print {
  body { background: #fff; }
  .mc-app { padding: 0; max-width: none; }
  .mc-instrument {
    --panel-bg: #fff;
    --panel-ink: #1A1614;
    --panel-dim: #6E6259;
    --panel-faint: #6E6259;
    --panel-line: #C4BDB3;
    --color-sky: #1D3557;
    --color-accent: #C8521A;
    border: 1px solid var(--color-border-dark);
  }
  .mc-stat-card:first-child .mc-stat-value { color: var(--color-accent); }
  .mc-card, .mc-instrument, .mc-controls { break-inside: avoid; }
  .mc-notes { display: none; }
}
