/* brainai.store — shared brand layer.
   Loaded by the home page, the privacy page, and every tool (after the tool's
   own stylesheet), so the header, footer and tokens stay identical everywhere. */

/* Static weights, not the variable font: WebKit builds without variable-font
   support rendered every weight as 400. */
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/assets/fonts/schibsted-grotesk-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/assets/fonts/schibsted-grotesk-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/assets/fonts/schibsted-grotesk-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/assets/fonts/schibsted-grotesk-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/assets/fonts/schibsted-grotesk-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}

:root {
  --b-ground: #f2f3ee;   /* chalk: page background */
  --b-paper: #fbfbf8;    /* raised surfaces */
  --b-ink: #15171a;      /* primary text */
  --b-graphite: #545962; /* secondary text, 6.4:1 on ground */
  --b-rule: #d3d6cc;     /* hairlines */
  --b-signal: #2638d9;   /* actions and links, 7.4:1 on ground */
  --b-signal-ink: #ffffff;
  --b-local: #0b6b43;    /* the "stayed on your device" green, 6.2:1 */
  --b-font: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --b-wrap: 72rem;
  --b-gutter: clamp(1rem, 4vw, 2.5rem);
}

/* ---------- motion ---------- */
:root {
  --b-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --b-fast: 140ms;
  --b-med: 260ms;
}

/* Page-to-page: the header stays put, the active tool pill slides to its new
   place, and the page underneath cross-fades. Browsers without cross-document
   view transitions simply navigate as usual. */
/* The opt-in (@view-transition) is injected inline in each page's head, for
   Chromium only; see shared/Brand.tsx. These rules style it when it's on. */
.b-header { view-transition-name: b-header; }
.b-switch__item[aria-current='page'] { view-transition-name: b-pill; }
::view-transition-old(root) { animation: b-fade-out 160ms var(--b-ease) both; }
::view-transition-new(root) { animation: b-rise-in 280ms var(--b-ease) both; }
::view-transition-group(b-pill) { animation-duration: 320ms; animation-timing-function: var(--b-ease); }
@keyframes b-fade-out { to { opacity: 0; } }
@keyframes b-rise-in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- header ---------- */
.b-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--b-ground) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--b-rule);
  font-family: var(--b-font);
}
.b-header__inner {
  max-width: var(--b-wrap); margin: 0 auto;
  padding: 0.5rem var(--b-gutter);
  min-height: 3.75rem;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.5rem 1.25rem;
}
.b-header__inner > .b-nav { grid-column: -2; }
.b-mark {
  display: inline-flex; align-items: baseline;
  color: var(--b-ink); text-decoration: none;
  font-weight: 800; font-size: 1.125rem; letter-spacing: -0.02em;
  min-height: 44px; align-items: center;
}
.b-mark span { color: var(--b-graphite); font-weight: 500; }

/* The tool switcher: one pill bar, the current tool filled in ink. */
.b-switch {
  justify-self: center;
  display: flex; gap: 0.125rem; padding: 0.25rem;
  background: var(--b-paper);
  border: 1px solid var(--b-rule); border-radius: 999px;
  box-shadow: 0 1px 2px rgba(21, 23, 26, 0.04);
  max-width: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none;
}
.b-switch::-webkit-scrollbar { display: none; }
.b-switch__item {
  flex: none;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem;
  border-radius: 999px;
  color: var(--b-graphite); text-decoration: none; font-weight: 600; font-size: 0.925rem;
  transition: color var(--b-fast) var(--b-ease), background-color var(--b-fast) var(--b-ease);
}
.b-switch__item:hover { color: var(--b-ink); background: color-mix(in srgb, var(--b-ink) 6%, transparent); }
.b-switch__item[aria-current='page'] { background: var(--b-ink); color: #fff; }
.b-switch__item:active { transform: scale(0.97); }

.b-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 0.25rem; justify-self: end; min-width: 0; }
.b-nav a {
  color: var(--b-ink); text-decoration: none; font-size: 0.95rem; font-weight: 500;
  padding: 0.6rem 0.75rem; border-radius: 0.5rem; min-height: 44px;
  display: inline-flex; align-items: center;
  transition: background-color var(--b-fast) var(--b-ease);
}
.b-nav a:hover { background: color-mix(in srgb, var(--b-ink) 6%, transparent); }
.b-nav a[aria-current='page'] { color: var(--b-signal); }

/* Phones: brand and Privacy on the first row, the switcher full width below. */
@media (max-width: 47.99rem) {
  .b-header__inner { grid-template-columns: auto minmax(0, 1fr); padding-top: 0.25rem; padding-bottom: 0.625rem; }
  .b-mark { min-width: min(100%, 6.5em); overflow-wrap: anywhere; }
  .b-switch { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: space-between; }
  .b-switch__item { flex: 1 1 auto; justify-content: center; padding: 0 0.6rem; min-height: 44px; }
  .b-nav a { padding: 0.6rem 0.5rem; }
}
/* The narrowest phones: About lives in the footer, so the brand stays on one line. */
@media (max-width: 24.99rem) {
  .b-nav a[href="/about/"] { display: none; }
}

/* ---------- tool page intro ---------- */
.b-main { display: block; }
.b-intro {
  max-width: var(--b-wrap); margin: 0 auto;
  padding: clamp(1.75rem, 5vw, 3.25rem) var(--b-gutter) clamp(1.25rem, 3vw, 2rem);
  font-family: var(--b-font);
}
.b-intro__title {
  margin: 0; color: var(--b-ink);
  font-size: clamp(2.25rem, 5.5vw, 3.75rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
}
.b-intro__lede {
  margin: 0.9rem 0 0; max-width: 40rem;
  color: var(--b-graphite); font-size: clamp(1.0625rem, 1.5vw, 1.1875rem); line-height: 1.5;
}
.b-intro__local {
  display: inline-flex; align-items: center; gap: 0.55rem;
  margin: 1.1rem 0 0; padding: 0.4rem 0.8rem 0.4rem 0.65rem;
  background: color-mix(in srgb, var(--b-local) 8%, var(--b-paper));
  border: 1px solid color-mix(in srgb, var(--b-local) 22%, transparent);
  border-radius: 999px;
  color: var(--b-local); font-size: 0.925rem; font-weight: 600; line-height: 1.35;
}
.b-dot {
  flex: none; width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--b-local);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--b-local) 45%, transparent);
  animation: b-pulse 2.4s var(--b-ease) infinite;
}
@keyframes b-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--b-local) 40%, transparent); }
  70%, 100% { box-shadow: 0 0 0 0.45rem transparent; }
}
/* the one orchestrated entrance: title, then lede, then the local note */
.b-intro > * { animation: b-rise-in 420ms var(--b-ease) both; }
.b-intro > :nth-child(2) { animation-delay: 60ms; }
.b-intro > :nth-child(3) { animation-delay: 120ms; }

/* ---------- footer ---------- */
.b-footer {
  border-top: 1px solid var(--b-rule);
  background: var(--b-ground);
  color: var(--b-graphite);
  font-family: var(--b-font); font-size: 0.95rem; line-height: 1.5;
}
.b-footer__inner {
  max-width: var(--b-wrap); margin: 0 auto;
  padding: 2rem var(--b-gutter) 2.5rem;
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: baseline;
}
.b-footer a { color: var(--b-ink); text-underline-offset: 0.2em; }
.b-footer__inner > a { min-height: 44px; display: inline-flex; align-items: center; }
.b-footer a:hover { color: var(--b-signal); }
.b-footer__maker { margin-right: auto; }
.b-footer__nav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.b-footer__nav a { min-height: 44px; display: inline-flex; align-items: center; }
.b-footer__maker strong { color: var(--b-ink); font-weight: 600; }

.b-header a:focus-visible, .b-footer a:focus-visible {
  outline: 3px solid var(--b-signal); outline-offset: 2px; border-radius: 0.5rem;
}
.b-switch__item:focus-visible { outline-offset: 1px; border-radius: 999px; }

/* skip link */
.b-skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--b-ink); color: #fff; padding: 0.75rem 1rem; border-radius: 0.5rem;
  font-family: var(--b-font); font-weight: 600; text-decoration: none;
}
.b-skip:focus { top: 0.75rem; outline: 3px solid var(--b-signal); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .b-intro > *, .b-dot { animation: none !important; }
  .b-switch__item, .b-nav a { transition: none; }
}

/* The intro: text left, a real screenshot of what you'll get right (desktop). */
.b-intro { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem 3rem; align-items: center; }
.b-intro__peek { display: none; margin: 0; }
@media (min-width: 64rem) {
  .b-intro { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .b-intro__peek { display: block; position: relative; }
  .b-intro__peek img {
    display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--b-rule);
    box-shadow: 0 2px 6px rgba(21,23,26,.05), 0 24px 60px rgba(21,23,26,.12);
    transform: perspective(1400px) rotateY(-6deg) rotateX(2deg); transform-origin: left center;
    animation: b-peek-in 700ms var(--b-ease) 120ms both;
  }
  .b-intro__peek figcaption { margin-top: 0.7rem; font-size: 0.85rem; color: var(--b-graphite); text-align: right; }
}
@keyframes b-peek-in { from { opacity: 0; transform: perspective(1400px) rotateY(-14deg) rotateX(4deg) translateX(24px); } }
@media (prefers-reduced-motion: reduce) { .b-intro__peek img { animation: none; } }

/* Anything scrolled into view (keyboard focus, anchors, "scroll to results")
   lands below the sticky header instead of under it (WCAG 2.2 focus not obscured). */
html { scroll-padding-top: 5.5rem; }
@media (max-width: 47.99rem) { html { scroll-padding-top: 8.5rem; } }
