/* Niya Tech Labs - spec.css
   Single-word class names, no separators. State lives on [data-*]
   attributes rather than modifier classes. Light surface, mono texture. */

:root {
  --sheet: #F7F6F2;
  --sheetraised: #FFFFFF;
  --sheetsunk: #EEEDE7;
  --nib: #16181A;
  --nibsoft: #4E545A;
  --nibfaint: #838C93;
  --ruleline: #DBD9D1;
  --rulefirm: #C2BFB4;
  --wash: #2F6F5E;
  --washlift: #E4EFEA;
  --mark: #B4571F;
  --curve: 10px;
  --curvebig: 20px;
  --column: 66ch;
  --inset: clamp(1.25rem, 4vw, 3rem);
  --page: 1180px;
  --face: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --type: "Sometype Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--sheet);
  color: var(--nib);
  font-family: var(--face);
  font-size: 16.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--face);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.018em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }

a { color: var(--wash); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #1E5546; }

img, svg { max-width: 100%; height: auto; display: block; }

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

.bypass {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--wash);
  color: #FFFFFF;
  padding: 0.7rem 1.1rem;
  font-family: var(--type);
  font-weight: 600;
  z-index: 200;
}
.bypass:focus { left: 0; }

.leaf { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: var(--inset); }

/* ---------- masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 246, 242, 0.9);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--ruleline);
}
.mastrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 74px;
}
.mastsign { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--nib); flex-shrink: 0; }
.mastglyph { width: 30px; height: 30px; flex-shrink: 0; }
.mastword {
  font-family: var(--type);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.mastnav ul { display: flex; align-items: center; gap: 1.7rem; list-style: none; margin: 0; padding: 0; }
.mastlink {
  font-family: var(--type);
  font-size: 0.82rem;
  color: var(--nibsoft);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.mastlink:hover, .mastlink[data-here] { color: var(--nib); border-bottom-color: var(--wash); }

.mastcatch {
  display: none;
  background: none;
  border: 1px solid var(--rulefirm);
  border-radius: var(--curve);
  width: 40px; height: 40px; padding: 0;
  cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.mastbar { display: block; width: 16px; height: 1.5px; background: var(--nib); transition: transform 0.2s ease, opacity 0.2s ease; }
.mastcatch[aria-expanded="true"] .mastbar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.mastcatch[aria-expanded="true"] .mastbar:nth-child(2) { opacity: 0; }
.mastcatch[aria-expanded="true"] .mastbar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 880px) {
  .mastcatch { display: flex; }
  .mastnav {
    position: absolute; inset: 74px 0 auto 0;
    background: var(--sheetraised);
    border-bottom: 1px solid var(--ruleline);
    display: none;
    padding: 0.5rem var(--inset) 1.25rem;
  }
  .mastnav[data-open] { display: block; }
  .mastnav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .mastlink { display: block; padding: 0.9rem 0; border-bottom: 1px solid var(--ruleline); }
}

/* ---------- spine (persistent document sidebar) ---------- */

.spread {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}
@media (max-width: 1000px) { .spread { grid-template-columns: 1fr; } }

.spine {
  position: sticky;
  top: 98px;
  border: 1px solid var(--ruleline);
  border-radius: var(--curvebig);
  background: var(--sheetraised);
  padding: 1.3rem 1.2rem;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
}
@media (max-width: 1000px) { .spine { position: static; max-height: none; } }
.spinehead {
  font-family: var(--type);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nibfaint);
  margin-bottom: 0.85rem;
  font-weight: 600;
}
.spinelist { list-style: none; margin: 0; padding: 0; counter-reset: sq; }
.spinelist li { counter-increment: sq; }
.spinelink {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.35rem;
  padding: 0.38rem 0;
  color: var(--nibsoft);
  text-decoration: none;
  font-size: 0.86rem;
  line-height: 1.42;
}
.spinelink::before {
  content: "\00a7" counter(sq);
  font-family: var(--type);
  font-size: 0.72rem;
  color: var(--nibfaint);
  padding-top: 0.16rem;
}
.spinelink:hover { color: var(--wash); }

.recto { min-width: 0; }

/* ---------- rubric (document head) ---------- */

.rubric { margin-bottom: 2.4rem; }
.rubric h1 { font-size: clamp(2rem, 4.2vw, 2.85rem); margin-bottom: 0.95rem; }
.stamp {
  display: flex; flex-wrap: wrap; gap: 0.45rem 1.4rem;
  font-family: var(--type);
  font-size: 0.75rem;
  color: var(--nibfaint);
  margin-top: 1.4rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--ruleline);
}

/* ---------- signature (numbered section) ---------- */

.signature { margin-bottom: 2.6rem; scroll-margin-top: 98px; }
.signhead {
  display: grid;
  grid-template-columns: 3.1rem 1fr;
  gap: 0.4rem;
  font-size: clamp(1.22rem, 2.4vw, 1.55rem);
  margin-bottom: 0.95rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--ruleline);
}
.signno { font-family: var(--type); font-size: 0.85rem; color: var(--wash); padding-top: 0.32rem; }
.signbody { color: var(--nibsoft); max-width: var(--column); }
.signbody h3 { font-size: 1rem; font-weight: 700; color: var(--nib); margin: 1.55rem 0 0.5rem; }
.signbody ul, .signbody ol { padding-left: 1.15rem; margin: 0 0 1.05em; }
.signbody li { margin-bottom: 0.46rem; }
.signbody strong { color: var(--nib); font-weight: 700; }
.signbody a { overflow-wrap: anywhere; }

.marginalia {
  border: 1px solid var(--rulefirm);
  border-left: 3px solid var(--wash);
  border-radius: var(--curve);
  background: var(--washlift);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  color: var(--nib);
}
.marginalia p:last-child { margin-bottom: 0; }

/* ---------- paginal (tables) ---------- */

.paginalwrap {
  overflow-x: auto;
  margin: 1.35rem 0;
  border: 1px solid var(--ruleline);
  border-radius: var(--curve);
  background: var(--sheetraised);
  -webkit-overflow-scrolling: touch;
}
.paginal { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 34rem; }
.paginal caption {
  text-align: left;
  padding: 0.8rem 0.95rem;
  font-family: var(--type);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--nibfaint);
  border-bottom: 1px solid var(--ruleline);
}
.paginal th, .paginal td { padding: 0.68rem 0.95rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--ruleline); }
.paginal thead th {
  font-family: var(--type);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--nib);
  font-weight: 600;
  background: var(--sheetsunk);
}
.paginal tbody tr:last-child td { border-bottom: 0; }
.paginal td { color: var(--nibsoft); }

/* ---------- quire (marketing section) ---------- */

.quire { padding-block: clamp(3.25rem, 7.5vw, 5.75rem); }
.quire[data-tone="raised"] { background: var(--sheetraised); border-block: 1px solid var(--ruleline); }
.quire[data-tone="sunk"] { background: var(--sheetsunk); border-block: 1px solid var(--ruleline); }

.quirehead { max-width: 47rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.quiretitle { font-size: clamp(1.75rem, 3.6vw, 2.55rem); margin-bottom: 0.85rem; }
.quireline { color: var(--nibsoft); max-width: var(--column); }

.gloss {
  display: inline-block;
  font-family: var(--type);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wash);
  margin-bottom: 0.95rem;
  font-weight: 600;
}

.opener { padding-block: clamp(4rem, 10vw, 7rem) clamp(3rem, 7vw, 5rem); }
.openertitle { font-size: clamp(2.3rem, 5.4vw, 3.9rem); margin-bottom: 1.25rem; max-width: 20ch; }
.openerline { font-size: clamp(1.02rem, 1.9vw, 1.2rem); color: var(--nibsoft); max-width: 42rem; margin-bottom: 2.1rem; }
.openeracts { display: flex; flex-wrap: wrap; gap: 0.8rem; }

/* ---------- catchword (buttons) ---------- */

.catchword {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.78rem 1.4rem;
  border-radius: 999px;
  font-family: var(--type);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.catchword[data-fill] { background: var(--wash); color: #FFFFFF; }
.catchword[data-fill]:hover { background: #1E5546; color: #FFFFFF; }
.catchword[data-line] { border-color: var(--rulefirm); color: var(--nib); }
.catchword[data-line]:hover { border-color: var(--wash); color: var(--wash); }

/* ---------- keyvalue spec block ---------- */

.keyvalue { border-top: 1px solid var(--ruleline); margin: 0; }
.keyvalue > div {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.8rem;
  border-bottom: 1px solid var(--ruleline);
}
@media (max-width: 620px) { .keyvalue > div { grid-template-columns: 1fr; gap: 0.15rem; } }
.keyvalue dt { font-family: var(--type); font-size: 0.8rem; color: var(--nibfaint); }
.keyvalue dd { margin: 0; color: var(--nib); min-width: 0; }

/* ---------- swatch strip (accessibility demo) ---------- */

.swatchset { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 0.85rem; }
.swatch {
  border: 1px solid var(--ruleline);
  border-radius: var(--curvebig);
  background: var(--sheetraised);
  padding: 1.3rem 1.25rem;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(22, 24, 26, 0.05);
}
.swatchbar { height: 8px; border-radius: 99px; margin-bottom: 0.95rem; }
.swatchname { font-size: 1.02rem; margin-bottom: 0.4rem; }
.swatchnote { font-size: 0.88rem; color: var(--nibsoft); margin: 0; }
.ratio {
  font-family: var(--type);
  font-size: 0.74rem;
  color: var(--nibfaint);
  margin-top: 0.6rem;
  display: block;
}

/* ---------- verso (side column on marketing pages) ---------- */

.duo { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(2rem, 5vw, 4.25rem); align-items: start; }
@media (max-width: 880px) { .duo { grid-template-columns: 1fr; } }

.verso { max-width: var(--column); }
.verso h2 { font-size: clamp(1.5rem, 3vw, 1.95rem); margin: 2.4rem 0 0.85rem; }
.verso h3 { font-size: 1.1rem; margin: 1.8rem 0 0.55rem; }
.verso > :first-child { margin-top: 0; }
.verso ul, .verso ol { color: var(--nibsoft); padding-left: 1.15rem; margin: 0 0 1.05em; }
.verso li { margin-bottom: 0.42rem; }
.verso strong { color: var(--nib); font-weight: 700; }
.standout { font-size: 1.1rem; color: var(--nibsoft); }

/* ---------- colophon (footer) ---------- */

.colophon {
  background: var(--sheetsunk);
  border-top: 1px solid var(--ruleline);
  padding-block: clamp(2.5rem, 6vw, 3.75rem) 1.85rem;
  font-size: 0.9rem;
}
.colophongrid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(auto-fit, minmax(140px, 1fr));
  gap: 2.1rem;
  margin-bottom: 2.25rem;
}
@media (max-width: 700px) { .colophongrid { grid-template-columns: 1fr 1fr; } }
.colophonbrand { grid-column: 1 / -1; }
@media (min-width: 701px) { .colophonbrand { grid-column: auto; } }
.colophonsign { display: inline-flex; align-items: center; gap: 0.55rem; margin-bottom: 0.85rem; }
.colophonblurb { color: var(--nibfaint); max-width: 26rem; }
.colophontitle {
  font-family: var(--type);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nibfaint);
  margin-bottom: 0.8rem;
  font-weight: 600;
}
.colophoncol ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.colophoncol a { color: var(--nibsoft); text-decoration: none; }
.colophoncol a:hover { color: var(--wash); }
.colophonlegal {
  border-top: 1px solid var(--ruleline);
  padding-top: 1.6rem;
  color: var(--nibfaint);
  font-size: 0.82rem;
  line-height: 1.7;
  display: grid;
  gap: 0.45rem;
}
.colophonlegal p { margin: 0; }

/* ---------- reveal ---------- */

@media (prefers-reduced-motion: no-preference) {
  .settle { opacity: 0; transform: translateY(12px); transition: opacity 0.45s ease, transform 0.45s ease; }
  .settle[data-seen] { opacity: 1; transform: none; }
}

/* Measured four-step luminance ramp. Hues differ, but the separation that
   does the work is luminance: 0.020 / 0.115 / 0.335 / 0.849, giving 2.33:1
   to 2.36:1 between neighbours. That is close to the 2.76:1 ceiling for any
   even four-step ramp, and short of 3:1, which is why the spec requires a
   shape difference as well rather than treating colour as sufficient. */
.swatchone   { background: #00245A; }
.swatchtwo   { background: #046D4D; }
.swatchthree { background: #F37C0F; }
.swatchfour  { background: #FEEDB2; border: 1px solid var(--rulefirm); }
