/*
 * Fyrien "2b — Faceted flame" tokens (added post-Phase 22.1). Match
 * apps/web/src/app.css so the marketing site + app read as one system.
 */
:root {
  --fyrien-ink: #0B0B0F;
  --fyrien-ember: #FF7A1F;
  --fyrien-flame: #DC2626;
  --fyrien-flame-hover: #B71E1E;
  --fyrien-glow: #FFD27A;
  --fyrien-spark: #FFF6D6;
  --fyrien-char: #7a1408;
  --fyrien-paper: #f3f2f2;
}

/*
 * Website palette — 2b Faceted flame is the sole brand system. Deep
 * Blue and Fraunces are fully retired; semantic --interactive-* /
 * --brand-* names stay as aliases so page + component styles don't
 * need per-file rewrites. Marketing surface defaults to the light
 * Paper theme; dark theme mirrors the app's Ink surface.
 */
:root {
  --bg-primary: var(--fyrien-paper);
  --bg-secondary: #e9e7e2;           /* Paper +panel */
  --bg-tertiary: #d9d6cd;
  --bg-modifier-hover: rgba(11, 11, 15, 0.045);
  --bg-modifier-border: #cfccc1;

  --text-normal: var(--fyrien-ink);
  --text-muted: #45433e;
  --text-faint: #7c7970;
  --text-on-accent: var(--fyrien-paper);

  --interactive-accent: var(--fyrien-flame);
  --interactive-accent-hover: var(--fyrien-flame-hover);
  --interactive-accent-2: var(--fyrien-ember);

  --brand-primary: var(--fyrien-flame);
  --brand-ember: var(--fyrien-ember);
  --brand-ink: var(--fyrien-ink);
  --brand-paper: var(--fyrien-paper);
  --brand-bone: #e9e7e2;
  --brand-stone: #7c7970;

  --color-green: #2e9c53;
  --color-yellow: #b78400;
  --color-red: #c93a3a;

  --font-ui: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --font-display: 'Archivo', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --tracking-display: -0.03em;
  --font-size-base: 15px;
  --font-size-sm: 13px;
  --font-size-xs: 12px;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;

  font-family: var(--font-ui);
  font-size: var(--font-size-base);
  color-scheme: light;
}

/*
 * Dark-mode variant — mirrors the app's Ink surface for viewers whose
 * OS reports prefers-color-scheme: dark. Flame stays the primary
 * interactive on both themes; only the surface + text swap.
 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: var(--fyrien-ink);
    --bg-secondary: #17161c;
    --bg-tertiary: #22212a;
    --bg-modifier-hover: rgba(243, 242, 242, 0.055);
    --bg-modifier-border: #2c2a35;

    --text-normal: var(--fyrien-paper);
    --text-muted: #b5b1a8;
    --text-faint: #8A8577;
    --text-on-accent: var(--fyrien-paper);

    --interactive-accent: var(--fyrien-flame);
    --interactive-accent-hover: var(--fyrien-flame-hover);
    --interactive-accent-2: var(--fyrien-ember);

    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-primary);
  color: var(--text-normal);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--interactive-accent);
  text-decoration: none;
}

a:hover {
  color: var(--interactive-accent-hover);
  text-decoration: underline;
}

h1,
h2,
h3 {
  color: var(--text-normal);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1.1;
  margin: 0 0 0.5em;
}

p {
  line-height: 1.6;
  color: var(--text-normal);
}

button,
input {
  font-family: inherit;
  font-size: var(--font-size-base);
}

button {
  background: transparent;
  color: var(--text-normal);
  border: 1px solid var(--bg-modifier-border);
  border-radius: var(--radius-s);
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 90ms ease, border-color 90ms ease;
}

button:hover:not(:disabled) {
  background: var(--bg-modifier-hover);
}

button:focus-visible {
  outline: 2px solid var(--interactive-accent);
  outline-offset: 1px;
}

button:disabled {
  color: var(--text-faint);
  cursor: default;
}

.btn-primary {
  background: var(--interactive-accent);
  color: var(--text-on-accent);
  border-color: var(--interactive-accent);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--interactive-accent-hover);
  border-color: var(--interactive-accent-hover);
}

input[type='email'],
input[type='password'],
input[type='text'] {
  /* Panel-elevated surface — reads as "input field" on both themes and
     guarantees --text-normal contrast (Ink on Paper-panel in light,
     Paper on Ink-panel in dark). Hard-coded #ffffff would collapse to
     white-on-white under prefers-color-scheme: dark. */
  background: var(--bg-secondary);
  color: var(--text-normal);
  border: 1px solid var(--bg-modifier-border);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  width: 100%;
}

input:focus {
  outline: 2px solid var(--interactive-accent);
  outline-offset: 1px;
}

/*
 * Fyrien 2b in-app touches — CTA, focus ring, and text selection now
 * lead with ember/flame so the icon suite reads across the whole
 * marketing surface. Placed at the end of the file so it wins the
 * cascade against the Phase 22.1 defaults above.
 */
.btn-primary,
button.btn-primary {
  background: var(--fyrien-flame);
  color: var(--fyrien-paper);
  border-color: var(--fyrien-flame);
}
.btn-primary:hover:not(:disabled),
button.btn-primary:hover:not(:disabled) {
  background: var(--fyrien-flame-hover);
  border-color: var(--fyrien-flame-hover);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
input:focus,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--fyrien-ember);
  outline-offset: 1px;
}

::selection {
  background: rgba(255, 122, 31, 0.2);
  color: inherit;
}


/* =====================================================================
 * Shell chrome — header, nav, main, footer.
 *
 * ⚠️ These were SCOPED styles inside `+layout.svelte`. Svelte hashed the
 * selectors, so bare `header` / `nav` / `footer` were safe there. Global
 * CSS has no such guarantee, so every bare element selector below is
 * anchored to `.shell`, which only the layout emits — otherwise a page
 * defining its own `<header>` would inherit the site chrome's styling.
 * ===================================================================== */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.shell header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--bg-modifier-border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-normal);
  text-decoration: none;
}

.brand:hover {
  color: var(--text-normal);
  text-decoration: none;
}

.shell nav {
  display: flex;
  gap: 18px;
}

.shell nav a {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.shell nav a.active,
.shell nav a:hover {
  color: var(--text-normal);
  text-decoration: none;
}

.shell main {
  flex: 1;
  padding: 48px 0;
}

.shell footer {
  padding: 24px 0;
  border-top: 1px solid var(--bg-modifier-border);
  color: var(--text-faint);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sep {
  color: var(--text-faint);
}


/*
 * ⚠️ A slot nobody filled must be invisible.
 *
 * `[data-slot]` elements ship in the static HTML and are filled by a Pages
 * Function. On a plain GET no Function runs, so the element is served empty —
 * and `.error` has a border and padding, which renders as a stray red box
 * above the form on every first visit to /login, /signup and /reset-password.
 *
 * The render layer removes unfilled slots too, but this rule is what makes it
 * safe for a page to be served with no Function at all. Belt and braces on
 * purpose: one is structural, the other is per-request.
 */
[data-slot]:empty {
  display: none;
}
