/* ==========================================================================
   asemoon.app — night sky, moonlight, quiet.
   Palette from the app: night-sky black, moon-white, two greys and a faint
   sky blue used sparingly (the point dots and the keyboard focus ring).
   ========================================================================== */

@font-face {
  font-family: "Asemoon Display";
  src: url("/assets/fonts/InterDisplay-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Asemoon Text";
  src: url("/assets/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}
@font-face {
  font-family: "Asemoon Text";
  src: url("/assets/fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: optional;
}

:root {
  color-scheme: dark;

  --bg: #050608;
  --bg-2: #0b0d12;
  --line: rgba(238, 241, 246, 0.09);
  --line-2: rgba(238, 241, 246, 0.16);
  --line-3: rgba(238, 241, 246, 0.34);
  --fg: #eef1f6;
  --fg-2: #b3b9c4;
  --fg-3: #767d8a;
  --silver: #d3d8e0; /* same as the app wordmark */
  --sky: #a9c3e6;

  --gutter: clamp(16px, 4.45vw, 64px);
  --max: 1200px;

  --f-sys: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --f-display: "Asemoon Display", "Asemoon Text", var(--f-sys);
  --f-text: "Asemoon Text", var(--f-sys);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

[hidden] { display: none !important; }

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

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.6 var(--f-text);
  font-feature-settings: "calt", "kern";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; }
ul, ol { margin: 0; padding: 0; }

::selection { background: var(--fg); color: var(--bg); }

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

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

.skip {
  position: absolute; left: var(--gutter); top: 12px; z-index: 50;
  padding: 12px 16px; border-radius: 999px;
  background: var(--fg); color: var(--bg);
  font: 500 14px/1 var(--f-text); text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease-out);
}
.skip:focus { transform: none; }

/* Tiny uppercase label: the voice for metadata */
.label {
  font: 500 11px/1.2 var(--f-text);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-feature-settings: "case", "tnum";
}

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

.bar, main, .foot { position: relative; z-index: 1; }

/* Inner pages: a faint glow of sky at the top, nothing more */
body:not(.home)::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 560px;
  background: radial-gradient(ellipse 80% 100% at 50% 0, rgba(169, 195, 230, 0.055), transparent 70%);
  pointer-events: none;
}

/* The name: "Ase" in silver, "moon" in moonlight white */
.ase { color: var(--silver); }
.moon { color: #fff; }

/* --------------------------------------------------------------------------
   The sky behind the hero: a blurred render of the app's sky, drifting
   very slowly (still when the system asks for reduced motion).
   -------------------------------------------------------------------------- */

.sky {
  position: absolute;
  inset: 0 0 auto;
  height: min(118vh, 1100px);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 38%, rgba(0, 0, 0, 0.45) 64%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 0, #000 38%, rgba(0, 0, 0, 0.45) 64%, transparent 92%);
}
.sky picture {
  position: absolute;
  inset: -6% -8% 0;
  opacity: 0.5;
  -webkit-mask-image: radial-gradient(ellipse 58% 52% at 50% 42%, #000 40%, rgba(0, 0, 0, 0.5) 72%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 52% at 50% 42%, #000 40%, rgba(0, 0, 0, 0.5) 72%, transparent 100%);
  animation: drift 80s ease-in-out infinite alternate;
  will-change: transform;
}
.sky img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
@keyframes drift {
  from { transform: scale(1.04) rotate(-1.2deg); }
  to { transform: scale(1.1) rotate(1.4deg) translate3d(1.5%, -1%, 0); }
}

/* --------------------------------------------------------------------------
   Top bar (privacy, support, 404)
   -------------------------------------------------------------------------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: 18px;
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font: 500 16px/1 var(--f-text);
  letter-spacing: 0.005em;
  text-decoration: none;
}
.mark img { width: 28px; height: 28px; }
.nav { display: flex; gap: 2px; margin-right: -12px; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--fg-2);
  text-decoration: none;
  text-underline-offset: 0.35em;
  text-decoration-thickness: 1px;
  transition: color 0.3s;
}
.nav a[aria-current] { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-3); }

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center;
  gap: 40px 56px;
  min-height: min(100svh - 80px, 880px);
  padding-top: max(clamp(32px, 9vh, 96px), env(safe-area-inset-top));
  padding-bottom: clamp(48px, 9vh, 96px);
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  box-shadow: 0 0 0 1px rgba(238, 241, 246, 0.12), 0 18px 40px -14px #000;
  margin-bottom: clamp(24px, 4vh, 36px);
}

.wordmark {
  font: 300 clamp(3.7rem, 8vw, 7rem)/0.9 var(--f-display);
  letter-spacing: -0.045em;
  margin-left: -0.045em;
}
.wordmark .moon { text-shadow: 0 0 34px rgba(238, 241, 246, 0.22); }

.tagline {
  margin-top: clamp(14px, 2vw, 22px);
  font: 300 clamp(1.55rem, 2.6vw, 2.15rem)/1.15 var(--f-display);
  letter-spacing: -0.02em;
  color: var(--fg);
}
.lede {
  margin-top: 18px;
  max-width: 40ch;
  font-size: clamp(16px, 1.25vw, 17.5px);
  line-height: 1.62;
  color: var(--fg-2);
  text-wrap: pretty;
}

.cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 440px;
  margin-top: clamp(28px, 4.5vh, 40px);
}
.cta .btn--primary { grid-column: 1 / -1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 24px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font: 500 16px/1 var(--f-text);
  letter-spacing: 0.005em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.35s var(--ease-out), border-color 0.35s, box-shadow 0.35s;
}
.btn svg { width: 15px; height: 15px; flex: none; transition: transform 0.45s var(--ease-out); }
.btn--primary {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  box-shadow: 0 0 0 0 rgba(238, 241, 246, 0), 0 16px 44px -18px rgba(238, 241, 246, 0.45);
}
.btn--primary:focus-visible { background: #fff; }
.btn--primary:focus-visible svg { transform: translate(2px, -2px); }

/* Store buttons, not live yet: quiet, dashed, not clickable */
.store {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 54px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px dashed rgba(238, 241, 246, 0.22);
  text-align: center;
  white-space: nowrap;
}
.store b { font: 500 14px/1 var(--f-text); color: var(--fg); }
.store span { font: 500 10.5px/1 var(--f-text); letter-spacing: 0.15em; text-transform: uppercase; color: var(--fg-2); }

.points {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 28px;
}
.points li {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--fg-2);
}
.points li::before {
  content: "";
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--sky);
  box-shadow: 0 0 8px rgba(169, 195, 230, 0.9);
}

/* Three phones, fanned: the sky in front, a card and a twilight behind */
.fan {
  list-style: none;
  position: relative;
  width: min(100%, 600px);
  margin: 0 auto;
  aspect-ratio: 1 / 0.88;
}
.fan li { position: absolute; }
.fan figure { margin: 0; }
.fan__side { width: 41%; top: 8.5%; }
.fan__side:first-child { left: 0; transform: rotate(-6deg); }
.fan__side:last-child { right: 0; transform: rotate(6deg); }
.fan__front { width: 49%; top: 0; left: 25.5%; z-index: 2; }

.shot {
  position: relative;
  border-radius: 10% / 5.9%;
  overflow: hidden;
  background: var(--bg-2);
  box-shadow:
    0 0 0 1px rgba(238, 241, 246, 0.13),
    0 40px 70px -26px #000;
}
.fan__front .shot {
  box-shadow:
    0 0 0 1px rgba(238, 241, 246, 0.2),
    0 0 0 7px rgba(5, 6, 8, 0.9),
    0 0 0 8px rgba(238, 241, 246, 0.07),
    0 50px 90px -24px #000;
}
.shot img { width: 100%; height: auto; aspect-ratio: 600 / 1022; object-fit: cover; }
/* The two behind sit a little in the dark */
.fan__side .shot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.42);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.foot { margin-top: auto; }
.foot__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 32px;
  padding-top: 14px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--fg-3);
}
.foot__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; margin: 0; }
.foot__row [aria-hidden] { color: rgba(238, 241, 246, 0.2); }
.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--fg-2);
  text-decoration: none;
  transition: color 0.3s;
}
.foot a[aria-current] { color: var(--fg); }

/* --------------------------------------------------------------------------
   Long text (privacy, support)
   -------------------------------------------------------------------------- */

.page-head {
  padding-top: clamp(24px, 7vh, 88px);
  padding-bottom: clamp(32px, 6vh, 72px);
}
.page-head .doc-date { margin-top: 24px; }

.crumbs { margin-bottom: 22px; }
.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 14px;
  line-height: 1.3;
  color: var(--fg-3);
}
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before {
  content: "/";
  margin: 0 10px;
  color: rgba(238, 241, 246, 0.24);
}
.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--fg-2);
  text-decoration: none;
  transition: color 0.25s;
}
.crumbs [aria-current] { color: var(--fg); }

.display {
  font: 300 clamp(2.5rem, 5.4vw, 4.6rem)/1 var(--f-display);
  letter-spacing: -0.04em;
  max-width: 17ch;
  text-wrap: balance;
}

.doc {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 32px;
  padding-top: clamp(28px, 5vh, 56px);
  padding-bottom: clamp(56px, 10vh, 120px);
  border-top: 1px solid var(--line);
}
.toc { position: sticky; top: 28px; align-self: start; }
.toc ol { list-style: none; display: grid; gap: 2px; margin-top: 16px; }
.toc a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--fg-3);
  text-decoration: none;
  transition: color 0.25s;
}
.toc a:focus-visible { color: var(--fg); }

.num {
  flex: none;
  font: 500 11px/1 var(--f-text);
  letter-spacing: 0.08em;
  font-feature-settings: "tnum";
  color: var(--fg-3);
}
.toc .num { min-width: 2.2em; }

.prose { max-width: 66ch; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 2.6em;
  padding-top: 0.2em;
  font: 300 clamp(1.5rem, 2vw, 1.75rem)/1.2 var(--f-display);
  letter-spacing: -0.02em;
  color: var(--fg);
  scroll-margin-top: 24px;
}
.prose h2 .num { min-width: 2.4em; }
.prose .lead + h2 { margin-top: 2em; }
.prose p, .prose li { font-size: 16.5px; line-height: 1.72; color: var(--fg-2); text-wrap: pretty; }
.prose ul { padding-left: 1.1em; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--fg-3); }
.prose strong { font-weight: 500; color: var(--fg); }
.prose .lead { font-size: clamp(17px, 1.4vw, 19px); color: var(--fg); }
.prose a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--line-3);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  overflow-wrap: anywhere;
  transition: text-decoration-color 0.3s;
}
.prose a:focus-visible { text-decoration-color: var(--fg); }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 14px 0;
  cursor: pointer;
  list-style: none;
  font-size: 16.5px;
  line-height: 1.45;
  color: var(--fg);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 9px; height: 9px;
  margin-right: 4px;
  border-right: 1px solid var(--fg-2);
  border-bottom: 1px solid var(--fg-2);
  transform: translateY(-3px) rotate(45deg);
  transition: transform 0.35s var(--ease-out);
}
.faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.faq details > div { padding: 0 0 22px; display: grid; gap: 0.8em; }

/* A placeholder still to fill in: [in square brackets], deliberately obvious */
.ph {
  padding: 0.05em 0.35em;
  border: 1px dashed rgba(238, 241, 246, 0.42);
  border-radius: 4px;
  background: rgba(238, 241, 246, 0.05);
  color: var(--fg);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.nf {
  flex: 1;
  display: grid;
  align-content: center;
  justify-items: start;
  padding-top: 32px;
  padding-bottom: 72px;
}
.nf__num {
  font: 300 clamp(7rem, 30vw, 20rem)/0.8 var(--f-display);
  letter-spacing: -0.06em;
  margin: 0 0 20px -0.05em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(238, 241, 246, 0.16);
  user-select: none;
}
.nf .label { margin-bottom: 18px; }
.nf p:not(.label) { margin-top: 20px; max-width: 40ch; color: var(--fg-2); }
.nf .btn { margin-top: 32px; }

/* --------------------------------------------------------------------------
   Mouse and trackpad only, so nothing sticks after a tap
   -------------------------------------------------------------------------- */

@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: #fff; box-shadow: 0 0 0 4px rgba(238, 241, 246, 0.08), 0 16px 44px -14px rgba(238, 241, 246, 0.55); }
  .btn--primary:hover svg { transform: translate(2px, -2px); }
  .nav a:hover, .crumbs a:hover, .foot a:hover, .toc a:hover { color: var(--fg); }
  .prose a:hover { text-decoration-color: var(--fg); }
  .faq summary:hover::after { border-color: var(--fg); }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 880px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    gap: 56px;
    padding-top: max(28px, env(safe-area-inset-top));
  }
  .fan { width: min(100%, 460px); }
  .hero { padding-bottom: 40px; }
}

@media (max-width: 520px) {
  .points { flex-direction: column; gap: 12px; }
}

@media (max-width: 720px) {
  .doc { grid-template-columns: 1fr; gap: 8px; padding-top: 22px; }
  .toc { position: static; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
  .toc ol { display: flex; flex-wrap: wrap; gap: 0 20px; margin-top: 10px; }
  .toc a { gap: 7px; color: var(--fg-2); }
  .toc .num { min-width: 0; }
  .prose { padding-top: 22px; }
  .prose h2 { gap: 12px; }
  .prose h2 .num { min-width: 0; }
  .page-head { padding-top: 20px; padding-bottom: 36px; }
  .foot__in { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 6px; }
}

@media (max-width: 380px) {
  .store { padding: 0 8px; }
  .store b { font-size: 13px; }
  .points { gap: 10px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sky picture { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

@media (forced-colors: active) {
  .store { border-style: dashed; }
  .points li::before { background: CanvasText; }
}
