/* ============================================================================
   Karvan Group — components
   Ruled, editorial, record-keeping. No cards, no shadows, no fills except
   the accent wash. Structure is carried by hairlines and space.
   ========================================================================== */

/* --- 1. masthead --------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule-strong);
}

.masthead__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s4) var(--s6);
  padding-block: var(--s4);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
  flex: 0 0 auto;
}

.wordmark__name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: var(--track-wordmark);
  text-transform: uppercase;
}

.wordmark__rule {
  width: 1px;
  height: 0.85em;
  background: var(--rule-strong);
  align-self: center;
}

.wordmark__suffix {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.sitenav {
  margin-left: auto;
}

.sitenav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  list-style: none;
  padding: 0;
}

.sitenav li {
  margin: 0;
}

.sitenav a {
  display: inline-block;
  padding-block: 0.4rem;
  min-height: 24px;
  font-size: var(--t-sm);
  color: var(--ink-muted);
  text-decoration: none;
}

.sitenav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

.sitenav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* --- 2. lifecycle badge -------------------------------------------------- */

.badge {
  display: inline-block;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.28rem 0.55rem;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-wash);
  white-space: nowrap;
}

/* --- 3. editorial spread: ledger rail + content -------------------------- */

.spread {
  display: grid;
  /* minmax(0,1fr) rather than the implicit auto: an auto track sizes to the
     widest child's min-content, which lets the scrollable table push the
     whole page wider than the viewport at 320px. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s5);
}

@media (min-width: 64rem) {
  .spread {
    grid-template-columns: var(--rail) minmax(0, 1fr);
    gap: var(--s7);
  }
}

.rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--s4);
  align-content: start;
}

@media (min-width: 64rem) {
  .rail {
    grid-template-columns: 1fr;
    gap: var(--s5);
  }
}

.rail__item {
  border-top: 1px solid var(--rule);
  padding-top: var(--s2);
}

.rail__key {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.rail__val {
  display: block;
  margin-top: 0.15rem;
  font-size: var(--t-sm);
  line-height: 1.4;
}

/* --- 4. hero ------------------------------------------------------------- */

.hero {
  padding-block: var(--s7) var(--s8);
}

.hero__display {
  font-size: var(--t-display);
  font-weight: 600;
  line-height: var(--lead-tight);
  letter-spacing: var(--track-display);
  margin: 0;
  max-width: none;
  text-wrap: balance;
}

.hero__display span {
  display: block;
}

.hero__display span + span {
  color: var(--ink-muted);
}

.hero__display span + span + span {
  color: var(--accent);
}

/* The status sentence is the most consequential line on the site. It gets a
   full-width rule above it and sits between the display and h2 in weight. */
.hero__status {
  margin-top: var(--s6);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule-strong);
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.375rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  max-width: 18ch;
}

.hero__lead {
  margin-top: var(--s4);
  font-size: var(--t-lead);
  line-height: var(--lead-lead);
  color: var(--ink-muted);
}

/* --- 5. sections --------------------------------------------------------- */

.section {
  border-top: 1px solid var(--rule-strong);
  padding-block: var(--s7);
}

.section:last-of-type {
  padding-bottom: var(--s8);
}

.section__title {
  margin-top: var(--s2);
}

/* A closing note after a section's content, distinct from the opening lead. */
.coda {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
  font-size: var(--t-sm);
  color: var(--ink-muted);
}

.lead {
  margin-top: var(--s4);
  font-size: var(--t-lead);
  line-height: var(--lead-lead);
  color: var(--ink-muted);
}

.lead + .body {
  margin-top: var(--s5);
}

.body > * + * {
  margin-top: var(--s4);
}

.body > h3 {
  margin-top: var(--s6);
}

.body > .table-scroll,
.body > figure {
  margin-top: var(--s6);
}

/* --- 6. statement (status, mission, legal) ------------------------------- */

.statement {
  border-left: 2px solid var(--accent);
  padding: var(--s1) 0 var(--s1) var(--s4);
  font-size: var(--t-lead);
  line-height: var(--lead-lead);
}

.statement p {
  max-width: 54ch;
}

.statement__source {
  display: block;
  margin-top: var(--s3);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* --- 7. ledger rows (the four directions, and fact rows) ----------------- */

.ledger {
  margin-top: var(--s5);
  border-top: 1px solid var(--rule-strong);
}

.ledger-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: var(--s2) var(--s4);
  padding-block: var(--s5);
  padding-left: var(--s3);
  border-bottom: 1px solid var(--rule);
  border-left: 2px solid transparent;
}

/* The accent bar hangs outside the measure only where there is room for it. */
@media (min-width: 64rem) {
  .ledger-row {
    padding-left: var(--s4);
    margin-left: calc(var(--s4) * -1);
  }
}

.ledger-row:hover,
.ledger-row:focus-within {
  border-left-color: var(--accent);
  background: var(--accent-wash);
}

.ledger-row__index {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  color: var(--ink-muted);
  padding-top: 0.45rem;
}

.ledger-row__main {
  min-width: 0;
}

.ledger-row__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}

.ledger-row__title {
  font-size: var(--t-h3);
  font-weight: 600;
}

.ledger-row__body {
  margin-top: var(--s3);
}

.ledger-row__body p {
  max-width: 58ch;
}

.ledger-row__now {
  margin-top: var(--s3);
  font-size: var(--t-sm);
  color: var(--ink-muted);
}

.ledger-row__now b {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink-muted);
  display: block;
}

/* --- 8. foundation diagram (HTML, not an image) -------------------------- */

.foundation {
  margin-top: var(--s6);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}

.foundation__band {
  padding: var(--s5);
  border-bottom: 1px solid var(--rule-strong);
  background: var(--accent-wash);
}

.foundation__band h3 {
  font-size: var(--t-h3);
}

.foundation__traits {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  list-style: none;
  padding: 0;
  margin-top: var(--s3);
}

.foundation__traits li {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--accent);
}

.foundation__grid {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 46rem) {
  .foundation__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 70rem) {
  .foundation__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.foundation__cell {
  padding: var(--s5);
  border-bottom: 1px solid var(--rule);
}

.foundation__cell:last-child {
  border-bottom: 0;
}

@media (min-width: 46rem) {
  .foundation__cell {
    border-right: 1px solid var(--rule);
  }

  .foundation__cell:nth-child(2n) {
    border-right: 0;
  }

  .foundation__cell:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (min-width: 70rem) {
  .foundation__cell {
    border-right: 1px solid var(--rule);
    border-bottom: 0;
  }

  .foundation__cell:nth-child(2n) {
    border-right: 1px solid var(--rule);
  }

  .foundation__cell:last-child {
    border-right: 0;
  }
}

.foundation__cell h4 {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink-muted);
}

.foundation__cell p {
  margin-top: var(--s2);
  font-size: var(--t-sm);
}

/* --- 9. corridor schematic ----------------------------------------------- */

.corridor {
  margin-top: var(--s6);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: var(--s5);
  background: var(--surface);
}

.corridor svg {
  width: 100%;
  max-width: 22rem;
  margin-inline: auto;
  color: var(--ink);
}

.corridor .node {
  fill: var(--surface);
  stroke: var(--ink);
  stroke-width: 1.5;
}

.corridor .node--focus {
  fill: var(--accent);
  stroke: var(--accent);
}

.corridor .spine,
.corridor .link {
  stroke: var(--ink);
  stroke-width: 1.5;
  fill: none;
}

.corridor .link--soft {
  stroke: var(--rule-strong);
  stroke-dasharray: 3 4;
}


.corridor .t {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  fill: var(--ink);
}

.corridor .t--muted {
  fill: var(--ink-muted);
  font-size: 9.5px;
}

/* --- 10. notice (honest limits, cautions) -------------------------------- */

.notice {
  margin-top: var(--s6);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: var(--s5);
}

.notice__title {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.notice p {
  margin-top: var(--s3);
}

/* --- 11. contact channels ------------------------------------------------ */

.channels {
  margin-top: var(--s5);
  border-top: 1px solid var(--rule-strong);
}

.channel {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s1);
  padding-block: var(--s4);
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 46rem) {
  .channel {
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: var(--s4);
    align-items: baseline;
  }
}

.channel__key {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.channel__val {
  min-width: 0;
}

/* --- 12. page navigation ------------------------------------------------- */

.pagenav {
  border-top: 1px solid var(--rule-strong);
  padding-block: var(--s6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5);
  justify-content: space-between;
}

.pagenav a {
  display: inline-block;
  min-height: 24px;
  text-decoration: none;
  max-width: 24rem;
}

.pagenav a:hover .pagenav__title {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.pagenav__key {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.pagenav__title {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--t-h3);
  font-weight: 600;
  color: var(--ink);
}

/* --- 13. footer ---------------------------------------------------------- */

.foot {
  margin-top: auto;
  border-top: 1px solid var(--rule-strong);
  padding-block: var(--s6) var(--s7);
  font-size: var(--t-sm);
  color: var(--ink-muted);
}

.foot__grid {
  display: grid;
  gap: var(--s5);
}

@media (min-width: 46rem) {
  .foot__grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: var(--s7);
  }
}

.foot__legal p {
  max-width: 52ch;
}

.foot__legal p + p {
  margin-top: var(--s3);
}

.foot nav ul {
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: var(--s5);
}

.foot nav li {
  margin: 0 0 var(--s2);
  break-inside: avoid;
}

.foot nav a {
  display: inline-block;
  min-height: 24px;
  padding-block: 0.15rem;
  color: var(--ink-muted);
  text-decoration: none;
}

.foot nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.foot__meta {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
}

/* --- 14. error page ------------------------------------------------------ */

.error {
  padding-block: var(--s9) var(--s10);
}

.error h1 {
  margin-top: var(--s3);
}

.error p {
  margin-top: var(--s4);
  font-size: var(--t-lead);
  color: var(--ink-muted);
}

/* --- 15. corridor strip (compact, used where the full schematic is not) -- */

.strip {
  list-style: none;
  padding: 0;
  margin-top: var(--s5);
  border-top: 1px solid var(--rule-strong);
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 40rem) {
  .strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 0;
  }
}

.strip li {
  margin: 0;
  padding: var(--s4) var(--s4) var(--s4) 0;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 40rem) {
  .strip li {
    border-top: 1px solid var(--rule-strong);
    border-bottom: 0;
    position: relative;
  }

  /* the corridor line: a hairline joining the four points */
  .strip li::before {
    content: "";
    position: absolute;
    top: -4px;
    left: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ground);
    border: 1.5px solid var(--ink);
  }

  .strip li:first-child::before,
  .strip li:last-child::before {
    background: var(--accent);
    border-color: var(--accent);
  }
}

.strip__key {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

.strip__val {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--t-h3);
  font-weight: 600;
}

/* --- 16. interior page header -------------------------------------------- */

.pagehead {
  padding-block: var(--s7);
}

.pagehead h1 {
  max-width: 20ch;
}

.pagehead .lead {
  margin-top: var(--s5);
  max-width: 58ch;
}

/* --- 17. touch targets ---------------------------------------------------
   Links that stand alone as a value or a list item are not covered by the
   WCAG 2.2 inline exception, so they are padded to clear 24px. Links inside
   running prose keep their natural inline box. */

.rail__val a,
.channel__val a,
.pagenav a,
.error .channel__val a {
  display: inline-block;
  padding-block: 0.2rem;
  min-height: 24px;
}
