/*
 * GetGild shared site chrome: reset, layout utilities, buttons, nav, theme
 * toggle, page hero, section headings, cards, footer, dark-mode overrides,
 * scroll reveal. Load after tokens.css. Values follow
 * documentation/07-brand/design-guidelines.md.
 *
 * Used by apps/toolkit. apps/landing still carries its own inline copy of
 * these rules in each page's <style> block; moving landing onto this file is
 * a separate change.
 *
 * Logo: the nav and footer use the SVGs in common/logo/ as <img> tags.
 * .logo--light / .logo--dark below swap them with the theme.
 */

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Any display rule (.notice { display: flex }) beats the UA's [hidden] style,
   so make hidden win everywhere. */
[hidden] { display: none !important; }

/* ── Utilities ───────────────────────────────────────────── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 740px; margin: 0 auto; padding: 0 24px; }
.text-muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 999px;
  font-family: inherit;
  font-size: 0.9375rem; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s ease; white-space: nowrap;
  text-decoration: none; letter-spacing: -0.01em;
}
.btn--primary {
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(55,48,163,0.3);
}
.btn--primary:hover { background: var(--primary-dark); transform: scale(1.02); text-decoration: none; }
.btn--ghost {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn--ghost:hover { background: var(--primary-light); transform: scale(1.02); text-decoration: none; }
.btn--sm { padding: 8px 16px; font-size: 0.8125rem; }
.btn--lg { padding: 15px 32px; font-size: 1.0625rem; }
.btn--white { background: #fff; color: var(--primary); }
.btn--white:hover { background: #f5f3ff; text-decoration: none; }

/* ── Nav ─────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.nav-logo { display: flex; align-items: center; text-decoration: none; }
.nav-logo:hover { text-decoration: none; }
.nav-links {
  display: flex; align-items: center; gap: 32px; list-style: none;
}
.nav-links a { color: var(--muted); font-size: 0.9375rem; font-weight: 500; white-space: nowrap; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--text); font-weight: 600; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-actions .btn--primary { display: none; }
}

/* ── Theme toggle ────────────────────────────────────────── */
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer; outline: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.1);
}
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Page hero ───────────────────────────────────────────── */
.page-hero {
  padding: 72px 0 56px;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  position: relative; overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; top: -120px; right: -160px;
  width: 640px; height: 640px; border-radius: 50%;
  background: radial-gradient(circle, rgba(55,48,163,0.10) 0%, transparent 68%);
  pointer-events: none;
}
.page-hero::after {
  content: '';
  position: absolute; bottom: 0; left: -200px;
  width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,0.07) 0%, transparent 68%);
  pointer-events: none;
}
.page-hero > .container { position: relative; z-index: 1; }
.breadcrumb {
  font-size: 0.8125rem; color: var(--muted); margin-bottom: 20px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.page-label {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary);
  margin-bottom: 16px;
}
.page-hero h1 {
  font-size: clamp(2.25rem, 4vw, 3.25rem); font-weight: 900;
  line-height: 1.15; letter-spacing: -0.04em;
  color: var(--text); margin-bottom: 20px;
  max-width: 760px;
}
.page-hero h1 em { font-style: normal; color: var(--primary); }
.page-hero-sub {
  font-size: 1.0625rem; color: var(--muted); line-height: 1.7;
  max-width: 620px;
}

/* ── Sections ────────────────────────────────────────────── */
section { padding: 96px 0; }
.section-label {
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.2;
  color: var(--text); margin-bottom: 16px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
html[data-theme="dark"] .card { box-shadow: var(--shadow-sm); }

/* ── Logo (common/logo/*.svg) ────────────────────────────── */
/* Explicit widths: the SVGs declare 320x80 but draw on a 120x40 viewBox, so
   width:auto would letterbox them with ~20px of padding on each side. */
.nav-logo img { height: 40px; width: 120px; }
.footer-logo img { height: 34px; width: 102px; }
.logo--dark { display: none; }
html[data-theme="dark"] .logo--light { display: none; }
html[data-theme="dark"] .logo--dark { display: block; }

/* ── Footer ──────────────────────────────────────────────── */
footer {
  background: #0f172a; color: #94a3b8;
  padding: 64px 0 32px;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px; margin-bottom: 48px;
}
.footer-logo { display: flex; align-items: center; margin-bottom: 12px; }
.footer-tagline { font-size: 0.875rem; line-height: 1.6; margin-bottom: 20px; }
.footer-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.footer-badge {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  color: #cbd5e1; font-size: 0.75rem; font-weight: 600;
  padding: 4px 10px; border-radius: 6px;
}
.footer-col h4 { color: #fff; font-size: 0.875rem; font-weight: 700; margin-bottom: 16px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: #94a3b8; font-size: 0.875rem; }
.footer-col a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 28px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.footer-bottom p { font-size: 0.8125rem; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

/* ── Dark mode ───────────────────────────────────────────── */
html[data-theme="dark"] nav {
  background: rgba(15,14,26,0.85);
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .page-hero {
  background: linear-gradient(180deg, #1a1830 0%, var(--bg) 100%);
}
html[data-theme="dark"] .page-hero::before {
  background: radial-gradient(circle, rgba(129,140,248,0.18) 0%, transparent 68%);
}
html[data-theme="dark"] .page-hero::after {
  background: radial-gradient(circle, rgba(251,191,36,0.12) 0%, transparent 68%);
}
html[data-theme="dark"] footer { background: #07060f; }
html[data-theme="dark"] .btn--white { background: var(--surface); color: var(--primary); }
html[data-theme="dark"] .btn--white:hover { background: var(--border); }
body.theme-transitioning * {
  transition: background-color 0.25s ease, color 0.18s ease,
              border-color 0.25s ease, box-shadow 0.25s ease !important;
}

/* ── Scroll reveal ───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.25, 0.1, 0.25, 1),
              transform 0.65s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
