/* hearth layout (family void): the fire fills the viewport, one floating card of smoke glass holds
   every control, and the chrome fades on idle. colours come only from tokens.css. */

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

/* hidden means hidden, whatever display a class sets (house rule, house-audit hidden-display) */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--text-md);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.is-idle {
  cursor: none;
}

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

.skip {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 30;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--key);
  border-radius: var(--radius);
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
}

/* ---------------------------------------------------------------- the fire */

.stage {
  position: fixed;
  inset: 0;
}

.fire {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: var(--fire-ground);
}

/* ---------------------------------------------------------------- the card: smoke glass */

.card {
  position: fixed;
  top: max(var(--space-4), env(safe-area-inset-top));
  left: max(var(--space-4), env(safe-area-inset-left));
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  width: min(344px, calc(100vw - 2 * var(--space-4)));
  max-height: calc(100dvh - 2 * var(--space-4) - 48px);
  overflow-y: auto;
  padding: var(--space-3);
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  /* the key-block double rule: a sumi line outside, a washi hairline inside */
  border: 1px solid var(--key);
  outline: 1px solid var(--hairline);
  outline-offset: -4px;
  border-radius: var(--radius);
  transition: opacity var(--fade) ease;
}

.chrome-idle {
  opacity: 0;
  pointer-events: none;
}

/* the wordmark: upright letters stacked in a vertical title cartouche, after hiroshige's */
.cartouche {
  align-self: start;
  margin: 0;
  padding: var(--space-3) 7px;
  font-family: var(--font-display);
  font-size: var(--text-cartouche);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  writing-mode: vertical-rl;
  text-orientation: upright;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent-ink);
  outline: 1px solid var(--accent-ink);
  outline-offset: -4px;
  border-radius: var(--radius);
  user-select: none;
}

.card-body {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  min-width: 0;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ---------------------------------------------------------------- buttons */

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  cursor: pointer;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .fill {
  fill: currentColor;
  stroke: none;
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ---------------------------------------------------------------- sliders */

.sliders {
  display: grid;
  gap: var(--space-3);
}

.sliders[hidden] {
  display: none;
}

.slider {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.slider-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.slider-label label {
  color: var(--ink);
}

.slider-read {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.slider input[type="range"] {
  width: 100%;
  height: var(--tap);
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.temp-track {
  /* campfire red to gas blue; colours match blackbodyRGB(1500) and gasRGB() */
  background: linear-gradient(90deg, #ff6f00, #cfd9ff);
  border-radius: var(--radius);
}

#fold[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

#fold svg {
  transition: transform 160ms ease;
}

@media (prefers-reduced-motion: reduce) {
  #fold svg {
    transition: none;
  }
}

/* ---------------------------------------------------------------- notices and states */

.notice {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink);
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--bg) 35%, transparent);
}

.fallback {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: var(--space-4) var(--space-4) 96px;
  pointer-events: none;
}

.fallback-text {
  max-width: 34ch;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  text-align: center;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--key);
  outline: 1px solid var(--hairline);
  outline-offset: -4px;
  border-radius: var(--radius);
  pointer-events: auto;
}

/* ---------------------------------------------------------------- the colophon: the house footer */

.colophon {
  position: fixed;
  right: max(var(--space-4), env(safe-area-inset-right));
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  z-index: 10;
  padding: 6px 10px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  border: 1px solid var(--key);
  outline: 1px solid var(--hairline);
  outline-offset: -4px;
  border-radius: var(--radius);
  transition: opacity var(--fade) ease;
}

.colophon-link {
  font-size: var(--text-xs);
  color: var(--muted);
  text-decoration: none;
}

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

/* ---------------------------------------------------------------- the not-found page */

.lost {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: var(--space-4);
}

.lost-card {
  position: static;
  width: min(344px, 100%);
}

.lost-card p {
  margin: 0;
}

.lost-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
}
