/*
 * The landing palette (decision 0044): the project's landing page and each sub-project's home are
 * drawn in their own colours and display face, not in the visitor's theme. A page opts in with
 * data-surface="landing" on its root element. Every other page keeps the six themes in tokens.css.
 *
 * Cotton (unbleached cotton, the kasavu cloth's ground) is the default. Lamp-light is used when
 * the reader's theme is a dark one, chosen or given by a dark device (decision 0037), and, with
 * JavaScript off, when the device prefers dark. The values are the palette studies' own
 * (docs/design/landing/ad-first/tools/palettes.data.mjs); their contrast is checked in
 * landing.test.ts. The hand pictures are rendered on --landing-bg, so a change here is a change
 * to tools/landing-render/palettes.mjs too.
 *
 * Each palette sets the landing tokens and maps them onto the theme tokens, so the shared header,
 * menu, buttons and footer take the palette with no component written for it.
 */

:root[data-surface="landing"] {
  color-scheme: light;
  --landing-palette: cotton;
  --landing-bg: #f1e9d8;
  --landing-surface: #e4d9c1;
  --landing-ink: #1d1712;
  --landing-muted: #665a4b;
  --landing-line: #d3c7ad;
  /* One accent: a restrained red. And one metal: the kasavu border's gold taken down to brass. */
  --landing-accent: #8f2a26;
  --landing-metal: #75581c;
  /* Brass, for the headline's second line and the small capitals above it. */
  --landing-brass: #75581c;
  --landing-button: #1d1712;
  --landing-button-ink: #f1e9d8;
  /* The line drawings' ink, and the seal: the one red round, with its word reversed out of it. */
  --landing-line-ink: #4a3f33;
  --landing-seal: #8f2a26;
  --landing-seal-ink: #f1e9d8;

  /* Type: heavy, narrow display; the site's text and Devanagari faces. */
  --font-landing-display: "Anek Latin Display", "Anek Display Fallback", "Arial Narrow", sans-serif;
  --font-landing-names: "Tiro Devanagari Landing", "Tiro Devanagari Sanskrit", serif;
  --weight-landing-display: 700;
  --text-landing-hero: clamp(3.5rem, 1.2rem + 11.5vw, 9.5rem);
  --text-landing-heading: clamp(2.5rem, 1.4rem + 4.8vw, 5rem);
  --text-landing-name: clamp(2.75rem, 1.6rem + 5vw, 5.5rem);
  --leading-landing-display: 0.9;
  --tracking-landing-display: -0.01em;
  --duration-landing-name: 360ms;
  --duration-landing-loop: 600ms;
  /* How strongly the film grain over the moving hand shows (apps/web/src/styles.css). */
  --landing-grain: 0.4;

  /*
   * The main landing page's type (feature umbrella-landing). Its headings are the display face
   * above; beside it, one variable cut of Anek Latin (widths 75 to 100, weights 300 to 700) for
   * the seal's small capitals, the doors' light second word, the buttons and the text; and the
   * seal's one Devanagari word, bold. Its hero and headings are smaller than a sub-project's,
   * because they share the first screen with the seal.
   */
  --font-landing-text: "Anek Latin Landing", "Anek Fallback", system-ui, sans-serif;
  --font-landing-seal: "Anek Devanagari Seal", "Anek Latin Landing", sans-serif;
  --weight-landing-light: 300;
  --weight-landing-strong: 600;
  --weight-landing-seal: 800;
  --stretch-landing-display: 75%;
  --stretch-landing-label: 87.5%;
  --text-landing-hero-beside: clamp(3.4rem, 1.4rem + 8.5vw, 6.75rem);
  --text-landing-heading-beside: clamp(2.25rem, 1.4rem + 3.8vw, 4.25rem);
  --text-landing-door: 1.75rem;
  --text-landing-door-wide: 1.875rem;
  --text-landing-door-open: 2.25rem;
  --text-landing-seal-word: 74px;
  --leading-landing-heading: 0.95;
  --tracking-landing-label: 0.13em;
  --radius-landing-card: 0.5rem;
  --size-landing-figure: 4.5rem;
  --size-landing-figure-wide: 6.5rem;
}

/* Lamp-light: the reader's theme is dark. Every theme whose themeInfo says dark is named here. */
:root[data-surface="landing"][data-theme="mayura"],
:root[data-surface="landing"][data-theme="shyama"] {
  color-scheme: dark;
  --landing-palette: lamp;
  --landing-bg: #15100b;
  --landing-surface: #2b2117;
  --landing-ink: #efe6d2;
  --landing-muted: #a99d87;
  --landing-line: #3a2f23;
  --landing-accent: #bb964e;
  --landing-metal: #a99d87;
  --landing-brass: #bb964e;
  --landing-button: #efe6d2;
  --landing-button-ink: #15100b;
  --landing-line-ink: #d8c9a6;
  --landing-seal: #bb964e;
  --landing-seal-ink: #15100b;
}

/* With JavaScript off no theme is applied, so the device's own setting decides. */
@media (prefers-color-scheme: dark) {
  :root[data-surface="landing"]:not([data-js]) {
    color-scheme: dark;
    --landing-palette: lamp;
    --landing-bg: #15100b;
    --landing-surface: #2b2117;
    --landing-ink: #efe6d2;
    --landing-muted: #a99d87;
    --landing-line: #3a2f23;
    --landing-accent: #bb964e;
    --landing-metal: #a99d87;
    --landing-brass: #bb964e;
    --landing-button: #efe6d2;
    --landing-button-ink: #15100b;
    --landing-line-ink: #d8c9a6;
    --landing-seal: #bb964e;
    --landing-seal-ink: #15100b;
  }
}

/* The landing tokens onto the theme tokens. */
:root[data-surface="landing"] {
  --color-bg: var(--landing-bg);
  --color-surface: var(--landing-surface);
  --color-ink: var(--landing-ink);
  --color-muted: var(--landing-muted);
  --color-line: var(--landing-line);
  --color-accent: var(--landing-metal);
  --color-accent-ink: var(--landing-metal);
  --color-name: var(--landing-ink);
  --color-button: var(--landing-button);
  --color-button-ink: var(--landing-button-ink);
  --radius-control: 999px;
  /* The wordmark and every display heading of a landing page are set in the landing face. */
  --font-display: var(--font-landing-display);
  --weight-display: var(--weight-landing-display);
  --tracking-display: var(--tracking-landing-display);
  --font-text: "Anek Latin Variable", "Anek Fallback", system-ui, sans-serif;
  --font-indic: "Tiro Devanagari Sanskrit", var(--font-scripts), serif;
  --weight-indic: 400;
}
