/* Middle Way Management — middlewaymanagement.com
 *
 * The framework rejects being called "soft" (Percept #1) and "New Age"
 * (Percept #5), so the design refuses softness too: a cool indigo instead of
 * a warm accent, exact hairlines, a measuring instrument for a mark. Warmth
 * lives in the prose; structure lives in the page.
 *
 * Every colour is a token. There is no hard-coded hex below :root.
 */

:root {
  --paper:      #edeae3;  /* unbleached kozo, greyed rather than cream */
  --paper-deep: #e4e0d6;  /* quiet blocks */
  --ink:        #17191c;  /* sumi, faintly blue */
  --ink-soft:   #5c6169;  /* apparatus and secondary text */
  --rule:       #cfc9bc;  /* hairline — decoration only, never text */
  --faint:      #837e6e;  /* ghosted numerals; 3.4:1, the floor for large text */
  --indigo:     #2a3a6b;  /* the one accent: links, the datum */

  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --apparatus: "Barlow Semi Condensed", "Helvetica Neue", Arial, sans-serif;

  --measure: 34rem;
  --rail: 8.5rem;
  --gap: 2.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #14161a;
    --paper-deep: #1b1e24;
    --ink:        #e9e5db;
    --ink-soft:   #979da6;
    --rule:       #2f343b;
    --faint:      #6b727c;
    --indigo:     #9db0e4;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.0625rem;
  line-height: 1.72;
  font-weight: 400;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px; z-index: 10;
  background: var(--paper); color: var(--ink);
  padding: 0.6rem 1rem;
}
.skip:focus { left: 1rem; top: 1rem; }

/* --------------------------------------------------------------- apparatus
 * Condensed caps carry every label, number, and date. The serif is reserved
 * for thinking; this face is for measurement.
 */
.label,
.rail,
.masthead nav,
.masthead .wordmark,
.pager,
.field label,
button {
  font-family: var(--apparatus);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.155em;
  font-size: 0.7rem;
  line-height: 1.5;
}

.label { color: var(--ink-soft); display: block; }

/* ------------------------------------------------------------------ shell */
.wrap {
  width: 100%;
  max-width: calc(var(--rail) + var(--gap) + var(--measure));
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.spread {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  column-gap: var(--gap);
}
.spread > .rail { grid-column: 1; }
.spread > .measure { grid-column: 2; }

.rail {
  color: var(--ink-soft);
  padding-top: 0.55rem;
  text-align: right;
}
.rail > * + * { margin-top: 0.9rem; }
.rail .num {
  display: block;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  font-weight: 400;
  color: var(--faint);
}

.measure > :first-child { margin-top: 0; }
.measure > :last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- masthead */
.masthead { border-bottom: 1px solid var(--rule); }
.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.4rem;
}
.masthead .wordmark {
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
}
.masthead .wordmark:hover { color: var(--indigo); }
.masthead nav { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.masthead nav a { color: var(--ink-soft); text-decoration: none; }
.masthead nav a:hover,
.masthead nav a[aria-current] { color: var(--indigo); }

/* ---------------------------------------------------------------- the axis
 * The signature. A graduated axis with the practice held at its centre —
 * the framework's own definition ("neither too controlling nor too lax")
 * drawn as the measuring instrument it eventually became.
 */
.axis { margin: 3.25rem 0 2.5rem; }
.axis-poles {
  display: flex;
  justify-content: space-between;
  font-family: var(--apparatus);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  color: var(--ink-soft);
}
.axis svg { display: block; width: 100%; height: auto; margin-top: 0.5rem; }
.axis .beam { stroke: var(--faint); }
.axis .tick { stroke: var(--rule); }
.axis .stop { stroke: var(--ink-soft); }
.axis .datum { stroke: var(--indigo); }
.axis .bead { fill: var(--indigo); }

.axis .marker { animation: settle 2.6s cubic-bezier(0.33, 0, 0.2, 1) both; }
.axis-caption {
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-top: 0.4rem;
  animation: arrive 0.9s ease-out 2.1s both;
}

/* Swings from one extreme to the other, then damps down to centre. */
@keyframes settle {
  0%   { transform: translateX(-455px); opacity: 0; }
  8%   { opacity: 1; }
  30%  { transform: translateX(445px); }
  52%  { transform: translateX(-185px); }
  72%  { transform: translateX(72px); }
  88%  { transform: translateX(-24px); }
  100% { transform: translateX(0); }
}
@keyframes arrive { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .axis .marker, .axis-caption { animation: none; opacity: 1; }
}

/* ------------------------------------------------------------------- hero */
.hero { padding-block: 4.25rem 1rem; }
.hero h1 {
  margin: 0;
  /* Capped to what the measure can actually hold — the wrap is 45rem, so a
     larger maximum would break the headline into ragged orphans. */
  font-size: clamp(2.05rem, 5vw, 3.5rem);
  font-weight: 200;
  line-height: 1.06;
  letter-spacing: -0.019em;
  text-wrap: balance;
}
.hero h1 em { font-style: italic; font-weight: 300; }
.lede {
  font-size: 1.2rem;
  line-height: 1.62;
  max-width: var(--measure);
}

/* ------------------------------------------------------------- typography */
h1, h2, h3 { font-weight: 400; letter-spacing: -0.011em; }

.page-title {
  margin: 0 0 0.6rem;
  font-size: clamp(1.95rem, 4.4vw, 3rem);
  font-weight: 300;
  line-height: 1.08;
  text-wrap: balance;
}
.dek { margin: 0; color: var(--ink-soft); font-size: 1.1rem; font-style: italic; }

.prose h2 {
  position: relative;
  margin: 2.6rem 0 0.7rem;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
}
/* The datum, reduced to a tick, marks every section of every essay. */
.prose h2::before {
  content: "";
  position: absolute;
  left: -1.25rem;
  top: 0.62em;
  width: 0.55rem;
  border-top: 2px solid var(--indigo);
}
.prose p { margin: 0 0 1.15rem; }
.prose ol, .prose ul { margin: 0 0 1.3rem; padding-left: 1.3rem; }
.prose li { margin-bottom: 0.55rem; }
.prose i, .prose em { font-style: italic; }
.prose b, .prose strong { font-weight: 600; }

@media (min-width: 46rem) {
  .prose h2::before { left: -2rem; width: 1.1rem; }
}

/* ---------------------------------------------------------------- signoff */
.signoff {
  margin-top: 2.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-style: italic;
  color: var(--ink-soft);
}
.signoff p { margin: 0 0 0.2rem; }
.signoff .name { font-style: normal; }

/* --------------------------------------------------------------- sections */
.band { padding-block: 3.25rem; border-top: 1px solid var(--rule); }

.door {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  column-gap: var(--gap);
  padding-block: 2rem;
  border-top: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.18s ease;
}
.door:first-child { border-top: 0; }
.door:hover { background: var(--paper-deep); }
.door .rail { padding-top: 0.45rem; }
.door h3 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.2;
}
.door:hover h3 { color: var(--indigo); }
.door p { margin: 0; color: var(--ink-soft); font-size: 1rem; line-height: 1.6; }

/* ----------------------------------------------------------------- essays */
.year {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, var(--measure));
  column-gap: var(--gap);
  padding-top: 2.4rem;
}
.year > h2 {
  grid-column: 1;
  position: sticky;
  top: 1.5rem;
  margin: 0;
  font-family: var(--apparatus);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  color: var(--faint);
  text-align: right;
}
.year > ol { grid-column: 2; margin: 0; padding: 0; list-style: none; }

.entry { border-top: 1px solid var(--rule); }
.entry:first-child { border-top: 0; }
.entry a { display: block; padding-block: 1.15rem; color: inherit; text-decoration: none; }
.entry a:hover .entry-title { color: var(--indigo); }
.entry-meta {
  display: flex;
  gap: 0.9rem;
  margin-bottom: 0.25rem;
  font-family: var(--apparatus);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.66rem;
  color: var(--ink-soft);
}
.entry-title { display: block; font-size: 1.2rem; line-height: 1.3; }
.entry-dek { margin: 0.2rem 0 0; color: var(--ink-soft); font-size: 0.97rem; line-height: 1.55; }

/* ------------------------------------------------------------------ pager */
.pager {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 3rem;
  border-top: 1px solid var(--rule);
}
.pager a {
  padding-block: 1.2rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  text-decoration: none;
}
.pager a span {
  display: block;
  margin-top: 0.3rem;
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: -0.005em;
  line-height: 1.3;
  color: var(--ink);
}
.pager a:hover span { color: var(--indigo); }
.pager .next { text-align: right; }

@media (min-width: 46rem) {
  .pager { grid-template-columns: 1fr 1fr; column-gap: var(--gap); }
}

/* ------------------------------------------------------------------- form */
.field { margin-bottom: 1.4rem; }
.field label { display: block; margin-bottom: 0.4rem; color: var(--ink-soft); }
.field input, .field textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font-family: var(--display);
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 0;
}
.field input:focus, .field textarea:focus { border-color: var(--indigo); }
.field textarea { min-height: 11rem; resize: vertical; }
.hp { position: absolute; left: -9999px; }

button {
  padding: 0.85rem 1.8rem;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  cursor: pointer;
  transition: background-color 0.18s ease;
}
button:hover { background: var(--indigo); }
button[disabled] { opacity: 0.55; cursor: default; }

.form-status { margin-top: 1rem; font-style: italic; color: var(--ink-soft); }
.form-status[data-state="error"] { color: var(--indigo); font-style: normal; }

/* ---------------------------------------------------------------- colophon */
.colophon {
  margin-top: 4.5rem;
  padding-block: 2.5rem 3.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.colophon .wrap > * + * { margin-top: 0.8rem; }
.colophon p { margin: 0; max-width: 40rem; }
.colophon nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.colophon a { color: var(--ink-soft); }
.colophon a:hover { color: var(--indigo); }
.colophon .fine { font-size: 0.82rem; }

/* ----------------------------------------------------------------- mobile
 * The rail folds up above the measure and stops shouting from the margin.
 */
@media (max-width: 45.99rem) {
  :root { --gap: 0rem; }
  .spread, .door, .year { grid-template-columns: minmax(0, 1fr); }
  .spread > .rail, .spread > .measure,
  .door > *, .year > * { grid-column: 1; }
  .rail, .year > h2 {
    position: static;
    padding-top: 0;
    margin-bottom: 0.7rem;
    text-align: left;
  }
  .rail > * + * { margin-top: 0.35rem; }
  .rail .num { display: inline; font-size: 1rem; }
  .year > h2 { font-size: 1.5rem; }
  .hero { padding-block: 3rem 0.5rem; }
  .axis-poles { font-size: 0.6rem; }
}

/* ------------------------------------------------------------- instrument
 * The assessment reuses the site's grammar rather than inventing a second
 * one: apparatus caps for every number and label, the datum for every value.
 */
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }

.notice {
  margin: 1.75rem 0 0;
  padding: 1.1rem 1.25rem;
  background: var(--paper-deep);
  border-left: 2px solid var(--indigo);
}
.notice p { margin: 0; font-size: 1rem; line-height: 1.6; }

/* ------------------------------------------------------------ the fork */
#step-level { padding-block: 3rem 0; }
#step-level h2 {
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 1.25rem;
}
.choices { display: grid; gap: 0; }
.choice { border-top: 1px solid var(--rule); }
.choice:last-child { border-bottom: 1px solid var(--rule); }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice label {
  display: block;
  padding: 1.1rem 1.1rem 1.1rem 2.4rem;
  position: relative;
  cursor: pointer;
  transition: background-color 0.16s ease;
}
.choice label::before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 1.45rem;
  width: 0.85rem;
  height: 0.85rem;
  border: 1px solid var(--ink-soft);
  border-radius: 50%;
}
.choice input:checked + label { background: var(--paper-deep); }
.choice input:checked + label::before {
  border-color: var(--indigo);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 1rem var(--indigo);
}
.choice input:focus-visible + label { outline: 2px solid var(--indigo); outline-offset: -2px; }
.choice label:hover { background: var(--paper-deep); }
.choice-label { display: block; font-size: 1.2rem; line-height: 1.3; }
.choice-help {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.97rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------- items */
.items { list-style: none; margin: 2.5rem 0 0; padding: 0; }
.item { border-top: 1px solid var(--rule); padding-block: 1.6rem; }
.item:last-of-type { border-bottom: 1px solid var(--rule); }
.item legend {
  font-size: 1.1rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  max-width: var(--measure);
}
.item-num {
  font-family: var(--apparatus);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--faint);
  margin-right: 0.5rem;
  vertical-align: 0.12em;
}
.item.unanswered { background: var(--paper-deep); }
.item.unanswered legend { text-decoration: underline wavy var(--indigo) 1px; text-underline-offset: 0.3em; }

.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.25rem;
  max-width: 30rem;
}
.point { text-align: center; }
.point input {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  margin: 0 auto 0.45rem;
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid var(--ink-soft);
  border-radius: 50%;
  cursor: pointer;
  transition: box-shadow 0.14s ease, border-color 0.14s ease;
}
.point input:hover { border-color: var(--indigo); }
.point input:checked {
  border-color: var(--indigo);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 1rem var(--indigo);
}
.point input:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.point label {
  display: block;
  font-family: var(--apparatus);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.6rem;
  line-height: 1.3;
  color: var(--ink-soft);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.progress {
  font-family: var(--apparatus);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin: 2rem 0 1rem;
}

/* -------------------------------------------------------------- results */
.band-label {
  font-family: var(--apparatus);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--indigo);
  margin: 0;
}
.band-score {
  font-size: clamp(3rem, 9vw, 4.5rem);
  font-weight: 200;
  line-height: 1;
  margin: 0.3rem 0 1rem;
  letter-spacing: -0.02em;
}
.band-max { font-size: 1.1rem; color: var(--ink-soft); letter-spacing: 0; }

.scores { list-style: none; margin: 1.75rem 0 0; padding: 0; }
.score { border-top: 1px solid var(--rule); padding-block: 1.25rem; }
.score:last-child { border-bottom: 1px solid var(--rule); }
.score-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.score-name { font-size: 1.12rem; }
.score-value {
  font-family: var(--apparatus);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.score-gloss { margin: 0.5rem 0 0; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.5; }

/* The same instrument as the masthead mark, carrying a measured value. */
.meter {
  position: relative;
  height: 1.5rem;
  margin-top: 0.6rem;
  border-top: 1px solid var(--faint);
}
.meter-tick {
  position: absolute;
  top: 0;
  width: 1px;
  height: 0.4rem;
  background: var(--rule);
}
.meter-tick:first-child, .meter-tick:last-child { height: 0.7rem; background: var(--ink-soft); }
.meter-datum {
  position: absolute;
  top: -0.42rem;
  width: 1.5px;
  height: 1.15rem;
  background: var(--indigo);
  transform: translateX(-50%);
}
.meter-datum::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.34rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--indigo);
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------ contribute */
.field select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  font-family: var(--display);
  font-size: 1.02rem;
  color: var(--ink);
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 0;
}
.field select:focus { border-color: var(--indigo); }

.field.consent {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
  margin-block: 1.5rem;
}
.field.consent input { margin-top: 0.34rem; width: 1.05rem; height: 1.05rem; accent-color: var(--indigo); }
.field.consent label {
  font-family: var(--display);
  text-transform: none;
  letter-spacing: normal;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

button.quiet {
  background: transparent;
  color: var(--ink-soft);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
button.quiet:hover { background: transparent; color: var(--indigo); }

@media (max-width: 45.99rem) {
  #step-level { padding-block: 2rem 0; }
  .scale { gap: 0.15rem; }
  .point label { font-size: 0.55rem; letter-spacing: 0.04em; }
}

/* Numbered guidance — the order is procedural, so the numerals are content. */
.guidance { list-style: none; margin: 1.5rem 0 0; padding: 0; counter-reset: step; }
.guidance li {
  counter-increment: step;
  position: relative;
  padding-left: 2.2rem;
  margin-bottom: 1.1rem;
  line-height: 1.62;
}
.guidance li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.28em;
  font-family: var(--apparatus);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--faint);
}
.guidance strong { font-weight: 600; }
