/*
 * Shared by the static homepage, /privacy, /terms and the pages generated from apps/web/site-pages:
 * the footer, the fire colours and closing bar, and the legal pages' layout.
 * Uses the tokens in studio.css (and the stage tokens each page defines).
 */

/* The Hearth name links in the header and footer: a 44px target, like every other link. */
.site-header .brand, .site-footer .brand { min-height: 44px; }

/* Footer. Its link lists are written by scripts/build-site-pages.mjs (one column per group). */
.site-footer { padding-block: clamp(48px, 6vw, 72px) 48px; border-top: 1px solid var(--line); }
.site-footer .foot-top { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 3.4fr); gap: 32px 40px; align-items: start; justify-content: initial; }
.site-footer .foot-brand { display: grid; gap: 12px; justify-items: start; }
.site-footer .foot-brand .small { max-width: 32ch; }
.site-footer .foot-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 24px; align-items: start; }
.site-footer .foot-col { display: grid; gap: 0; align-content: start; min-width: 0; }
.site-footer .foot-h { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.site-footer .foot-col a { display: inline-flex; align-items: center; min-height: 44px; padding: 4px 0; font-size: 14.5px; line-height: 1.3; color: var(--muted); text-decoration: none; justify-self: start; overflow-wrap: anywhere; }
.site-footer .foot-col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.site-footer .foot-legal { display: grid; gap: 8px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line-soft); justify-content: initial; }
.site-footer .foot-legal p { font-size: 13px; line-height: 1.55; color: var(--muted); max-width: 92ch; }
@media (max-width: 860px) {
  .site-footer .foot-top { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .site-footer .foot-cols { grid-template-columns: 1fr 1fr; gap: 20px 16px; }
}

/* ---------- Fire colours (7 November 2026) ----------
   The mark's orange and gold, used sparingly: a warm glow behind the hero, a highlight on the word
   "hearth", and the closing section's fire. The word is a darker ember on light backgrounds
   (#9c4206: 4.8:1 or better) and a light ember on dark
   ones (6:1 or better), with no marker or underline behind it (7 November 2026: Arran asked
   for plain coloured text). Moved here from index.html on 7 November 2026. */
:root { --ember: #f5922f; --ember-gold: #ffd166; --ember-ink: #9c4206; --glow-ember: rgba(245, 146, 47, .18); --ember-shadow: rgba(245, 146, 47, .55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ember-ink: #ffb057; --glow-ember: rgba(245, 146, 47, .16); --ember-shadow: rgba(245, 146, 47, .45); } }
:root[data-theme="dark"] { --ember-ink: #ffb057; --glow-ember: rgba(245, 146, 47, .16); --ember-shadow: rgba(245, 146, 47, .45); }
.ember { color: var(--ember-ink); }

/* ---------- Closing: "Pull up a chair." ----------
   A slim bar on the page's panel colour (7 November 2026: Arran found the big card too bulky).
   The fire mark's two flame layers sway and flicker and a few embers rise inside the bar (CSS
   only); all of it is still when motion is reduced. */
.close-sec { padding-top: 0; }
.cta-bar { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 20px; padding: 18px 20px 18px 18px; border-radius: 22px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--stage-line), 0 18px 40px -28px rgba(58, 20, 92, .35); }
.cta-bar::before { content: ""; position: absolute; left: -50px; top: 50%; width: 240px; height: 170px; transform: translateY(-50%); z-index: -1; background: radial-gradient(closest-side, var(--glow-ember), transparent); }
.cta-bar-text { display: grid; gap: 2px; min-width: 0; }
.cta-bar h2 { margin: 0; font-size: clamp(20px, 2vw, 24px); line-height: 1.2; letter-spacing: -0.02em; color: var(--ink); }
.cta-bar p { margin: 0; font-size: 15px; color: var(--muted); }
.cta-bar .btn { margin-left: auto; flex: none; }
.bar-fire { position: relative; flex: none; width: 60px; height: 60px; isolation: isolate; }
.bar-fire::before { content: ""; position: absolute; left: 50%; bottom: -10px; width: 110px; height: 70px; transform: translateX(-50%); z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, var(--ember-shadow), transparent); opacity: .55; }
.bar-tile { position: absolute; inset: 0; border-radius: 17px; overflow: hidden; background: #6a2c9e; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 12px 24px -12px rgba(58, 20, 92, .7); }
.bar-tile svg { display: block; width: 100%; height: 100%; }
.hf-back, .hf-front { transform-box: fill-box; transform-origin: 50% 100%; }
.hf-back { animation: hf-sway 3.6s ease-in-out infinite; }
.hf-front { animation: hf-flicker 2.1s ease-in-out infinite; }
@keyframes hf-sway { 0%, 100% { transform: none; } 30% { transform: skewX(-3deg) scale(1.01, 1.07); } 65% { transform: skewX(2.5deg) scale(.99, .95); } }
@keyframes hf-flicker { 0%, 100% { transform: none; } 22% { transform: scale(1.02, 1.12); } 48% { transform: scale(.98, .93); } 74% { transform: scale(1.01, 1.06); } }
.bar-ember { position: absolute; top: 26px; left: var(--x); width: var(--s, 5px); height: var(--s, 5px); border-radius: 50%; background: var(--c, var(--ember-gold)); box-shadow: 0 0 7px 1px var(--ember-shadow); opacity: 0; animation: bar-rise var(--d, 3.4s) cubic-bezier(.3, .4, .5, 1) var(--dl, 0s) infinite; pointer-events: none; }
@keyframes bar-rise { 0% { opacity: 0; transform: translate(0, 0) scale(1); } 14% { opacity: 1; } 70% { opacity: .85; } 100% { opacity: 0; transform: translate(var(--dx, 0px), -40px) scale(.35); } }
/* The header's Pause animations button (studio.css) holds these loops. */
:root[data-motion="paused"] :is(.hf-back, .hf-front, .bar-ember) { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .hf-back, .hf-front { animation: none; }
  .bar-ember { display: none; }
}
/* Stacks below 860px: with two buttons (11 November 2026) the single row has no room for the words
   until about 810px. */
@media (max-width: 860px) {
  .cta-bar { flex-wrap: wrap; justify-content: center; text-align: center; padding: 22px 18px; }
  .cta-bar-text { flex: 1 1 100%; }
  .cta-bar .btn { margin: 4px 0 0; width: 100%; justify-content: center; }
}

/* Legal pages */
.legal-hero { position: relative; overflow: hidden; isolation: isolate; background: var(--stage-bg); color: var(--stage-ink); padding-block: clamp(56px, 8vw, 104px) clamp(48px, 6vw, 72px); }
.legal-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(var(--stage-dot) 1px, transparent 1.2px); background-size: 18px 18px; -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%); }
.legal-hero .glow { position: absolute; z-index: -1; inset: -20% -10% auto; height: 140%; pointer-events: none; background: radial-gradient(38% 34% at 26% 30%, var(--glow-1), transparent 70%), radial-gradient(36% 32% at 74% 26%, var(--glow-2), transparent 70%), radial-gradient(28% 26% at 52% 64%, var(--glow-3), transparent 70%); filter: blur(8px); }
.legal-hero::after { content: ""; position: absolute; inset: auto 0 0; height: 120px; z-index: -1; background: linear-gradient(180deg, transparent, var(--canvas)); pointer-events: none; }
.legal-hero .frame { display: grid; gap: 18px; justify-items: start; }
.legal-hero h1 { font-size: clamp(44px, 6.4vw, 84px); font-weight: 600; line-height: .98; letter-spacing: -0.042em; color: var(--stage-ink); }
.legal-hero .intro { display: grid; gap: 12px; max-width: 64ch; font-size: clamp(17px, 1.5vw, 19px); line-height: 1.6; color: var(--stage-muted); }
.legal-hero .updated { font-family: var(--mono); font-size: 13px; color: var(--stage-muted); }
.legal-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; padding-block: 8px clamp(64px, 8vw, 112px); }
.legal-toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 92px); display: grid; gap: 2px; }
.legal-toc p { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.legal-toc a { display: flex; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 10px; font-size: 14px; line-height: 1.3; color: var(--muted); text-decoration: none; transition: color .2s, background-color .2s; }
.legal-toc a:hover { color: var(--ink); background: var(--hover); }
.legal-toc a[aria-current="true"] { color: var(--ink); background: var(--panel); box-shadow: var(--shadow-1); }
.legal-sheet { display: grid; gap: 32px; padding: clamp(24px, 4vw, 56px); background: var(--panel); border-radius: 24px; box-shadow: var(--shadow-2); min-width: 0; }
.lsec { display: grid; gap: 14px; scroll-margin-top: 100px; font-size: 16.5px; line-height: 1.65; color: var(--ink-2); }
.lsec h2 { font-size: clamp(22px, 2.2vw, 28px); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); }
.lsec + .lsec { padding-top: 32px; border-top: 1px solid var(--line-soft); }
.lsec strong { font-weight: 600; color: var(--ink); }
.llist { display: grid; gap: 10px; margin: 0; padding-left: 22px; }
.llist li::marker { color: var(--plum); }
.lsub { margin-top: 6px; font-size: 17.5px; font-weight: 600; color: var(--ink); }
.lcode { font-family: var(--mono); font-size: 14px; padding: 1px 6px; border-radius: 6px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); overflow-wrap: anywhere; }
.llink { color: var(--plum); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.llink:hover { text-decoration-thickness: 2px; }
.legal-back { justify-self: start; }
@media (max-width: 960px) {
  .legal-body { grid-template-columns: 1fr; }
  .legal-toc { position: static; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); padding: 16px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-1); }
  .legal-toc p { grid-column: 1 / -1; }
}
