/* Mason is a Tool — shared site styles.
   Follows the same design rules as the apps (UI Design spec 2.1, Glacier palette):
   system font, type and controls sized for touch and older eyes, light and dark modes. */

:root {
  color-scheme: dark;
  /* Glacier, dark */
  --color-bg: #0a0e17; --color-surface: #161d2c; --color-subtle: #202a3d;
  --color-border: #36435d; --color-border-strong: #5d6980;
  --color-text: #e9eef8; --color-text-muted: #a0abc1;
  --color-accent: #7aa2ff; --color-accent-text: #7aa2ff;
  --color-accent-soft: #2a3856; --color-accent-soft-hover: #3a4a6e;
  --color-warning: #f0b44c; --color-warning-soft: #3f3423;
  --shadow-card: 0 1px 2px rgba(0,0,0,.35); --shadow-raised: 0 4px 12px rgba(0,0,0,.45);

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --weight-heading: 650; --tracking-heading: -0.01em;
  --text-sm: 15px; --text-base: 17px; --text-lg: 19px; --text-xl: 24px; --text-2xl: 32px; --text-display: clamp(36px, 6vw, 52px);
  --radius-control: 10px; --radius-card: 16px;
  --size-control: 44px; --space-control-x: 14px; --space-gap: 12px; --space-card: 16px;
  --duration: 200ms; --ease-standard: cubic-bezier(0.2,0,0,1); --ease-emphasized: cubic-bezier(0.34,1.56,0.64,1);
  --max: 1040px;
}
@media (pointer: coarse) { :root { --size-control: 48px; } }
:root[data-theme="light"] {
  color-scheme: light;
  /* Glacier, light */
  --color-bg: #edf0f7; --color-surface: #ffffff; --color-subtle: #e2e8f3;
  --color-border: #c3cde0; --color-border-strong: #9fa9bb;
  --color-text: #101828; --color-text-muted: #4b586f;
  --color-accent: #2453d4; --color-accent-text: #2453d4;
  --color-accent-soft: #e5eafa; --color-accent-soft-hover: #d2dcf6;
  --color-warning: #9e5800; --color-warning-soft: #f2e9de;
  --shadow-card: 0 1px 2px rgba(16,24,40,.07); --shadow-raised: 0 4px 12px rgba(16,24,40,.12);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-weight: var(--weight-heading); letter-spacing: var(--tracking-heading); line-height: 1.2; margin: 0; }
a { color: var(--color-accent-text); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--color-accent-text); outline-offset: 2px; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

.wrap { width: min(100% - 40px, var(--max)); margin-inline: auto; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 10; padding: 10px 14px; border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-text); }
.skip:focus { top: 12px; }

/* ---------- Top bar (same pattern as the app) ---------- */
.topbar { background: var(--color-surface); border-bottom: 1px solid var(--color-border-strong); }
.topbar .wrap { display: flex; align-items: center; gap: 4px; min-height: calc(var(--size-control) + 14px); }
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 4px 6px; margin-left: -6px; border-radius: 8px; color: var(--color-text); text-decoration: none; font-weight: var(--weight-heading); font-size: var(--text-lg); letter-spacing: var(--tracking-heading); }
.brand svg { width: 28px; height: 28px; }
.topbar .spacer { flex: 1; }

/* ---------- Buttons (same as the app) ---------- */
.btn, .icon-btn { -webkit-tap-highlight-color: transparent; cursor: pointer; font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--size-control); padding: 0 var(--space-control-x);
  border: 1px solid transparent; border-radius: var(--radius-control);
  font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none;
  transition: background-color var(--duration) var(--ease-standard), box-shadow var(--duration) var(--ease-standard), transform var(--duration) var(--ease-emphasized);
}
.btn--primary { background: var(--color-accent-soft); color: var(--color-accent-text); }
.btn--secondary { background: var(--color-subtle); color: var(--color-text); }
.btn--quiet { background: transparent; color: var(--color-text); }
.icon-btn {
  display: inline-grid; place-items: center; width: var(--size-control); height: var(--size-control); padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--color-text-muted);
  transition: background-color var(--duration) var(--ease-standard), color var(--duration) var(--ease-standard);
}
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-raised); }
  .btn--primary:hover { background: var(--color-accent-soft-hover); }
  .btn--quiet:hover { background: var(--color-subtle); box-shadow: none; }
  .icon-btn:hover { background: var(--color-subtle); color: var(--color-text); }
  .brand:hover { background: var(--color-subtle); }
}
.btn:active, .icon-btn:active { transform: scale(.96); transition-duration: 60ms; }

/* ---------- Home ---------- */
.intro { padding: clamp(40px, 8vw, 80px) 0 clamp(28px, 5vw, 44px); }
.intro h1 { font-size: var(--text-display); }
.intro .tagline { margin: 10px 0 0; font-size: var(--text-xl); font-weight: var(--weight-heading); letter-spacing: var(--tracking-heading); }
.intro .what { margin: 12px 0 0; max-width: 52ch; font-size: var(--text-lg); color: var(--color-text-muted); }

.tools { padding-bottom: clamp(48px, 8vw, 80px); }
.section-title { margin: 0 0 14px; font-size: var(--text-lg); }
.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card__art { background: var(--color-subtle); border-bottom: 1px solid var(--color-border); padding: 20px; color: var(--color-text-muted); }
.card__art svg { display: block; width: 100%; height: auto; max-height: 150px; }
.card__body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 18px 20px 20px; }
.card h3 { font-size: var(--text-xl); }
.card p { margin: 0; color: var(--color-text-muted); }
.facts { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: var(--text-sm); color: var(--color-text-muted); }
.facts li { display: flex; align-items: center; gap: 8px; }
.facts svg.i { width: 16px; height: 16px; color: var(--color-accent-text); }
.card .actions { margin-top: auto; padding-top: 12px; }

.card--empty { background: transparent; border-style: dashed; box-shadow: none; align-items: center; justify-content: center; text-align: center; padding: 28px 24px; min-height: 200px; gap: 6px; }
.card--empty h3 { font-size: var(--text-lg); }

/* ---------- Reading pages ---------- */
.page { padding: clamp(28px, 6vw, 56px) 0 64px; }
.doc { max-width: 720px; }
.doc h1 { font-size: var(--text-2xl); }
.doc .lede { margin: 10px 0 0; font-size: var(--text-lg); color: var(--color-text-muted); max-width: 60ch; }
.doc h2 { margin: 0 0 6px; font-size: var(--text-lg); }
.doc p, .doc li { max-width: 62ch; }
.doc p { margin: 0 0 10px; }
.doc ul { margin: 0 0 10px; padding-left: 1.2em; }
.doc li + li { margin-top: 4px; }
.panel { margin-top: 16px; padding: 20px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.panel > :last-child { margin-bottom: 0; }
.notice { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; padding: 14px 16px; border-radius: var(--radius-control); background: var(--color-warning-soft); }
.notice svg.i { color: var(--color-warning); margin-top: 2px; }
.notice p { margin: 0; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.split .panel { margin-top: 0; }

/* ---------- Not found ---------- */
.lost { padding: clamp(56px, 12vw, 120px) 0; }
.lost h1 { font-size: var(--text-2xl); }
.lost p { margin: 10px 0 20px; font-size: var(--text-lg); color: var(--color-text-muted); max-width: 40ch; }

/* ---------- Footer ---------- */
.site-foot { margin-top: auto; border-top: 1px solid var(--color-border); color: var(--color-text-muted); font-size: var(--text-sm); }
.site-foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 20px 0 24px; }
.site-foot p { margin: 0; max-width: 64ch; }
.card__art .accent { stroke: var(--color-accent-text); }
.brand span { white-space: nowrap; }
.topbar .short { display: none; }
@media (max-width: 420px) { .topbar .long { display: none; } .topbar .short { display: inline; } }
.tool-grid > li:has(.card--empty) { align-self: start; }
