/* Juno's site (#188). Juno first: Iron and Ash colours, Archivo headings, the pixel scenes and their fade
 * (docs/design-brief.md). From lucas.zip: the 40em reading column, the listing and footer layouts, the ⁂
 * separator, the faded site title and the cross-fade between pages. */

@font-face {
  font-family: 'Archivo SemiCondensed';
  src: url('/assets/fonts/ArchivoSemiCondensed-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Ash (light) */
:root {
  color-scheme: light dark;
  --background: #eae6e0;
  --surface: rgb(247 245 242 / 0.8);
  --hairline: #d3ccc3;
  --edge: rgb(28 25 22 / 0.09);
  --text: #1c1916;
  --text-secondary: #625a52;
  --accent: #e2632b;
  --accent-text: #a23e17;
  --title-shadow: rgb(234 230 224 / 0.8);
  --bar-shadow: rgb(28 25 22 / 0.09);

  --font-title: 'Archivo SemiCondensed', 'Arial Narrow', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --gutter: 16px;
  --column: 40em;
  --pixel: 2; /* CSS pixels per art pixel in a scene; scenes.js rounds it to whole device pixels */
}

@media (min-width: 600px) { :root { --pixel: 3; } }
@media (min-width: 1100px) { :root { --pixel: 4; } }

/* Iron (dark) */
@media (prefers-color-scheme: dark) {
  :root {
    --background: #141210;
    --surface: rgb(38 34 31 / 0.78);
    --hairline: #3a3530;
    --edge: rgb(237 230 221 / 0.09);
    --text: #ede6dd;
    --text-secondary: #a89e93;
    --accent-text: #ee7038;
    --title-shadow: rgb(0 0 0 / 0.55);
    --bar-shadow: rgb(0 0 0 / 0.4);
  }
}

/* Pages cross-fade, as lucas.zip's do: a fade is the one transition Juno allows. */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 0.15s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

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

html {
  background: var(--background);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--text);
  font: 17px/1.45 var(--font-body);
  overflow-x: hidden;
}

h1,
h2,
h3 {
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: 34px; letter-spacing: -0.4px; }
h2 { font-size: 24px; margin: 2em 0 0.5em; }
h3 { font-size: 20px; margin: 1.6em 0 0.4em; }

p,
ul,
ol { margin: 0.75em 0; }

ul,
ol { padding-left: 1.3em; }
li + li { margin-top: 0.35em; }

a { color: var(--accent-text); }

main a,
.footer-byline a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent-text) 45%, transparent);
}

main a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
}

code {
  font: 0.92em ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--edge);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--background);
  color: var(--text);
}
.skip-link:focus { top: 12px; }

.column {
  width: 100%;
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---- Pixel scenes ---------------------------------------------------------------------------------------
 * Back to front, as in the app's headers: the sharp scene; a blurred copy of the same frame, masked in from
 * 46% to 92% of its height; an eased veil into the exact background across the bottom 72%, with the app's
 * opacity steps, reaching solid 3% early so the scene's last row never shows as a line on a large display.
 * A scene's container sets --art-height (the scene's height in art pixels); scenes.js sets --pixel-exact on
 * the container once it knows the display's density, so the content below can sit against the scene. */

.scened {
  --scene-height: calc(var(--art-height) * var(--pixel-exact, var(--pixel)) * 1px);
}

.scene {
  position: absolute;
  inset: 0 0 auto;
  height: var(--scene-height);
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.scene canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.scene.is-drawn canvas { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .scene canvas { transition: none; }
}

.scene .scene-soft {
  image-rendering: auto;
  filter: blur(calc(var(--pixel-exact, var(--pixel)) * 2px));
  -webkit-mask-image: linear-gradient(transparent 46%, #000 92%);
  mask-image: linear-gradient(transparent 46%, #000 92%);
}

.scene-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 28%,
    color-mix(in srgb, var(--background) 3%, transparent) 41.8%,
    color-mix(in srgb, var(--background) 16%, transparent) 55.6%,
    color-mix(in srgb, var(--background) 45%, transparent) 69.4%,
    color-mix(in srgb, var(--background) 78%, transparent) 81.8%,
    color-mix(in srgb, var(--background) 94%, transparent) 90.1%,
    var(--background) 97%
  );
}

.scened {
  position: relative;
  isolation: isolate;
}

.scened > :not(.scene) { position: relative; z-index: 1; }

.over-scene { text-shadow: 0 0 12px var(--title-shadow), 0 0 4px var(--title-shadow); }

/* ---- Top bar --------------------------------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
}

.topbar--end { justify-content: flex-end; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font: 600 20px/1 var(--font-title);
  letter-spacing: -0.2px;
  padding: 8px 14px 8px 10px;
  text-shadow: none;
}

.emblem {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex: none;
}

.brand,
.nav {
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--edge), 0 6px 18px var(--bar-shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.nav {
  display: flex;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 4px;
  text-shadow: none;
}

.nav li + li { margin: 0; }

.nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
}

.nav a:hover { background: var(--edge); }
.nav a[aria-current='page'] { color: var(--accent-text); }

/* ---- Landing hero ---------------------------------------------------------------------------------------- */

.hero { --art-height: 104; }

.hero-lockup { padding-top: calc(var(--scene-height) * 0.5); }

.lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lockup h1 {
  font-size: clamp(48px, 11vw, 72px);
  line-height: 1;
  letter-spacing: -0.8px;
}

.tagline {
  font-size: 20px;
  line-height: 1.35;
  margin: 12px 0 0;
  max-width: 26em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0;
  padding: 6px 14px 6px 12px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--edge);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  text-shadow: none;
}

.status::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---- Inner page header ----------------------------------------------------------------------------------- */

.page-header { --art-height: 72; }
.page-header--study { --art-height: 67; }
.page-header--gateway { --art-height: 96; }

.page-title { padding-top: calc(var(--scene-height) * 0.62); }

.page-title p {
  color: var(--text-secondary);
  margin: 6px 0 0;
  font-size: 15px;
}

/* ---- Content --------------------------------------------------------------------------------------------- */

/* Above the header's scene, whose veil can run below a short header. */
main,
body > footer { position: relative; z-index: 1; }

main { flex: 1; padding-bottom: 8px; }

.lead { font-size: 19px; line-height: 1.45; }

.secondary { color: var(--text-secondary); }

/* lucas.zip's listing: the term to the left, right-aligned; stacked on a phone. */
.listing { margin: 1em 0; }
.listing > div { margin: 0.9em 0; }
.listing dt {
  font: 600 18px/1.35 var(--font-title);
}
.listing dd { margin: 0.15em 0 0; }

@media (min-width: 34em) {
  .listing > div { display: flow-root; margin: 0.5em 0; }
  .listing dt {
    float: left;
    width: 150px;
    text-align: right;
    line-height: 1.45;
    font-size: 18px;
  }
  .listing dd { margin: 0 0 0 170px; }
}

/* A band of scene inside the column, faded into the ground at top and bottom. */
.band {
  --art-height: 108;
  --pixel: 2;
  height: var(--scene-height);
  margin: 2.5em calc(-1 * var(--gutter));
}
@media (min-width: 600px) { .band { --pixel: 3; } }
@media (min-width: 40em) {
  .band { margin-left: 0; margin-right: 0; }
}
/* A mask, not a colour veil: the canvas snaps to whole device pixels and the column can sit on a half pixel,
 * so a veil laid over it can leave one row of art showing at its edge. A mask fades the scene itself. */
.band .scene {
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 2%, #000 22%, #000 68%, transparent 98%),
    linear-gradient(to right, transparent 1%, #000 12%, #000 88%, transparent 99%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent 2%, #000 22%, #000 68%, transparent 98%),
    linear-gradient(to right, transparent 1%, #000 12%, #000 88%, transparent 99%);
  mask-composite: intersect;
}

/* Snapping can also lift the canvas a device pixel above its box; start it inside the faded edge. */
.band .scene canvas { top: 2px; left: 2px; }

hr.asterism {
  border: 0;
  margin: 2.2em 0;
  display: flex;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 120%;
  font-weight: 700;
  height: 1em;
}
hr.asterism::before { content: '⁂'; }

.updated { color: var(--text-secondary); font-size: 15px; }

/* The spot for the contact address, until Lucas picks one (#188). */
.contact-pending {
  margin: 1em 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--edge);
}
.contact-pending p { margin: 0; }
.contact-pending p + p { margin-top: 0.4em; }

/* ---- Footer, after lucas.zip's ---------------------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--hairline);
  margin: 2.5em 0 0;
  padding: 1em 0 2em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6em 1.5em;
  font-size: 15px;
}

.footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2em 0.9em;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer li + li { margin: 0; }
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }

.footer-byline { color: var(--text-secondary); margin: 0; }

.lucas-zip {
  color: var(--text-secondary);
  letter-spacing: -0.5px;
  padding: 0.15em 0.35em;
  margin: 0 -0.35em 0 0;
  border-radius: 6px;
  text-decoration: none !important;
}
.lucas-zip:hover { background: var(--edge); color: var(--text); }
