/* The account pages (account_page.html: Sign in, Create an Account and the five pages of messages and passwords) on
   the landing page's night-to-dawn sky, behind a solid card (the account-pages decisions in docs/plans/ui-redesign.md,
   amending C158, C159 and C282). Linked after style.css, whose tokens, type, boxes and buttons it uses; no colour of
   its own. Three levels, each whole without the next:
   1. the theme's still (the night in the dark theme, the dawn in the light one), chosen here from the theme's
      switches, so it needs no script and only that picture is fetched; the card; the dust's first words as text;
   2. on Sign in and Create an Account, pages.js: the words change as the form fills; in the dark theme the dawn still
      rises from the horizon with the form (`.sky-day`, --sky-day; not where data is saved); on sending the sun
      blooms at the horizon (--sky-horizon) and the day star flies into the button (`.is-sending`);
   3. the 3D scene on the canvas over the stills, once it has drawn (html.has-scene): pages.js and sky.js.
   Under reduced motion only level 1 and the changing words; nothing moves. */

/* The page and its footer share the window, with no guess at the footer's height: a window from about 720 px tall
   holds either form without scrolling; a shorter one, larger text or zoom scrolls (WCAG reflow). */
body { display: flex; flex-direction: column; min-height: 100vh; }
main.sky-form { flex: 1 0 auto; align-self: stretch; min-height: 0; margin: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(20rem, 28rem); grid-template-rows: auto 1fr;
  grid-template-areas: "head head" "side card"; gap: var(--space-5) var(--space-8); padding: var(--space-6) 4.5rem; }
main.sky-form ~ .version { max-width: none; width: 100%; }   /* a full band of the surface, below the sky */

/* The stage, fixed behind everything: the stills, the canvas, the bloom, and a scrim of the page's colour on the
   words' side, deeper behind the headline, which sits on the horizon where the dawn rises, so the words keep their
   contrast over the brightest sky (C163; measured, C371). */
.sky-stage { position: fixed; inset: 0; z-index: -1; background: var(--color-bg-page); }
.sky-still, .sky-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky-still { background: center / cover no-repeat; }
.sky-still--night { background-image: var(--when-light, none) var(--when-dark, url("/static/landing/night.jpg")); }
.sky-still--dawn { background-image: var(--when-light, url("/static/landing/dawn.jpg")) var(--when-dark, none); }
.sky-canvas { display: none; }
.has-scene .sky-canvas { display: block; }
.sky-stage::before { content: ""; position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(62% 50% at 0% 82%, color-mix(in srgb, var(--color-bg-page) 85%, transparent), transparent),
    linear-gradient(90deg, color-mix(in srgb, var(--color-bg-page) 55%, transparent),
    color-mix(in srgb, var(--color-bg-page) 30%, transparent) 40%, transparent 65%); }
.sky-head, .sky-words, .sky-said { text-shadow: 0 0 1.4em color-mix(in srgb, var(--color-bg-page) 80%, transparent),
  0 0 .3em color-mix(in srgb, var(--color-bg-page) 60%, transparent); }

/* Level 2's day, 0 to 1 (pages.js): the dawn still shows from the horizon up, higher as the day comes. */
@property --sky-day { syntax: "<number>"; inherits: true; initial-value: 0; }
.sky-day .sky-still--night { background-image: url("/static/landing/night.jpg"); }
.sky-day .sky-still--dawn { background-image: url("/static/landing/dawn.jpg");
  mask-image: linear-gradient(to top, var(--color-bg-page) calc(var(--sky-day) * 160% - 60%), transparent calc(var(--sky-day) * 160%)); }
/* the sun's bloom at the horizon on sending (the scene has its own sun) */
.sky-stage::after { content: ""; position: absolute; z-index: 2; left: 50%; top: var(--sky-horizon); width: 46vmax; height: 46vmax;
  margin: -23vmax; border-radius: 50%; opacity: 0; scale: .25; pointer-events: none;
  background: radial-gradient(closest-side, var(--color-text-on-accent) 0 3%, color-mix(in srgb, var(--color-sky-glow) 70%, transparent) 14%,
    color-mix(in srgb, var(--color-sky-glow) 0%, transparent) 70%); }
.is-sending .sky-stage::after { opacity: .8; scale: 1; }
.has-scene .sky-stage::after { display: none; }

/* The header, the headline and the dust's words on the left; the card on the right. */
.sky-head { grid-area: head; display: flex; justify-content: flex-end; align-items: center; }  /* only Sign out (C327) */
.sky-head form { margin: 0; }
.sky-side { grid-area: side; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0;
  padding-bottom: 6vh; container-type: inline-size; }
.sky-said { margin: auto 0; min-height: 1.3em; font: 600 min(4.8rem, 8cqi)/1.2 var(--font-mono); white-space: nowrap; }
.has-scene .sky-said { opacity: 0; }                     /* the dust writes the words; the letters then take its place */
.has-scene .sky-said.is-written { opacity: 1; }
.sky-words { max-width: 48cqi; margin: 0; font: var(--text-display); font-size: max(1rem, 4cqi);
  letter-spacing: var(--text-display-tracking); color: var(--color-text-primary); }
/* The signature (C327): the large logo, the calligraphy over Thaqib in italic, above the tagline; a link home. */
.sky-logo { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); width: max-content;
  margin-bottom: var(--space-5); text-decoration: none; }
.sky-logo .logo-ar { height: clamp(4rem, 18cqi, 7rem); }
.sky-logo .logo-en-script { height: clamp(1.1rem, 5cqi, 1.9rem); }

/* The card: solid enough to read over the brightest sky, in both themes, and still. */
.sky-card { grid-area: card; align-self: center; width: 100%; padding: 1.75rem 2rem; overflow-wrap: anywhere; }  /* a long email */
.sky-card.glass { background: color-mix(in srgb, var(--color-bg-surface) var(--when-light, 92%) var(--when-dark, 88%), transparent);
  backdrop-filter: none; }
.sky-card h1 { margin: 0 0 var(--space-3); font-size: 1.75rem; }
.sky-card h2 { margin: var(--space-7) 0 var(--space-3); font: var(--text-h3); }
.sky-card .lead { margin: 0 0 var(--space-5); font: var(--text-meta); color: var(--color-text-muted); }
.sky-card .small { font: var(--text-caption); color: var(--color-text-muted); }
.sky-card .notice { margin: 0 0 var(--space-5); padding: var(--space-4) var(--space-5); border-radius: var(--radius-xl); font: var(--text-meta); }
.sky-card .maintenance-message p { margin: 0 0 var(--space-3); }  /* the maintenance page's lines (maintenance.html) */
.sky-card .notice:not(.error, .ok) { border-color: var(--color-border-accent-subtle); background: var(--color-bg-accent-subtle); }
.sky-card form.stack { max-width: none; gap: var(--space-4); }
.sky-card form.stack label { font: var(--text-dense-strong); }
.sky-card form.stack label:not(:first-of-type) { margin-top: var(--space-4); }
.sky-card form.stack :is(input:not([type=hidden]), .country-box select) { width: 100%; height: max(46px, 2.5rem + 2px); padding: 0 .875rem;
  border-radius: var(--radius-xl); }
.sky-card button, .sky-card a.button, .sky-head button { min-height: 44px; border-radius: var(--radius-xl); font: var(--text-button); }
.sky-card form.stack button[type=submit]:not(.secondary) { min-height: 48px; margin-top: var(--space-5);
  background: linear-gradient(var(--color-bg-accent-top-strong), var(--color-bg-accent-bottom-strong)); }
.sky-card button[type=submit]:not(.secondary) { box-shadow: 0 8px 18px -4px rgb(0 0 0 / .2); }   /* under the star's ring */
.sky-card form.stack button.secondary { align-self: flex-start; margin-top: var(--space-4); }
.sky-card .links a, .forgot a, .card-foot a { font-weight: 600; text-decoration: none; }
.sky-card .links { margin: 0 0 var(--space-5); font: var(--text-meta); }
.sky-card ul.links { padding-left: 1.1rem; }
/* "Forgot your password?" under the password box, so that the Tab key goes from the email to the password */
.forgot { margin: calc(-1 * var(--space-2)) 0 0; text-align: right; font: var(--text-meta); }
.password-box { position: relative; }
.sky-card form.stack .password-box input { padding-right: 5rem; }  /* room for Show (account.js) */
.show-password { position: absolute; right: var(--space-2); top: 50%; translate: 0 -50%; min-height: 2.25rem; padding: 0 var(--space-4);
  border: 0; background: none; color: var(--color-text-accent); font: var(--text-dense-strong); }
.card-foot { margin: var(--space-6) 0 0; text-align: center; font: var(--text-caption); color: var(--color-text-muted); }
.card-foot p { margin: 0 0 var(--space-3); }
.card-foot form { margin: 0; }
/* The star's attention, on the box itself: the accent where the scene's light reads, amber on a slip in the email. */
.has-scene .sky-card form.stack .is-read { border-color: var(--color-border-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-text-accent) 28%, transparent), 0 0 1.25rem color-mix(in srgb, var(--color-text-accent) 22%, transparent); }
.sky-card form.stack .is-slip { border-color: var(--color-border-above);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-border-above) 30%, transparent); }

/* Sending: the button becomes the star's (landing/star.css): its mark's room is kept from the moment it is pressed,
   and when the star lands the mark comes in and a ring opens (pages.js marks it `is-landed`). */
.is-sending .sky-card form button[type=submit] { --star-landed: 0; --star-ring: 0; }
.is-sending .sky-card form button.is-landed { --star-landed: 1; --star-ring: 1; }

/* A phone: the form as near the top as it can be, with the dust's line and a smaller headline above it and no room
   held for the sky, which shows round the card and behind it; the email box and the button are on the first screen. */
@media (max-width: 40rem) {
  main.sky-form { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "side" "card"; gap: var(--space-4);
    padding: var(--space-6) var(--space-5) var(--space-7); }
  .sky-side { padding-bottom: 0; gap: var(--space-3); }
  .sky-said { margin: 0; font-size: 1.5rem; }
  .sky-words { max-width: none; font-size: 1.25rem; }
  .sky-logo { margin-bottom: var(--space-3); }
  .sky-logo .logo-ar { height: 3.25rem; }
  .sky-logo .logo-en-script { height: 1rem; }
  .sky-card { padding: var(--space-7) var(--space-6); border-radius: var(--radius-2xl); }
  .sky-card .lead { margin-bottom: var(--space-4); }
  .forgot a, .sky-card .links a, .card-foot a { display: inline-flex; align-items: center; min-height: 44px; }  /* C163 */
  .show-password { min-height: 44px; }
}

/* Motion, all of it here: none under reduced motion, nor on paper. */
@media screen and (prefers-reduced-motion: no-preference) {
  .sky-day { transition: --sky-day 1.6s ease; }
  .sky-stage::after { transition: opacity .9s ease-out, scale .9s ease-out; }
  .has-scene .sky-said.is-written { transition: opacity .5s; }
  .sky-said.is-new { animation: sky-said-in .6s ease-out; }
  .is-sending .day-star { display: block; }
  .is-sending .sky-card form button.is-landed { transition: --star-landed .5s, --star-ring 1s ease-out; }   /* only as it lands */
  @keyframes sky-said-in { from { opacity: 0; translate: 0 .25em; } }
}

@media print {
  body { display: block; }
  main.sky-form { display: block; padding: 0; }
  .sky-stage, .sky-said, .sky-side { display: none; }
}
