/*
 * site.css: what every Scrollible page shares. The page ground, the header
 * and footer, the store badges, and the two kinds of page body: the reading
 * column (.doc, the privacy policy) and the centred invitation (.hero, the
 * shared-verse page and the homes). Load tokens.css first.
 *
 * Phone first. Most visitors arrive from a shared link on a phone, so every
 * size here is for a 375px screen and the desktop simply gets a centred
 * column.
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

/* THE PAGE GROUND (PageGround.swift). Light from above that has eased into
   the page by 420px (never past 60 % of a short screen), the page flat to
   70 %, then a foot a little deeper. Pinned to the screen, as the app's
   is, so a long page keeps its light at the top of the glass. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    var(--ground-top) 0,
    rgba(255, 255, 255, 0) min(420px, 60%),
    rgba(0, 0, 0, 0) 70%,
    var(--ground-foot) 100%
  );
}

img {
  max-width: 100%;
}

a {
  color: inherit;
}

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -120px;
  z-index: 10;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

/* One column, the app's 16px gutter, and the phone's safe areas. */
.site-head,
.site-foot,
.doc,
.hero {
  width: 100%;
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

/* ---------------------------------------------------------------- header */

.site-head {
  max-width: 44rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding-top: env(safe-area-inset-top);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  color: var(--ink);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-radius: 10px;
}

/* The app icon, cut the way iOS cuts it. */
.brand-icon {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 22.5%;
  box-shadow: 0 0 0 0.5px var(--edge);
}

.site-nav {
  display: flex;
  gap: 4px;
}

.site-nav a,
.site-foot a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 8px;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: 10px;
}

.site-nav a {
  font-size: 0.9375rem;
}

.site-nav a:hover,
.site-foot a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
}

/* ---------------------------------------------------------------- footer */

.site-foot {
  max-width: 44rem;
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  color: var(--ink-muted);
  font-size: 0.8125rem;
  text-align: center;
}

.site-foot nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.site-foot p {
  margin: 4px 0 0;
}

/* ---------------------------------------------------------- store badges */

/* THE OFFICIAL BADGES, UNALTERED, AT THE SAME HEIGHT.
 *
 * Apple: the badge at least 40px tall on screen, clear space all round of a
 * quarter of its height, the App Store badge first in any line of badges,
 * and the preferred black badge whenever another store's badge is beside
 * it (so black in both looks).
 * Google: at least 28px, the same size as or larger than the other store's
 * badge, and a quarter of its height clear all round. Google's file already
 * carries 41/168 of its badge height as transparent margin; the margin
 * below tops that up to the full quarter.
 *
 * The clear space is kept INSIDE each link, so it is empty padding and part
 * of the tap target (60px tall, over the app's 44). Each badge is a real
 * link to its store page (the addresses are in shared/config.js); before
 * the app is in that store, a plain note stands in (.store-soon, below). */
.stores {
  --badge-h: 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}

.store {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 14px;
  text-decoration: none;
}

.store img {
  display: block;
  width: auto;
  max-width: none;
}

.store-apple img {
  height: var(--badge-h);
  margin: calc(var(--badge-h) / 4);
}

.store-google img {
  height: calc(var(--badge-h) * 250 / 168);
  margin: calc(var(--badge-h) / 4 - var(--badge-h) * 41 / 168);
}

a.store:focus-visible {
  outline-offset: -2px;
}

/* PRE-LAUNCH: "Coming soon to the App Store" / "Coming soon to Google Play".
 * Before the app is in a store, its badge's place holds this note instead
 * (the build writes it while that link in shared/config.js is empty). It is
 * plain text, not a link, and carries no store artwork: Apple and Google
 * allow their badges only as links to a live store page. It keeps the
 * badge's 40px height and quarter-height clear space, so the row keeps its
 * shape and the two notes sit side by side on a phone, as the badges will.
 * A hairline and muted ink keep it quieter than a real badge. The note is a
 * <p>, so its rules name .stores too, to outrank the policy page's .doc p. */
.stores .store-soon {
  justify-content: center;
  min-width: 136px;
  height: var(--badge-h);
  margin: calc(var(--badge-h) / 4);
  padding: 0 12px;
  border: 1px solid var(--ink-faint);
  border-radius: 8px;
  color: var(--ink-muted);
  font: 500 0.6875rem/1.15 var(--font-ui);
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: default;
}

.stores .store-soon span {
  display: block;
}

.stores .store-soon span + span {
  color: var(--ink-body);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.15;
  letter-spacing: -0.005em;
}

/* ------------------------------------------------------ the reading page */

.doc {
  max-width: 40rem;
  padding-top: 8px;
  padding-bottom: 32px;
}

.doc h1 {
  margin: 20px 0 6px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.875rem, 7.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* "Effective 26 September 2026": the line under the title. */
.doc h1 + p {
  margin-bottom: 1.5em;
  color: var(--ink-muted);
  font-family: var(--font-ui);
  font-size: 0.9375rem;
}

.doc h2 {
  margin: 2em 0 0.45em;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  color: var(--ink);
  scroll-margin-top: 16px;
}

.doc p,
.doc li {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-body);
}

.doc p {
  margin: 0 0 0.85em;
}

.doc ul {
  margin: 0 0 0.85em;
  padding-left: 1.15em;
}

.doc li {
  margin-bottom: 0.6em;
  padding-left: 0.2em;
}

.doc li::marker {
  color: var(--ink-muted);
}

.doc strong {
  font-weight: 600;
  color: var(--ink);
}

.doc a {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

/* The store badges under the policy, on a card standing on the page. */
.get {
  margin: 40px 0 0;
  padding: 18px 8px 10px;
  border-radius: var(--radius-card);
  background: var(--card);
  box-shadow: var(--shadow-card), var(--top-light);
  text-align: center;
}

.get-title {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
  font-size: 1rem;
}

/* ------------------------------------------------------- the invitation */

.hero {
  max-width: 34rem;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 32px;
  text-align: center;
}

/* "Get Scrollible / No Account, No Ads": the shared-verse page's two lines. */
.headline {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  /* the two lines each fit whole down to a 320 px phone */
  font-size: clamp(1.75rem, 9vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* one line each, never broken ("No Account, No Ads" never loses "Ads") */
.headline .line {
  display: block;
  white-space: nowrap;
}

.hero .stores {
  margin-top: 26px;
}

/* WRITTEN ON, NOT FADED IN. The app's hard-won rule for its verses: a
   hard-edged partial reveal turns a half-drawn letter into a different
   letter, so ink arrives through a SOFT ramp and the whole letterform is
   always there, only gaining density. Here the ramp is a gradient mask
   travelling left to right across the words, once. */
.write {
  display: inline-block;
  max-width: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .write {
    -webkit-mask-image: linear-gradient(90deg, #000 40%, rgba(0, 0, 0, 0) 60%);
    mask-image: linear-gradient(90deg, #000 40%, rgba(0, 0, 0, 0) 60%);
    -webkit-mask-size: 250% 100%;
    mask-size: 250% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    animation: write-on 1.5s cubic-bezier(0.45, 0.05, 0.25, 1) 0.15s both;
  }

  @keyframes write-on {
    from {
      -webkit-mask-position: 100% 0;
      mask-position: 100% 0;
    }
    to {
      -webkit-mask-position: 0 0;
      mask-position: 0 0;
    }
  }
}

.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;
}
