/* ============================================================================
   ALPHACTORY — theme over the shared game-page layout.
   Same method as the other game pages: two signature colours, two roles,
   on a dark ground with light text.
     EMBER    = identity and action (buttons, the underline, what burns)
     PHOSPHOR = narrative accent (letters in transit, rules, numbers)
     QUARTZ   = rare accent, two or three appearances on the whole page.
   The ground is ink black, colder than Apiarium's night and ALL CAPS's
   charcoal: a terminal, not a stage.
   Every glyph on the page, text and world (js/ascii-world.js), is set in
   the game's own face, Fixedsys Excelsior (CC0), cut down to what the page uses.
   ============================================================================ */

@import url("../assets/fonts/fonts.css");
@font-face{ font-family: "Fixedsys"; src: url("../assets/fonts/fixedsys.woff2") format("woff2"); font-display: block; }

:root{
  --bg:      #08090b;
  --panel:   #101216;
  --panel2:  #16191f;
  --line:    #23272f;
  --text:    #e6e2d6;
  --muted:   #8b8879;
  --dim2:    #5f5d54;
  --accent:  #ff7a2f;
  --on-accent: #150803;
  --ember-lo:  #ffa066;
  --ember-deep:#b34d15;
  --soft:    #58d3d8;
  --phosphor-deep: #2c7f85;
  --quartz:  #b58cff;
  /* One face, as in the game. It is a bitmap drawn on a 16 px grid: sizes stay on
     multiples of 16 so each font pixel lands on whole screen pixels, and it has no
     bold, so weights are never faked. */
  --sans: "Fixedsys", ui-monospace, Consolas, monospace;
  --mono: var(--sans);
  /* The giant name is a drawing filled with small letters: it needs strokes thick enough
     to be windows, which a one-pixel face cannot give. */
  --mast: "Spline Sans Mono", ui-monospace, Consolas, monospace;
}

/* ---------- The world behind the page (ascii-world.js) ---------- */

:root{ --glyph: var(--sans); }
html{ font-synthesis: none; }
body{ -webkit-font-smoothing: none; }
/* The world is set in the page, never fixed: the browser scrolls it with the text, so it cannot lag.
   Its canvases are a band of it around the screen (--band-top, --band-h, set by ascii-world.js). */
body{ position: relative; }
.world{ position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.world canvas{ position: absolute; left: 0; top: var(--band-top, 0px); width: 100%; height: var(--band-h, 100vh); display: block; }
.mast-tex canvas{ position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ascii-glow{ filter: blur(7px) saturate(1.4); mix-blend-mode: screen; }
body > header, main, footer{ position: relative; z-index: 1; }
/* Sections are caves in the rock: no rule between them, the rock is the border. */
.section{ border-top: 0; }
.download-section{ background: none; }
.lava-room{ height: 256px; }

/* The depth gauge: the game's reading of where you are. */
.gauge{ position: fixed; right: 18px; top: 50%; z-index: 2; transform: translateY(-50%); display: grid; gap: 2px; justify-items: end; font: 16px/16px var(--glyph); color: var(--dim2); pointer-events: none; }
.gauge [data-layer-name]{ color: var(--accent); }
.gauge [data-depth]{ color: var(--soft); }
.gauge .hint{ display: none; margin-top: 10px; max-width: 13ch; text-align: right; color: var(--dark); }
@media (min-width: 1500px){ .gauge .hint{ display: block; } }
html:not(.has-world) .gauge{ display: none; }

/* The name: giant letters, each a window onto a page of small ones. */
.mast{ margin-top: 6px; }
.mast-word{ position: relative; display: flex; justify-content: space-between; margin: 0; font: 700 clamp(36px, 11.6vw, 172px)/.9 var(--mast); letter-spacing: -.04em; font-synthesis: weight; color: var(--text); user-select: none; }
.mast-letter{ display: inline-block; transition: transform .5s cubic-bezier(.2,.8,.3,1); }
.mast-letter:hover{ transform: translateY(-6px) rotate(-2deg); }
.mast-tex{ position: absolute; inset: 0; pointer-events: none; }
.mast-word.is-textured{ color: transparent; -webkit-text-stroke: 1px rgba(255,122,47,.16); }

/* Rails: belts of free punctuation that frame the name. */
.rail{ height: 16px; margin: 12px 0; overflow: hidden; white-space: nowrap; font: 16px/16px var(--glyph); color: var(--dark); }
.rail::before{ content: "=>----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->----->-----="; }
.hero{ padding-bottom: 352px; }

/* Titles are typed, like everything in the game. */
.brand, h1, h2{ font-family: var(--mono); font-weight: 400; letter-spacing: 0; }
.brand{ }
h1{ font-size: 48px; line-height: 1.17; }
@media (max-width: 640px){ h1{ font-size: 32px; } }
h2{ font-size: 32px; }
.button{ font-family: var(--mono); font-size: 16px; text-transform: uppercase; border-radius: 3px; }
.button.small{ font-size: 16px; }

/* On a phone the six page links keep whole: when the row runs out of room, the last ones wrap below. */
@media (max-width: 700px){
  .nav nav{ flex-wrap: wrap; row-gap: 8px; }
  .nav nav a{ white-space: nowrap; }
}

.eyebrow::before{ content: "=[ "; color: var(--dim2); font-family: var(--glyph); }
.eyebrow::after{ content: " ]="; color: var(--dim2); font-family: var(--glyph); }
.status-dot{ display: none; }

/* A furnace glow under the title. Its box is only the lit part, the glow fading out at its edge:
   at most 98vw wide, it never reaches past the screen, where a phone would lay the page out wider.
   Same glow as a min(90rem, 140vw) box fading out at 70%, centred at -12% + a quarter of its width. */
.hero{ position: relative; }
.hero::before{
  content: "";
  position: absolute;
  left: 50%; top: calc(-12% + min(6.75rem, 10.5vw));
  z-index: -1;
  width: min(63rem, 98vw);
  aspect-ratio: 2 / 1;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(255,122,47,.12), transparent);
  pointer-events: none;
}

/* Every clip shows the whole frame, never a crop onto its subject. */
.frame{ background: #000; }
.frame img{ aspect-ratio: auto; object-fit: contain; }

.download-count{ margin: 0; flex-basis: 100%; font: 16px var(--mono); color: var(--muted); }
.download-count strong{ color: var(--soft); font-weight: 700; }

kbd{ display: inline-block; padding: 1px 6px; font: 16px var(--mono); color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; }
code{ font-family: var(--mono); font-size: .9em; color: var(--soft); }

.below{ margin-top: 56px; }

/* ---------- A word of the game, in its glyphs ---------- */

.glyph-word{ font-family: var(--glyph); color: var(--accent); white-space: nowrap; }

/* ---------- The rule, set like an inscription ---------- */

.creed{
  margin: 28px 0 0;
  padding: 26px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
}
.creed p{ margin: 0; font-family: var(--mono); font-size: 16px; line-height: 1.5; }
.creed p + p{ margin-top: 14px; color: var(--muted); font-family: var(--sans); font-size: 16px; }

/* ---------- Cards, machines ---------- */

.cards, .fact-grid{
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  background: var(--line);
  border: 1px solid var(--line);
}
.cards{ grid-template-columns: repeat(4, 1fr); }
.fact-grid{ grid-template-columns: repeat(3, 1fr); }

.card, .fact-grid div{ padding: 24px 26px; background: var(--panel); }
.card h3{ margin: 0 0 8px; font: 16px var(--mono); text-transform: uppercase; color: var(--accent); }
.card p{ margin: 0; font-size: 16px; line-height: 1.7; color: var(--muted); }

.fact-grid dt{ margin-bottom: 6px; font: 16px var(--mono); text-transform: uppercase; color: var(--soft); }
.fact-grid dd{ margin: 0; font-size: 16px; line-height: 1.7; color: var(--muted); }

/* Each machine is filmed in the game: its name over the text, beside its clip. */
.machine h3{ margin: 0; font: 16px var(--mono); text-transform: uppercase; color: var(--accent); }

.note{ max-width: 760px; color: var(--muted); }
.note b{ color: var(--ember-lo); }

/* ---------- Strata ---------- */

.strata{ margin: 0; padding: 0; list-style: none; counter-reset: layer; }
.strata li{ counter-increment: layer; display: grid; grid-template-columns: 2.2rem 1fr; column-gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.strata li::before{ content: counter(layer, decimal-leading-zero); grid-row: 1 / 3; padding-top: 2px; font: 16px var(--mono); color: var(--ember-deep); }
.strata b{ font: 16px var(--mono); text-transform: uppercase; }
.strata span{ font-size: 16px; color: var(--muted); }

.economy-note{ max-width: 760px; margin: 28px 0 0; color: var(--muted); }
.quartz-text{ color: var(--quartz); font-family: var(--glyph); }

/* ---------- The alphabet case ---------- */

.case-tiers{ display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 48px 0 0; padding: 0; list-style: none; font: 16px var(--mono); text-transform: uppercase; color: var(--dim2); }
.case-tiers i{ margin-right: 6px; font: 16px var(--glyph); font-style: normal; }
.hearth-slot{ height: 96px; margin-top: 28px; }

/* ---------- The world stays still: letters jump, never glide ---------- */

.mast-letter{ transition: none; animation: none; }

/* ---------- Download ---------- */

.download-section{ background: var(--panel); }
.download-inner{ display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: start; }
.download-inner > div > p:not(.eyebrow){ max-width: 470px; margin: 22px 0 0; font-size: 16px; line-height: 1.7; color: var(--muted); }
.download-card .button{ width: 100%; justify-content: space-between; }
.download-meta{ margin: 14px 0 0; font: 16px var(--mono); color: var(--muted); }
.download-card .download-count{ margin-top: 10px; }
.download-steps{ margin: 22px 0 0; padding: 20px 0 0 20px; border-top: 1px solid var(--line); font-size: 16px; }
.download-steps li + li{ margin-top: 8px; }

.keys{ margin-top: 64px; }
.keys h3{ margin: 0 0 16px; font: 16px var(--mono); text-transform: uppercase; color: var(--soft); }
.keys dl{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 40px; margin: 0; }
.keys div{ display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.keys dt{ font: 16px var(--mono); white-space: nowrap; }
.keys dd{ margin: 0; font-size: 16px; text-align: right; color: var(--muted); }

/* ---------- Feedback form (beta.js) ---------- */

.report{ display: grid; gap: 20px; }
.report__kinds{ display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; border: 0; }
.report__kinds legend{ margin-bottom: 10px; font: 16px var(--mono); text-transform: uppercase; color: var(--soft); }
.report__kinds label{ display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; cursor: pointer; }
.report__kinds label:has(input:checked){ border-color: var(--accent); color: var(--ember-lo); }
.report__kinds input{ accent-color: var(--accent); }
.report__icon{ width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: round; }
.report__field{ display: grid; gap: 7px; font: 16px var(--mono); text-transform: uppercase; color: var(--soft); }
.report__field span{ text-transform: none; letter-spacing: 0; color: var(--dim2); }
.report textarea, .report input[name="contact"]{ width: 100%; padding: 13px 14px; font: 16px var(--sans); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 3px; resize: vertical; }
.report textarea:focus, .report input:focus{ outline: 2px solid var(--phosphor-deep); outline-offset: 1px; }
.report__trap{ position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.report .button{ justify-self: start; border: 0; cursor: pointer; }
.report .button:disabled{ opacity: .5; cursor: wait; }
.report__status{ margin: 0; min-height: 1.5em; color: var(--ember-lo); }
.report__status.is-ok{ color: var(--soft); }

@media (max-width: 1000px){
  .cards{ grid-template-columns: 1fr 1fr; }
  .fact-grid, .keys dl{ grid-template-columns: 1fr 1fr; }
  .download-inner{ gap: 40px; }
}

@media (max-width: 700px){
  .gauge{ display: none; }
  .hero{ padding-bottom: 260px; }
  .cards, .fact-grid, .keys dl, .download-inner{ grid-template-columns: 1fr; }
  .below{ margin-top: 36px; }
  .keys{ margin-top: 44px; }
}

/* Changelog, written by tools/changelogs.py: an accordion in the fact sheet. */
.changelog details{ border-bottom: 1px solid var(--line); }
.changelog details:first-child{ border-top: 1px solid var(--line); }
.changelog summary{ position: relative; padding: 20px 30px 20px 0; cursor: pointer; list-style: none; font-family: var(--mono); }
.changelog summary::-webkit-details-marker{ display: none; }
.changelog summary::after{ content: "+"; position: absolute; right: 3px; top: 14px; color: var(--accent); font-size: 16px; }
.changelog details[open] summary::after{ content: "\2212"; }
.changelog summary time{ color: var(--muted); margin-left: 4px; }
.changes{ list-style: none; margin: 0 0 24px; padding: 0 15px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.changes li{ margin: 0 0 10px; }
.changes b{ color: var(--text); font-weight: 600; }

/* The shared layout sets small type for faces that have it; this one is drawn at 16 px. */
.nav nav a, .button, .eyebrow, .tag, .qualities, .showcase-bottom, .button.small, .hero-note, .hero-aside .hero-note, .mono, figcaption, .clips--four figcaption,
.feature-list span, .fact-list dt, .fact-list dd, .section-heading > p:last-child, .hero-lead{ font-size: 16px; letter-spacing: 0; }
