/* Highside preview: shared styles for the gate and every door.
   Palette and type from docs/product-state.md. Straw is an accent used only on
   rules, the plate and the Highside row. */

:root {
  --ink: #0F1011;
  --bone: #E8E3D8;
  --alu: #A9AEB2;
  --straw: #C9A55C;
  --measure: 68ch;
  --gutter: 1.25rem;
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

p,
li,
dt,
dd,
td,
th,
caption {
  text-wrap: pretty;
}

/* Display type: Archivo at expanded width. */
.wordmark,
h1,
h2,
.row-name {
  font-family: "Archivo", "IBM Plex Sans", sans-serif;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Plates and small print: IBM Plex Mono. */
.plate,
.credit,
.gates,
.label,
.clip-still {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.wordmark {
  font-weight: 800;
  letter-spacing: 0.18em;
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem);
  line-height: 1.15;
  margin: 0.4em 0;
}

h2 {
  font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.8rem);
  line-height: 1.2;
  margin: 0 0 0.8em;
}

/* One calm column. */
main > section,
footer {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main > section {
  padding-block: 3.5rem;
}

.rule {
  display: block;
  width: 4rem;
  height: 0;
  margin: 0 auto;
  border: 0;
  border-top: 1px solid var(--straw);
}

.plate {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35em 0.7em;
  border: 1px solid var(--straw);
  color: var(--bone);
}

.muted,
.label {
  color: var(--alu);
}

/* Clips: a 16:9 frame in the night grade with an Ink vignette, never interactive. */
.clip {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background: var(--ink);
  margin-bottom: 1.5rem;
}

.clip iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  filter: grayscale(.85) contrast(1.05) brightness(.85);
  pointer-events: none;
}

.clip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, var(--ink) 100%);
  pointer-events: none;
}

.clip-still {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--alu);
  background: var(--ink);
  border: 1px solid rgba(169, 174, 178, 0.18);
}

.clip-still[hidden] {
  display: none;
}

/* Hero: the line sits over the lower edge of the clip on wide screens. */
.hero .lede {
  font-size: 1.15rem;
  margin: 0 0 1.25rem;
}

.ride .line {
  margin: 0 0 0.35em;
}

.ride .coda,
.where .coda,
.field .coda,
.moves .coda {
  margin-top: 1.5rem;
}

.word .pos {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 400;
  color: var(--alu);
  font-size: 0.7em;
}

/* Where it goes. */
.where dl {
  margin: 0;
}

.where dt {
  font-weight: 600;
  margin-top: 1.1rem;
}

.where dd {
  margin: 0.2rem 0 0;
}

/* The field. */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  color: var(--alu);
  padding-bottom: 0.9rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.75rem 0.7rem 0;
  border-top: 1px solid rgba(169, 174, 178, 0.25);
}

thead th {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--alu);
  border-top: 0;
}

tbody th {
  font-weight: 600;
}

tr.is-highside > * {
  border-top: 1px solid var(--straw);
}

/* How it moves: a chain of gates. */
.gates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.gates li + li::before {
  content: ">" / "";
  color: var(--alu);
  margin-right: 0.75rem;
}

.questions ol {
  padding-left: 1.4rem;
}

.questions li {
  margin-bottom: 0.8rem;
}

/* Gate page. */
.gate {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gate form {
  display: grid;
  gap: 0.6rem;
  max-width: 22rem;
  margin-top: 2rem;
}

label {
  font-size: 0.9rem;
  color: var(--bone);
}

input[type="password"] {
  font: inherit;
  color: var(--bone);
  background: transparent;
  border: 1px solid var(--alu);
  border-radius: 0;
  padding: 0.6rem 0.75rem;
}

button {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--bone);
  border: 0;
  border-radius: 0;
  padding: 0.65rem 1rem;
  cursor: pointer;
  justify-self: start;
}

.gate-error {
  min-height: 1.6em;
  margin: 0.5rem 0 0;
  color: var(--bone);
}

/* Focus: visible on every interactive element. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--bone);
  outline-offset: 3px;
}

/* Footer and the source credit. */
footer {
  padding-block: 3rem 5rem;
  color: var(--alu);
}

footer p {
  margin: 0.3rem 0;
  font-size: 0.9rem;
}

footer .plate {
  display: block;
  padding: 0;
  border: 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--alu);
}

footer .wordmark {
  color: var(--bone);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.credit {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: 28rem;
  margin: 0;
  padding: 0.3rem 0.5rem;
  font-size: 10px;
  line-height: 1.4;
  color: var(--alu);
  background: var(--ink);
  opacity: 0.8;
}

footer .credit {
  margin: 0;
}

@media (min-width: 768px) {
  .hero,
  .ride {
    position: relative;
  }

  .hero .clip {
    margin-bottom: 0;
  }

  .hero .hero-copy {
    position: relative;
    margin-top: -5.5rem;
    padding: 0 1.25rem;
    z-index: 1;
  }
}

/* Phones: one column, the table becomes stacked cards, the credit joins the footer flow. */
@media (max-width: 767.98px) {
  body {
    font-size: 1rem;
  }

  main > section {
    padding-block: 2.5rem;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  table,
  caption,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    padding: 0.9rem 0;
    border-top: 1px solid rgba(169, 174, 178, 0.25);
  }

  tbody th,
  tbody td {
    border-top: 0;
    padding: 0.15rem 0;
  }

  tbody th {
    font-family: "Archivo", "IBM Plex Sans", sans-serif;
    font-stretch: 125%;
    font-variation-settings: "wdth" 125;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--alu);
  }

  tr.is-highside {
    border-top: 1px solid var(--straw);
  }

  tr.is-highside > * {
    border-top: 0;
  }

  footer {
    padding-bottom: 2rem;
  }

  .credit {
    position: static;
    max-width: none;
    padding: 0;
    margin-top: 1rem;
  }
}

/* Reduced motion: the still panels stay; site.js never mounts the iframes. */
@media (prefers-reduced-motion: reduce) {
  .clip iframe {
    display: none;
  }

  .clip-still[hidden] {
    display: flex;
  }

  * {
    scroll-behavior: auto;
  }
}
