/* cove — a shallow tide.
   Editorial element language (body.v2 from variants.css) skinned to paper / slate.
   One accent, one hairline, radius 0. The field is the ground; type sits on it. */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.cove {
  --g: #f6f2e7;
  --paper: #f6f2e7;
  --ink: #191710;
  --mute: #332f26;
  --rule: #cec5b0;
  --rule-hi: #a49a83;
  --acc: #b3261e;
  --acc-ink: #f6f2e7;
  --wash-a: 120, 112, 92;
  --wash-b: 158, 148, 126;
  --field-alpha: 0.42;
  margin: 0;
  min-height: 100dvh;
  background: var(--g);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
  transition: background-color 260ms cubic-bezier(.2,.7,.3,1), color 260ms cubic-bezier(.2,.7,.3,1);
}
html { background: #f6f2e7; }
html:has(body.cove[data-mode="night"]) { background: #1c1c1c; }

/* night: charcoal grey, a neutral darkroom, not a slate or a warm inversion */
body.cove[data-mode="night"] {
  --g: #1c1c1c;
  --ink: #e8e5de;
  --mute: #a6a39c;
  --rule: #333333;
  --rule-hi: #4d4d4d;
  --acc: #dc6156;
  --acc-ink: #1c1c1c;
  --wash-a: 200, 200, 200;
  --wash-b: 120, 120, 120;
  --field-alpha: 0.30;
  color-scheme: dark;
  background: #1c1c1c;
  color: var(--ink);
}

/* ui.css tokens follow the same palette so the switch bars agree with the page */
body.cove[data-ui] {
  --ui-ground: var(--g);
  --ui-ink: var(--ink);
  --ui-muted: var(--mute);
  --ui-rule: var(--rule);
  --ui-rule-strong: var(--rule-hi);
  --ui-accent: var(--acc);
  --ui-accent-ink: var(--acc-ink);
  --ui-dur: 120ms;
  --ui-dur-slow: 180ms;
}

a { color: inherit; text-decoration: none; }

/* ---------- the field ---------- */

.cove-field {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: block;
  z-index: 0;
  pointer-events: none;
}

/* a flat paper/slate sheet under the canvas keeps text contrast exact in every mode */
.cove-wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--g);
}

/* ---------- frame ---------- */

.cove-frame {
  position: relative;
  z-index: 1;
  width: min(100% - 3rem, 78rem);
  margin-inline: auto;
  padding: 2.25rem 0 2rem;
  display: grid;
  gap: 0;
  min-height: 100dvh;
  align-content: start;
}

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

.cove-top { position: relative; text-align: center; padding-bottom: 1.1rem; }

/* the name is the identity layer: a Canvas 2D particle raster of the same word.
   The h1 keeps the layout and the accessible text; the canvas sits over it. */
.cove-name-wrap { position: relative; margin-top: .6rem; }
.cove-name { position: relative; z-index: 0; opacity: 1; transition: opacity 600ms cubic-bezier(.2,.7,.3,1); }
.cove-name-field {
  position: absolute;
  left: -2%;
  top: -18%;
  width: 104%;
  height: 136%;
  z-index: 1;
  display: none;
  pointer-events: none;
}
.cove-glyph-on .cove-name { opacity: 0; }
.cove-glyph-on .cove-name-field { display: block; }

/* the only control: the medium switch, top-right of the masthead */
.cove-mode { position: absolute; top: 0; right: 0; }

.cove-tag {
  margin: 0 0 1rem;
  font: 400 12px/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mute);
  display: flex;
  justify-content: center;
  gap: .8em;
}

.cove-name {
  margin: 0;
  font: 900 clamp(3.1rem, 1.1rem + 7vw, 7.2rem)/0.92 "Arial Black", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  color: var(--ink);
}

.cove-id {
  margin: .35rem auto 0;
  max-width: 58ch;
  font: 400 15px/1.55 var(--sans);
  color: var(--mute);
}

/* ---------- control ---------- */

.cove-theme { min-width: 0; }

/* ---------- index strip ---------- */

.cove-index { padding-top: 1.4rem; }

.cove-sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.cove-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}

.cove-col { display: flex; min-width: 0; }
.cove-col + .cove-col { border-left: 1px solid var(--rule); }

.cove-row {
  --_h: auto;
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: .5rem;
  width: 100%;
  min-height: 210px;
  padding: .85rem .9rem 1rem;
  margin: 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  transition: background-color 120ms cubic-bezier(.2,.7,.3,1);
}

.cove-row::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: transparent;
  transition: background-color 180ms cubic-bezier(.2,.7,.3,1);
}

.cove-row:is(:hover, .is-hover) { background-color: color-mix(in srgb, var(--ink) 4%, transparent); }
.cove-row:is(:active, .is-active) { background-color: color-mix(in srgb, var(--ink) 8%, transparent); }
.cove-row:focus-visible { outline: 2px solid var(--acc); outline-offset: -3px; }

.cove-row[aria-expanded="true"] .cove-nm,
.cove-col.is-open .cove-nm { color: var(--acc); }
.cove-row[aria-expanded="true"]::after,
.cove-col.is-open .cove-row::after { background: var(--acc); }

.cove-no {
  font: 400 12px/1 var(--mono);
  letter-spacing: .1em;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.cove-col.is-open .cove-no { color: var(--acc); }

.cove-nm {
  font: 400 1.35rem/1.05 var(--serif);
  letter-spacing: -.01em;
  color: var(--ink);
  transition: color 180ms cubic-bezier(.2,.7,.3,1);
}

.cove-ln {
  font: 400 13.5px/1.42 var(--sans);
  color: var(--mute);
  align-self: start;
}

/* the stack wraps onto its own lines at the stroke marks; the column keeps its
   width, so no long entry can push the strip past the frame */
.cove-mt {
  display: block;
  font: 400 12px/1.45 var(--mono);
  letter-spacing: .03em;
  color: var(--mute);
  border-top: 1px solid var(--rule);
  padding-top: .5rem;
  overflow-wrap: anywhere;
}
.cove-mt i, .cove-dl dd i { font-style: normal; color: var(--rule-hi); }

.cove-st {
  display: block;
  font: 400 12px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--mute);
  margin-top: .4rem;
}

/* ---------- detail sheet ---------- */

.cove-sheet { padding-top: 1.4rem; }

.cove-record {
  padding: .2rem 0 .1rem;
  animation: cove-in 180ms cubic-bezier(.2,.7,.3,1) both;
}
.cove-record[hidden] { display: none; }

/* no JS: the records are already in the document; hide the sheet, keep the mirror */
html:not(.cove-js) .cove-sheet,
html:not(.cove-js) .cove-index,
html:not(.cove-js) .cove-mode { display: none; }
/* no JS: the solid word must still fit the frame */
html:not(.cove-js) .cove-name { font-size: min(clamp(3.1rem, 1.1rem + 7vw, 7.2rem), 10vw); }
@keyframes cove-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

.cove-record-head {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid var(--ink);
}

.cove-record-head .cove-no { color: var(--acc); font-size: 13px; }

.cove-record-name {
  margin: 0;
  font: 400 clamp(1.7rem, 1rem + 1.6vw, 2.6rem)/1.02 var(--serif);
  letter-spacing: -.018em;
}

.cove-ref {
  margin-left: auto;
  font: 400 12px/1 var(--mono);
  letter-spacing: .06em;
  color: var(--acc);
  vertical-align: super;
}
.cove-ref a { border-bottom: 1px solid transparent; }
.cove-ref a:hover { border-bottom-color: var(--acc); }

.cove-record-line {
  margin: .85rem 0 0;
  max-width: 56ch;
  font: 400 1.05rem/1.5 var(--serif);
  color: var(--ink);
}

.cove-dl {
  margin: 1.1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
}
.cove-dl > div {
  padding: .7rem 1.1rem .8rem 0;
  border-bottom: 1px solid var(--rule);
  min-width: 0;
}
.cove-dl > div + div { border-left: 1px solid var(--rule); padding-left: 1.1rem; }
.cove-dl dt {
  font: 400 12px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: .5rem;
}
.cove-dl dd {
  margin: 0;
  font: 400 15px/1.35 var(--sans);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.cove-link {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 24px;
  padding-bottom: 2px;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  font: 400 14px/1 var(--sans);
  transition: color 120ms, border-color 120ms;
}
.cove-link::after {
  content: "→";
  font-size: .9em;
  transition: transform 120ms cubic-bezier(.2,.7,.3,1);
}
.cove-link:is(:hover, .is-hover) { color: var(--acc); border-bottom-color: var(--acc); }
.cove-link:is(:hover, .is-hover)::after { transform: translateX(2px); }
.cove-link:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

.cove-idle {
  margin: 0;
  padding: 1rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  font: 400 12px/1.5 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--mute);
}
.cove-idle[hidden] { display: none; }

/* ---------- foot ---------- */

.cove-foot {
  margin-top: auto;
  padding-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.6rem;
  border-top: 1px solid var(--rule);
}

/* ---------- no-JS ---------- */

.cove-nj {
  position: relative;
  z-index: 1;
  width: min(100% - 3rem, 78rem);
  margin: 0 auto 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--ink);
}
.cove-nj-note {
  margin: 0 0 .8rem;
  font: 400 12px/1.5 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--mute);
}
.cove-nj-rec { border-bottom: 1px solid var(--rule); padding: .55rem 0; }
.cove-nj-rec summary {
  cursor: pointer;
  font: 400 1.05rem/1.3 var(--serif);
  min-height: 28px;
}
.cove-nj-rec summary:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.cove-nj-rec p { margin: .5rem 0 0; font: 400 14px/1.5 var(--sans); }
.cove-nj-meta {
  font: 400 12px/1.5 var(--mono) !important;
  letter-spacing: .05em;
  color: var(--mute);
}
.cove-nj-meta a { border-bottom: 1px solid var(--rule); }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .cove-nm { font-size: 1.2rem; }
  .cove-ln { font-size: 13px; }
}

@media (max-width: 900px) {
  .cove-strip {
    grid-template-columns: minmax(0, 1fr);
    border-top: 1px solid var(--ink);
  }
  .cove-col + .cove-col { border-left: 0; border-top: 1px solid var(--rule); }
  .cove-row {
    grid-template-columns: 2.1rem minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    column-gap: .9rem;
    row-gap: .3rem;
    min-height: 0;
    padding: .8rem .2rem .85rem;
    align-items: baseline;
  }
  .cove-no { grid-row: 1 / span 3; grid-column: 1; align-self: start; padding-top: .15rem; }
  .cove-nm { grid-column: 2; }
  .cove-ln { grid-column: 2; text-align: left; }
  .cove-mt { grid-column: 2; border-top: 0; padding-top: 0; }
  .cove-st { grid-column: 3; grid-row: 1; justify-self: end; margin-top: 0; }
  .cove-row::after { display: none; }
}

@media (max-width: 620px) {
  .cove-frame { width: calc(100% - 1.6rem); padding-top: 1.5rem; }
  .cove-nj { width: calc(100% - 1.6rem); }
  .cove-name { font-size: clamp(2.45rem, 1rem + 9vw, 3.6rem); }
  .cove-id { font-size: 14px; max-width: 34ch; }
  .cove-mode { position: static; display: flex; justify-content: flex-end; margin: .1rem 0 .9rem; }
  .cove-tag { font-size: 12px; letter-spacing: .13em; }
  .cove-nm { font-size: 1.12rem; }
  .cove-ln { font-size: 13px; }
  .cove-dl { grid-template-columns: minmax(0, 1fr); }
  .cove-dl > div + div { border-left: 0; padding-left: 0; }
  .cove-record-name { font-size: 1.6rem; }
  .cove-record-line { font-size: 1rem; }
  .cove-foot { gap: .35rem 1.1rem; }
}

@media (max-width: 380px) {
  .cove-row { grid-template-columns: 1.9rem minmax(0, 1fr); }
  .cove-st { grid-column: 2; grid-row: 4; justify-self: start; }
  .cove-no { grid-row: 1 / span 4; }
}

@media (prefers-reduced-motion: reduce) {
  .cove-row, .cove-row::after, .cove-nm, .cove-name, .cove-name-field, .cove-link, .cove-link::after, .cove-record { transition: none !important; animation: none !important; }
  .cove-name { font-size: min(clamp(3.1rem, 1.1rem + 7vw, 7.2rem), 10vw); }
}

/* touch targets: the row carries 44 through its own height; the switches through ui.css */
@media (pointer: coarse) {
  .cove-row { min-height: 44px; }
  .cove-link { min-height: 44px; align-items: center; }
}
