/* The Fractal 3D page (templates/fractal3d.html): the app's own look, over a
   moving fractal world. Panels are drawn like the app's original 16-bit
   pause menu (shared/ui in the app): bevelled windows with banded title
   strips, gold for what matters. Text is in the page's pixel font, drawn
   at 16 px or a whole multiple (fonts.css; the server picks the class);
   the name is in Pixelify Sans. Right-to-left pages mirror through logical
   properties. */

:root {
  color-scheme: dark;
  --ink: #f4f0ff;
  --muted: #c9c0e6;
  --gold: #ffd25a;
  --gold-dark: #9c6b10;
  --cyan: #7de8ff;
  --green: #7dff9a;
  --night: #06040c;
  --panel: rgba(9, 7, 22, 0.86);
  --band-a: #2a1d66;
  --band-b: #332478;
  --bevel: 0 0 0 2px #000, inset 2px 2px #5a4fb0, inset -2px -2px #120d2c;
  --pressed: 0 0 0 2px #000, inset 2px 2px #120d2c, inset -2px -2px #5a4fb0;
  --font: "DotGothic16", "RA Unifont", sans-serif;
  --line: 24px;
}

[hidden] {
  display: none !important;
}

.dot {
  --font: "DotGothic16", "RA Unifont", sans-serif;
}

.uni {
  --font: "RA Unifont", sans-serif;
}

.brahmic {
  --font: var(--brahmic-face), "RA Unifont", sans-serif;
  --line: var(--brahmic-line);
}

.sys {
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

html {
  background: var(--night);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: var(--line);
  -webkit-font-smoothing: none;
  font-smooth: never;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a {
  color: var(--cyan);
}

img {
  display: block;
}

/* --- backdrop ------------------------------------------------------------ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--night);
}

.backdrop-still,
.backdrop-world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.backdrop-world {
  opacity: 0;
  transition: opacity 1.2s ease;
}

.backdrop-world.live {
  opacity: 1;
}

.backdrop-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(6, 4, 12, 0.2) 0%, rgba(6, 4, 12, 0.55) 70%, rgba(6, 4, 12, 0.85) 100%),
    linear-gradient(to bottom, rgba(6, 4, 12, 0.25), rgba(6, 4, 12, 0.5));
}

/* --- chips and buttons ----------------------------------------------------- */

.topbar {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  display: flex;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  z-index: 2;
}

.chip,
.quickbar button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 12px;
  border: 0;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--bevel);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.chip img {
  image-rendering: pixelated;
}

.chip:hover,
.quickbar button:hover {
  color: var(--gold);
}

.chip:active,
.quickbar button:active,
.quickbar button[aria-pressed="true"] {
  box-shadow: var(--pressed);
}

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

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

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 20px 88px;
  text-align: center;
}

.app-icon {
  width: 120px;
  height: 120px;
  border-radius: 27px;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--gold), 0 0 0 6px #000, 0 12px 40px rgba(125, 232, 255, 0.35);
}

.name {
  margin: 28px 0 0;
  font-family: "Pixelify Sans", var(--font);
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow: 4px 4px 0 #000, 0 0 24px rgba(255, 210, 90, 0.35);
}

.tagline {
  max-width: 30em;
  margin: 20px 0 0;
  font-size: 32px;
  line-height: calc(var(--line) * 2);
  text-shadow: 2px 2px 0 #000;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 0;
  padding: 4px 14px;
  background: var(--panel);
  box-shadow: var(--bevel);
  color: var(--gold);
}

.led {
  width: 8px;
  height: 8px;
  background: var(--green);
  box-shadow: 0 0 0 2px #000, 0 0 10px var(--green);
  animation: led 2.4s ease-in-out infinite;
}

@keyframes led {
  50% {
    opacity: 0.35;
  }
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
}

.store {
  display: grid;
  justify-items: start;
  min-width: 200px;
  padding: 10px 18px 12px;
  border: 0;
  color: var(--ink);
  background: repeating-linear-gradient(to bottom, var(--band-a) 0 6px, var(--band-b) 6px 12px);
  box-shadow: var(--bevel);
  text-align: start;
  text-decoration: none;
}

.store:hover {
  color: #fff;
  background: repeating-linear-gradient(to bottom, var(--band-b) 0 6px, #3d2c8c 6px 12px);
}

.store:active {
  box-shadow: var(--pressed);
}

.store-get {
  color: var(--gold);
}

.store-name {
  font-family: "Pixelify Sans", var(--font);
  font-size: 28px;
  line-height: 36px;
  font-weight: 700;
}

.store-os {
  color: var(--muted);
}

.scroll-cue {
  position: absolute;
  inset-block-end: 24px;
  width: 16px;
  height: 16px;
  /* Physical sides: it points down in every direction of writing. */
  border-right: 4px solid var(--gold);
  border-bottom: 4px solid var(--gold);
  transform: rotate(45deg);
  filter: drop-shadow(2px 2px 0 #000);
  animation: cue 2.4s ease-in-out infinite;
}

@keyframes cue {
  50% {
    translate: 0 8px;
  }
}

/* --- panels ---------------------------------------------------------------- */

main {
  display: block;
}

.panel {
  max-width: 960px;
  margin: 0 auto 72px;
  background: var(--panel);
  box-shadow: var(--bevel);
}

.panel-title {
  margin: 0;
  padding: 10px 20px;
  font-size: 32px;
  font-weight: normal;
  line-height: calc(var(--line) * 2);
  color: var(--gold);
  background: repeating-linear-gradient(to bottom, var(--band-a) 0 6px, var(--band-b) 6px 12px);
  box-shadow: inset 0 -2px #000;
  text-shadow: 2px 2px 0 #000;
}

.panel-body {
  padding: 20px;
}

.panel-body > p {
  max-width: 44em;
  margin: 0;
}

.stills {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.stills.two {
  grid-template-columns: repeat(2, 1fr);
}

.stills.three {
  grid-template-columns: repeat(3, 1fr);
}

.stills.four {
  grid-template-columns: repeat(4, 1fr);
}

.still {
  margin: 0;
}

.still img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px #3d3380;
}

.portraits .still img {
  aspect-ratio: 4 / 3;
}

.pixels img,
.still img[src*="style-retro"] {
  image-rendering: pixelated;
}

.still figcaption {
  margin-top: 12px;
  color: var(--muted);
}

.still figcaption b {
  display: block;
  color: var(--gold);
  font-weight: normal;
}

/* --- footer and the sketch's controls ------------------------------------- */

.footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 96px;
  color: var(--muted);
  text-align: center;
  text-shadow: 2px 2px 0 #000;
}

.footer .chip {
  text-shadow: none;
}

.quickbar {
  position: fixed;
  inset-block-end: max(12px, env(safe-area-inset-bottom));
  inset-inline-end: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 10px;
  z-index: 3;
}

/* --- the links to the legal pages ---------------------------------------- */

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 24px 0 0;
}

.legal-links + p {
  margin-top: 24px;
}

.legal-links .chip {
  text-shadow: none;
}

.legal-links .chip[aria-current="page"] {
  color: var(--gold);
  box-shadow: var(--pressed);
}

/* --- the legal page and the privacy policy --------------------------------
   (fractal3d-legal.html, fractal3d-privacy.html): the same windows, one per
   section, over a still of the app's world dimmed for reading. */

.doc-page .backdrop-shade {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(6, 4, 12, 0.55) 0%, rgba(6, 4, 12, 0.8) 70%, rgba(6, 4, 12, 0.92) 100%),
    linear-gradient(to bottom, rgba(6, 4, 12, 0.4), rgba(6, 4, 12, 0.75));
}

.doc {
  max-width: 840px;
  margin: 0 auto;
  padding: 88px 20px 48px;
}

.doc-head {
  margin-bottom: 40px;
  text-align: center;
}

.doc-app {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--gold);
  font-family: "Pixelify Sans", var(--font);
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
  letter-spacing: 1px;
  text-decoration: none;
  text-shadow: 3px 3px 0 #000;
}

.doc-app img {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--gold), 0 0 0 6px #000;
}

.doc-app:hover span {
  color: var(--ink);
}

.doc-title {
  margin: 28px 0 0;
  font-size: 32px;
  font-weight: normal;
  line-height: calc(var(--line) * 2);
  text-shadow: 2px 2px 0 #000;
}

.doc-date {
  margin: 4px 0 0;
  color: var(--muted);
  text-shadow: 2px 2px 0 #000;
}

.doc .panel {
  margin: 0 0 28px;
  scroll-margin-top: 16px;
}

.doc-note,
.doc-intro {
  margin: 0 0 28px;
  padding: 14px 20px;
}

.doc-note {
  color: var(--muted);
  background: var(--panel);
  box-shadow: var(--bevel);
}

.doc-intro {
  border-inline-start: 6px solid var(--gold);
}

.doc .panel-body > * + * {
  margin-top: 16px;
}

.doc-contents ol {
  margin: 0;
  padding: 16px 20px 18px;
  padding-inline-start: calc(20px + 2.5em);
  columns: 2;
  column-gap: 40px;
}

.doc-contents li {
  break-inside: avoid;
  color: var(--gold);
}

.doc-contents a {
  color: var(--ink);
  text-decoration: none;
}

.doc-contents a:hover {
  color: var(--gold);
  text-decoration: underline;
}

.doc-list {
  max-width: 44em;
  padding: 0;
  list-style: none;
}

.doc-list li {
  position: relative;
  padding-inline-start: 26px;
}

.doc-list li + li {
  margin-top: 10px;
}

.doc-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  inset-block-start: calc((var(--line) - 8px) / 2);
  width: 8px;
  height: 8px;
  background: var(--gold);
  box-shadow: 0 0 0 2px #000;
}

.doc-warning {
  padding: 10px 14px;
  background: rgba(255, 210, 90, 0.08);
  box-shadow: inset 4px 0 var(--gold);
}

[dir="rtl"] .doc-warning {
  box-shadow: inset -4px 0 var(--gold);
}

.doc-fine {
  color: var(--muted);
}

/* The contact address, an image of it in the page's font (drawn at three
   times 16 px, shown at a third): its box is the 24 px line, 5 px of it
   below the baseline. */
.contact {
  display: inline;
  vertical-align: -5px;
}

/* --- small screens and motion ---------------------------------------------- */

@media (max-width: 760px) {
  .name {
    font-size: 48px;
  }

  .tagline {
    font-size: 16px;
    line-height: var(--line);
  }

  .panel {
    margin: 0 12px 48px;
  }

  .panel-title {
    font-size: 16px;
    line-height: var(--line);
    padding: 8px 14px;
  }

  .panel-body {
    padding: 14px;
  }

  .stills.three,
  .stills.two {
    grid-template-columns: 1fr;
  }

  .stills.four {
    grid-template-columns: repeat(2, 1fr);
  }

  .store {
    min-width: 0;
    flex: 1 1 140px;
    padding: 8px 12px 10px;
  }

  .store-name {
    font-size: 20px;
    line-height: 28px;
    white-space: nowrap;
  }

  .quickbar button {
    padding: 4px 10px;
  }

  .doc {
    padding: 72px 12px 32px;
  }

  .doc .panel,
  .doc-note,
  .doc-intro {
    margin: 0 0 20px;
  }

  .doc-note,
  .doc-intro {
    padding: 12px 14px;
  }

  .doc-title {
    font-size: 16px;
    line-height: var(--line);
    margin-top: 20px;
  }

  .doc-app {
    font-size: 24px;
    line-height: 32px;
  }

  .doc-app img {
    width: 40px;
    height: 40px;
    border-radius: 9px;
  }

  .doc-contents ol {
    columns: 1;
    padding: 12px 14px 14px;
    padding-inline-start: calc(14px + 2.5em);
  }
}

@media (prefers-reduced-motion: reduce) {
  .led,
  .scroll-cue {
    animation: none;
  }

  .backdrop-world {
    transition: none;
  }
}
