/*
 * Calming Motions
 * White Andale Mono on black. The animations supply the only colour.
 */

:root {
  --bg: #000;            /* page, drawing surface */
  --fg: #fff;            /* text and drawn marks */
  --fg-soft: #b3b3b3;    /* secondary text */
  --fg-faint: #8c8c8c;   /* tertiary text, disabled */
  --line: #333;          /* hairlines */
  --line-strong: #5c5c5c;/* control borders */
  --active: #1f1f1f;     /* the rule currently in use */
  --danger: #ff8a7a;

  --mono: "Andale Mono", AndaleMono, Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;

  --radius: 2px;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

h1, h2, h3 { font-weight: 400; line-height: 1.2; margin: 0; }

i, cite { font-style: italic; }

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

/* ---------- buttons and fields ---------- */

.btn {
  font: 0.8125rem/1 var(--mono);
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--fg); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-solid { background: var(--fg); color: var(--bg); border-color: var(--fg); min-width: 9.5rem; }
.btn-solid:hover:not(:disabled) { background: #ddd; }

.link-btn {
  font: 0.75rem/1 var(--mono);
  color: var(--fg-soft);
  background: none;
  border: 0;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-btn:hover:not(:disabled) { color: var(--fg); }
.link-btn:disabled { opacity: 0.4; cursor: default; }

select {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.45rem 0.5rem;
}

input[type="range"], input[type="checkbox"] { accent-color: var(--fg); }

/* ---------- home ---------- */

.hero {
  position: relative;
  min-height: min(92svh, 60rem);
  overflow: hidden;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.hero-fern {
  position: absolute;
  top: 0;
  right: 0;
  width: 56%;
  height: 100%;
}

.hero-text {
  position: relative;
  max-width: 38rem;
  padding: 4rem clamp(1.5rem, 6vw, 6rem);
}

.hero-logo {
  display: block;
  width: clamp(7rem, 12vw, 10rem);
  height: auto;
  margin-bottom: 2.25rem;
}

.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.hero p {
  font-size: clamp(0.95rem, 1.2vw, 1.05rem);
  line-height: 1.65;
  color: var(--fg-soft);
  max-width: 34ch;
  margin: 0 0 2.25rem;
}

.cta {
  display: inline-block;
  font: 0.9375rem/1 var(--mono);
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
  padding: 0.95rem 1.3rem;
  border-radius: var(--radius);
}
.cta:hover { background: #ddd; }

.catalogue {
  max-width: 48rem;
  margin: 0 auto;
  padding: 5rem 1.5rem 4rem;
}

.catalogue > h2 {
  font-size: 1.125rem;
  color: var(--fg-soft);
  margin-bottom: 1.75rem;
}

.entry {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0 1.5rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
}

.entry-plate {
  font-size: 0.8125rem;
  color: var(--fg-faint);
  padding-top: 0.35rem;
}

.entry h3 { font-size: 1.5rem; margin-bottom: 0.6rem; }
.entry h3 a { text-decoration: none; }
.entry h3 a:hover { text-decoration: underline; }
.entry p { margin: 0; max-width: 60ch; color: var(--fg-soft); }

.entry-soon h3 { color: var(--fg-faint); font-size: 1rem; padding-top: 0.2rem; }

/* ---------- lab (animation pages) ---------- */

.lab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 31rem;
  align-items: start;
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.plate {
  position: relative;
  flex: 1;
  min-height: 0;
}

.plate canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.plate-warning {
  position: absolute;
  z-index: 1;
  left: 1.5rem;
  right: 1.5rem;
  top: 1.5rem;
  margin: 0 auto;
  max-width: 32rem;
  padding: 1rem 1.2rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
}

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--fg-soft);
}

.count {
  font-size: 0.8125rem;
  margin-left: 0.4rem;
}

.transport-end { margin-left: auto; display: flex; gap: 0.6rem; }

.panel {
  padding: 1.5rem 1.75rem 3rem;
  border-left: 1px solid var(--line);
  min-height: 100vh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--fg-soft);
  margin-bottom: 2.25rem;
}
.brand img { width: 2.75rem; height: auto; }
.brand:hover { color: var(--fg); text-decoration: underline; }

.panel h1 { font-size: 1.75rem; letter-spacing: -0.02em; margin-bottom: 0.75rem; }

.lede { margin: 0 0 1.5rem; color: var(--fg-soft); line-height: 1.6; font-size: 0.875rem; }

.group {
  border-top: 1px solid var(--line);
  margin-top: 1.75rem;
  padding-top: 1.1rem;
}

.group h2 { font-size: 1.0625rem; margin-bottom: 0.4rem; }

.group-head { display: flex; align-items: baseline; justify-content: space-between; }

.hint {
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--fg-soft);
  margin: 0.25rem 0 0.75rem;
}

.field, .slider, .seg, .check { font-size: 0.8125rem; line-height: 1.3; }

.field { display: grid; gap: 0.4rem; }
.field-inline { grid-template-columns: 1fr auto; align-items: center; margin: 0.85rem 0; }

.slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.5rem;
  margin: 0.85rem 0;
}
.slider input { grid-column: 1 / -1; width: 100%; margin: 0.25rem 0 0; }
.slider output { color: var(--fg-soft); }
.slider:has(input:disabled) { opacity: 0.4; }

.seg { border: 0; padding: 0; margin: 1rem 0 0.9rem; min-width: 0; }
.seg legend { padding: 0; margin-bottom: 0.45rem; }
.seg-options {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg-options input { position: absolute; opacity: 0; pointer-events: none; }
.seg-options label {
  flex: 1;
  text-align: center;
  padding: 0.55rem 0.25rem;
  cursor: pointer;
  border-left: 1px solid var(--line-strong);
}
.seg-options label:first-of-type { border-left: 0; }
.seg-options label:hover { background: var(--active); }
.seg-options input:checked + label { background: var(--fg); color: var(--bg); }
.seg-options input:focus-visible + label { outline: 2px solid var(--fg); outline-offset: -4px; }
.seg-options input:checked:focus-visible + label { outline-color: var(--bg); }

.check { display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer; }
.check input { margin: 0.1rem 0 0; }

/* rules table */

.rules-scroll { position: relative; overflow-x: auto; margin: 0 -0.25rem; padding: 0 0.25rem; }

.rules {
  width: 100%;
  min-width: 23rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.75rem;
  line-height: 1.2;
}
.rules .col-name { width: 2.5rem; }
.rules .col-x { width: 1.4rem; }
.rules thead th {
  font-style: italic;
  font-weight: 400;
  color: var(--fg-soft);
  padding: 0 0 0.4rem;
}
.rules tbody th {
  text-align: left;
  font-weight: 400;
  white-space: nowrap;
  padding-left: 0.25rem;
}
.rules td { padding: 2px 1px; }
.rules tbody tr.active th, .rules tbody tr.active td { background: var(--active); }
.rules tbody tr.active th { box-shadow: inset 2px 0 0 var(--fg); }

.swatch {
  display: inline-block;
  vertical-align: -0.05em;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--dot, var(--fg));
}

.rules input {
  width: 100%;
  font: inherit;
  font-size: 0.7rem;
  letter-spacing: -0.04em;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.4rem 0.12rem;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}
.rules input:hover { border-color: var(--fg-faint); }
.rules input::-webkit-outer-spin-button,
.rules input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rules input:invalid { box-shadow: none; }
.rules input[aria-invalid="true"] { border-color: var(--danger); color: var(--danger); }
.rules input:focus-visible { outline-offset: 0; border-color: var(--fg); }

.remove {
  width: 100%;
  font: 1rem/1 var(--mono);
  color: var(--fg-soft);
  background: none;
  border: 0;
  border-radius: var(--radius);
  padding: 0.3rem 0;
  cursor: pointer;
}
.remove:hover:not(:disabled) { color: var(--fg); background: var(--active); }
.remove:disabled { opacity: 0.25; cursor: default; }

.rule-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.8rem; }

/* notes below the lab */

.notes {
  max-width: 44rem;
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
  line-height: 1.75;
  border-top: 1px solid var(--line);
}
.notes h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin-bottom: 1.25rem; }
.notes h3 { font-size: 1.0625rem; margin: 2.5rem 0 0.75rem; }
.notes p { margin: 0 0 1.1rem; color: var(--fg-soft); max-width: 66ch; }
.notes ul { padding-left: 1.2rem; margin: 0; color: var(--fg-soft); max-width: 66ch; }
.notes li { margin-bottom: 0.6rem; }

.notes .formula {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--fg);
  padding: 0.75rem 0 0.75rem 1.5rem;
  border-left: 1px solid var(--fg);
}

.roles { margin: 0; max-width: 66ch; }
.roles dt { margin-top: 1.1rem; }
.roles dd { margin: 0.15rem 0 0; color: var(--fg-soft); }

.site-footer {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--fg-faint);
}

.noscript { text-align: center; padding: 2rem; }

/* ---------- small screens ---------- */

@media (max-width: 960px) {
  .lab { grid-template-columns: minmax(0, 1fr); }
  .stage { position: relative; height: auto; }
  .plate { flex: none; height: 68svh; min-height: 22rem; }
  .panel { border-left: 0; min-height: 0; min-width: 0; padding: 1.25rem 1.25rem 3rem; }
  .brand { margin-bottom: 1.25rem; }
  .transport { gap: 0.5rem; }
  .transport-end { margin-left: 0; }
  .count { order: -1; flex-basis: 100%; margin: 0 0 0.15rem; }
}

@media (max-width: 640px) {
  .hero { flex-direction: column; align-items: stretch; min-height: 0; }
  .hero-fern { position: relative; width: 100%; height: 52svh; order: -1; }
  .hero-text { padding: 1rem 1.5rem 3rem; }
  .hero-logo { width: 5.5rem; margin-bottom: 1.5rem; }
  .entry { grid-template-columns: 1fr; }
  .entry-plate { padding-top: 0; margin-bottom: 0.25rem; }
  .transport .btn { padding: 0.55rem 0.6rem; }
  .rules .col-name { width: 1.7rem; }
  .rules .swatch { display: none; }
  .rules input { font-size: 0.68rem; letter-spacing: -0.05em; padding: 0.45rem 0.08rem; }
}
