/* Alud appearance tokens: Habitat's three appearances, shared by the hub and the
   civic workspace.

   Source: find-house-switzerland frontend/src/styles.css (Editorial) and
   frontend/src/design-b/tokens.css (Alpine), 4 October 2026. Values are copied,
   not reinterpreted, so the three products read as one family.

   - Editorial is the default: paper and ink, zero radius, no shadows, hairline
     rules, oxblood as the only signal.
   - Alpine is enabled by `data-design="b"` on <html>; its dark ground by the
     additional `data-design-mode="dark"`. Dark is an explicit choice and never
     follows the operating system, exactly as in Habitat.

   Components are written against the Editorial names. Alpine re-points those
   names to its own palette, so a component only restates what needs a different
   shape (radius, elevation, weight), never a different colour. */

:root {
  /* ground */
  --paper: #fcfbfa; /* page */
  --surface: #fcfbfa; /* raised object; Editorial has none, so it is paper */
  --paper-sunk: #f2efeb; /* second ground, recessed */
  --ink: #131110; /* 18.22:1 on paper */
  --muted: #5c5751; /* 6.92:1 */
  --faint: #787269; /* 4.61:1 on paper only; never on --paper-sunk */
  --rule: #eae7e4; /* hairlines, never text */
  --rule-firm: #131110; /* heading dividers and table heads */
  --field-edge: #131110; /* a control's edge needs 3:1 */

  /* action: Editorial acts in ink */
  --action: #131110;
  --action-ink: #fcfbfa;
  --action-hover: #3a3532;

  /* signal */
  --oxblood: #7d2620; /* standing signal, 9.36:1 */
  --red: #c8151f; /* closing door: reserve only */
  --red-wash: #fdf3f2;

  /* contour field stroke and strength */
  --contour: #e2ddd8;
  --contour-opacity: 1;

  /* type */
  --sans: "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, sans-serif;
  /* The name and every title, in every appearance (LAYOUT.md "Type"). */
  --title-face: "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, sans-serif;
  --display: var(--title-face);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* shape: Editorial has one corner radius, 0, and no elevation */
  --r-sm: 0;
  --r: 0;
  --r-lg: 0;
  --r-full: 0;
  --shadow-valley: none;
  --shadow-ridge: none;
  --shadow-summit: none;
  --shadow-key: none;
  --shadow-key-accent: none;
  --shadow-field: none;

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 130ms;
  --dur-2: 240ms;
  --dur-3: 420ms;

  /* space */
  --gutter: clamp(20px, 4vw, 56px);
  --frame: 1240px;

  color-scheme: light;
}

/* ---- Alpine, light ground --------------------------------------------- */

:root[data-design="b"] {
  color-scheme: light;

  --b-bg: #f5f7f9;
  --b-surface: #ffffff;
  --b-sunk: #eef2f5;
  --b-sunk-2: #e5ebf0;

  --b-ink: #0b1015; /* 19.1:1 on surface */
  --b-ink-2: #46525e; /* 7.99:1 */
  --b-ink-3: #5d6b79; /* 5.46:1, lightest text tier, bg/surface only */
  --b-ink-inverse: #ffffff;

  --b-line: #dde4ea;
  --b-line-soft: #eef2f6;
  --b-line-strong: #c3cfd9;
  --b-field-edge: #7d8c9b; /* 3.4:1 on surface, 3.2:1 on bg, 3.1:1 on sunk */

  --b-accent: #0e6f7d; /* glacier, 5.85:1 on surface */
  --b-accent-strong: #0a5560;
  --b-accent-ink: #ffffff;
  --b-accent-wash: #e8f4f6;
  --b-accent-edge: #bfdfe4;
  --b-accent-glow: rgb(14 111 125 / 22%);

  --b-urgent: #b42318;

  /* Unknown or pending is a real state: a dashed edge, no hue. */
  --b-unknown-wash: #f1f4f7;
  --b-unknown-edge: #cbd5de;

  --b-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --b-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --b-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  /* Each elevation tier is a doubling series (1, 3, 6, 12, 24, 48) whose first
     two layers are a hairline ring, so an edge and its shadow are one object. */
  --b-ring-1: 0 0 0 1px rgb(11 16 21 / 7%);
  --b-ring-2: 0 0 0 2px rgb(11 16 21 / 2%);
  --b-shadow-valley:
    var(--b-ring-1), var(--b-ring-2), 0 1px 0 0 rgb(11 16 21 / 4%),
    0 1px 1px -0.5px rgb(11 16 21 / 4%), 0 3px 3px -1.5px rgb(11 16 21 / 3%);
  --b-shadow-ridge:
    var(--b-ring-1), var(--b-ring-2), 0 1px 0 0 rgb(11 16 21 / 5%),
    0 1px 1px -0.5px rgb(11 16 21 / 5%), 0 3px 3px -1.5px rgb(11 16 21 / 5%),
    0 6px 6px -3px rgb(11 16 21 / 5%), 0 12px 12px -6px rgb(11 16 21 / 5%);
  --b-shadow-summit:
    var(--b-ring-1), var(--b-ring-2), 0 1px 0 0 rgb(11 16 21 / 6%),
    0 1px 1px -0.5px rgb(11 16 21 / 6%), 0 3px 3px -1.5px rgb(11 16 21 / 6%),
    0 6px 6px -3px rgb(11 16 21 / 6%), 0 12px 12px -6px rgb(11 16 21 / 6%),
    0 24px 24px -12px rgb(11 16 21 / 6%), 0 48px 48px -24px rgb(11 16 21 / 6%);
  /* A key light from above makes a control read as pressable; a field is
     recessed, because the ink sits in the surface. */
  --b-shadow-key:
    inset 0 1px 0 0 rgb(255 255 255 / 55%), inset 0 -1px 0 0 rgb(11 16 21 / 5%),
    inset 0 0 0 1px rgb(11 16 21 / 4%), 0 1px 0 0 rgb(11 16 21 / 5%),
    0 2px 2px -1px rgb(11 16 21 / 5%), 0 4px 4px -2px rgb(11 16 21 / 4%);
  --b-shadow-key-accent:
    inset 0 1px 0 0 rgb(255 255 255 / 22%), inset 0 -1px 0 0 rgb(0 0 0 / 12%),
    inset 0 0 0 1px rgb(255 255 255 / 16%), 0 1px 0 0 rgb(11 16 21 / 10%),
    0 2px 2px -1px rgb(11 16 21 / 12%), 0 4px 4px -2px rgb(11 16 21 / 12%);
  --b-shadow-field:
    inset 0 1px 0 0 rgb(11 16 21 / 7%), inset 0 2px 2px -1px rgb(11 16 21 / 5%),
    inset 0 4px 4px -2px rgb(11 16 21 / 4%);

  /* the Editorial names, re-pointed */
  --paper: var(--b-bg);
  --surface: var(--b-surface);
  --paper-sunk: var(--b-sunk);
  --ink: var(--b-ink);
  --muted: var(--b-ink-2);
  --faint: var(--b-ink-3);
  --rule: var(--b-line);
  --rule-firm: var(--b-line-strong);
  --field-edge: var(--b-field-edge);
  --action: var(--b-accent);
  --action-ink: var(--b-accent-ink);
  --action-hover: var(--b-accent-strong);
  --oxblood: var(--b-urgent);
  --contour: var(--b-accent);
  --contour-opacity: 0.28;
  --sans: var(--b-sans);
  --display: var(--title-face); /* titles keep Editorial's face; --b-display is Alpine's interface face */
  --mono: var(--b-mono);

  /* Tight rather than bubbly: 8-10px reads as an instrument. */
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 10px;
  --r-full: 999px;
  --shadow-valley: var(--b-shadow-valley);
  --shadow-ridge: var(--b-shadow-ridge);
  --shadow-summit: var(--b-shadow-summit);
  --shadow-key: var(--b-shadow-key);
  --shadow-key-accent: var(--b-shadow-key-accent);
  --shadow-field: var(--b-shadow-field);
}

/* ---- Alpine, dark ground: a night valley -------------------------------
   Applied only by the explicit Dark choice; there is deliberately no
   prefers-color-scheme query. Signals lighten rather than deepen. */

:root[data-design="b"][data-design-mode="dark"] {
  color-scheme: dark;

  --b-bg: #080b0f;
  --b-surface: #111820;
  --b-sunk: #0d141b;
  --b-sunk-2: #0a1017;

  --b-ink: #e9eff5;
  --b-ink-2: #a7b4c0;
  --b-ink-3: #8593a1;
  --b-ink-inverse: #08111a;

  --b-line: #24303b;
  --b-line-soft: #1a242e;
  --b-line-strong: #33424f;
  --b-field-edge: #617282;

  --b-accent: #3fc6d8;
  --b-accent-strong: #6fdcea;
  --b-accent-ink: #08111a;
  --b-accent-wash: #102a30;
  --b-accent-edge: #1d4a53;
  --b-accent-glow: rgb(63 198 216 / 26%);

  --b-urgent: #ff8b80;

  --b-unknown-wash: #161f28;
  --b-unknown-edge: #38454f;

  --b-ring-1: 0 0 0 1px rgb(255 255 255 / 8%);
  --b-ring-2: 0 0 0 2px rgb(0 0 0 / 28%);
  --b-shadow-valley:
    var(--b-ring-1), var(--b-ring-2), 0 1px 0 0 rgb(0 0 0 / 20%),
    0 1px 1px -0.5px rgb(0 0 0 / 20%), 0 3px 3px -1.5px rgb(0 0 0 / 18%);
  --b-shadow-ridge:
    var(--b-ring-1), var(--b-ring-2), 0 1px 0 0 rgb(0 0 0 / 24%),
    0 1px 1px -0.5px rgb(0 0 0 / 24%), 0 3px 3px -1.5px rgb(0 0 0 / 24%),
    0 6px 6px -3px rgb(0 0 0 / 24%), 0 12px 12px -6px rgb(0 0 0 / 24%);
  --b-shadow-summit:
    var(--b-ring-1), var(--b-ring-2), 0 1px 0 0 rgb(0 0 0 / 30%),
    0 1px 1px -0.5px rgb(0 0 0 / 30%), 0 3px 3px -1.5px rgb(0 0 0 / 30%),
    0 6px 6px -3px rgb(0 0 0 / 30%), 0 12px 12px -6px rgb(0 0 0 / 30%),
    0 24px 24px -12px rgb(0 0 0 / 30%), 0 48px 48px -24px rgb(0 0 0 / 30%);
  --b-shadow-key:
    inset 0 1px 0 0 rgb(255 255 255 / 10%), inset 0 -1px 0 0 rgb(0 0 0 / 24%),
    inset 0 0 0 1px rgb(255 255 255 / 6%), 0 1px 0 0 rgb(0 0 0 / 30%),
    0 2px 2px -1px rgb(0 0 0 / 30%), 0 4px 4px -2px rgb(0 0 0 / 26%);
  --b-shadow-key-accent:
    inset 0 1px 0 0 rgb(255 255 255 / 26%), inset 0 -1px 0 0 rgb(0 0 0 / 20%),
    inset 0 0 0 1px rgb(255 255 255 / 18%), 0 1px 0 0 rgb(0 0 0 / 34%),
    0 2px 2px -1px rgb(0 0 0 / 34%), 0 4px 4px -2px rgb(0 0 0 / 30%);
  --b-shadow-field:
    inset 0 1px 0 0 rgb(0 0 0 / 34%), inset 0 2px 2px -1px rgb(0 0 0 / 26%),
    inset 0 4px 4px -2px rgb(0 0 0 / 20%);
}
