/* ─────────────────────────────────────────────────────────────────────────────
   GemID shared styles — included by every page on gemid-labs.com
   SINGLE SOURCE OF TRUTH for brand colors, nav, buttons, and base layout.
   To change branding: edit here only.
   ───────────────────────────────────────────────────────────────────────────── */

/* ─── BRAND TOKENS (light mode) ─────────────────────────────────────────── */
/* BRANDING: These vars mirror BrandLockup in app/lib/widgets/brand_logo.dart
   --brand-dark  = gemColor  (left face of mark + "Gem" text)
   --brand       = idColor   (right face of mark + "ID" text)
   Light mode: onDark=false  |  Dark mode: onDark=true */
:root {
  --brand: #006A78;       /* BRAND: primary — sync with GemColors.brandHex in app/lib/utils/gem_colors.dart */
  --brand-light: #007a8a; /* BRAND: brand-light — sync with GemColors.brandLightHex (WCAG AA: 4.52:1 on --bg) */
  --brand-dark: #1C1F21;  /* BRAND: BrandLockup left-face / "Gem" color in light mode (near-black for two-tone contrast) */
  --brand-dim: rgba(0,106,120,0.12);
  --bg: #F2F0ED;
  --surface: #F8F6F3;
  --surface2: #ECEAE6;
  --border: rgba(0,0,0,0.09);
  --text: #1C1F21;
  --muted: #5A5F63;
  --subtle: #696D70;
  --white: #ffffff;
  --red: #c0392b;
  --green: #1e7e4e;
  --gold: #8c6d1f;
  --radius: 12px;
  --radius-sm: 8px;
  --nav-bg: rgba(242,240,237,0.92);
  --sticky-bg: rgba(242,240,237,0.95);

  /* ─── TYPE SCALE ──────────────────────────────────────────────────────── */
  --text-xs: 0.75rem;     /* 12px — labels, badges, fine print */
  --text-sm: 0.8125rem;   /* 13px — captions, metadata, breadcrumbs */
  --text-base: 0.9375rem; /* 15px — body text, descriptions */
  --text-md: 1rem;        /* 16px — emphasized body, card headings */
  --text-lg: 1.25rem;     /* 20px — section headings (h2) */
  --text-xl: 1.5rem;      /* 24px — page headings */
  --text-2xl: 2rem;       /* 32px — hero/display text */
  --text-3xl: clamp(2rem, 4.5vw, 3.25rem); /* responsive hero headline */
}

/* ─── BRAND TOKENS (dark mode) ───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #00899a;
    --brand-light: #12b5c8; /* WCAG AA: ~4.6:1 on --surface */
    --brand-dark: #ffffff;  /* BRAND: BrandLockup left-face / "Gem" color in dark mode */
    --brand-dim: rgba(0,106,120,0.15);
    --bg: #121110;
    --surface: #1A1917;
    --surface2: #232220;
    --border: rgba(255,255,255,0.07);
    --text: #E2DFDA;
    --muted: #9B9590; /* WCAG AA: ~4.6:1 on --surface */
    --subtle: #5E5A55;
    --white: #ffffff;
    --red: #e05252;
    --green: #3aad6f;
    --gold: #c9a84c;
    --nav-bg: rgba(18,17,16,0.92);
    --sticky-bg: rgba(18,17,16,0.95);
  }
}

/* ─── HEADING FONT (serif accent for content pages) ────────────────────── */
.page-header h1 {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

/* ─── BASE ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── NAV ────────────────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  height: 60px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

/* BRANDING: Nav logo — mirrors BrandLockup widget (app/lib/widgets/brand_logo.dart).
   Mark geometry: app/assets/logos/gemid_mark_twotone*.svg
   Left face + "Gem" = --brand-dark  |  Right face + "ID" = --brand
   To update colors: change --brand-dark and --brand tokens above only. */
.nav-logo {
  display: flex;
  align-items: center;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
  text-decoration: none;
}
/* margin-right on mark only — gap: would also insert space between "Gem" text
   node and <span class="logo-id"> since both are separate flex items */
.logo-mark { display: block; flex-shrink: 0; margin-right: 0.45rem; }
.nav-logo .logo-id              { color: var(--brand); }
.nav-logo .logo-mark .mark-left  { stroke: var(--brand-dark); }
.nav-logo .logo-mark .mark-right { stroke: var(--brand); }

/* Simple text logo fallback (inner pages without SVG mark) */
.nav-logo span { color: var(--brand); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  font-size: var(--text-base);
  font-weight: 500;
  transition: color 0.15s;
  position: relative;
  padding-bottom: 2px;
  text-decoration: none;
}
.nav-links a:hover { color: var(--text); }

.nav-links a.nav-active { color: var(--text); }
.nav-links a.nav-active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-light);
  border-radius: 2px;
}

.nav-badge {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-light);
  border: 1px solid rgba(0,106,120,0.5);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ─── HAMBURGER / MOBILE NAV ─────────────────────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
  border-radius: 6px;
  line-height: 0;
}

/* Mobile-only "Open App" CTA row at bottom of dropdown — hidden on desktop */
.nav-mobile-cta { display: none; }

@media (max-width: 640px) {
  .nav-links { display: none; }
  /* Hide standalone CTA button in nav bar — it lives in the dropdown instead */
  nav > .btn-primary { display: none; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.25rem 1.5rem 1rem;
    gap: 0;
    z-index: 99;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  }
  .nav-links.open li { border-bottom: 1px solid var(--border); }
  .nav-links.open li:last-child { border-bottom: none; }
  .nav-links.open a {
    display: block;
    padding: 0.875rem 0;
    font-size: var(--text-md);
    color: var(--text);
    text-decoration: none;
  }

  /* CTA row */
  .nav-mobile-cta { display: list-item !important; }
  .nav-links.open .nav-mobile-cta {
    border-bottom: none !important;
    padding: 0.75rem 0 0.25rem;
  }
  .nav-links.open .nav-mobile-cta a {
    display: flex !important;
    padding: 0.625rem 1.5rem;
    background: var(--brand);
    color: #fff !important;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: 600;
    justify-content: center;
    width: 100%;
  }
  .hamburger { display: flex; align-items: center; }
}

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: var(--text-base);
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  min-height: 44px;
  min-width: 44px;
  border: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}
.btn-primary:hover { opacity: 0.88; text-decoration: none; }

/* Nav CTA: smaller, no glow, clean pill */
nav .btn-primary {
  padding: 0.4rem 1rem;
  min-height: 36px;
  font-size: var(--text-sm);
  border-radius: 6px;
}

/* Body CTAs: subtle depth in dark mode */
@media (prefers-color-scheme: dark) {
  .btn-primary:not(nav .btn-primary) {
    box-shadow: 0 0 12px rgba(0,137,154,0.25), 0 1px 2px rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.06);
  }
  .btn-primary:not(nav .btn-primary):hover {
    box-shadow: 0 0 16px rgba(0,137,154,0.35), 0 1px 2px rgba(0,0,0,0.2);
  }
}

.btn-outline {
  background: transparent;
  color: var(--brand-light);
  border: 1px solid var(--brand);
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn-outline:hover { background: var(--brand-dim); text-decoration: none; }

/* ─── FOOTER ─────────────────────────────────────────────────────────────── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.8;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }

/* ─── FOCUS ──────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--brand-light);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Remove outline-none from inputs — let focus-visible rule apply */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-light);
  outline-offset: 0;
}

/* ─── SCROLL MARGIN (sticky nav compensation) ────────────────────────────── */
[id] { scroll-margin-top: 68px; }

/* ─── SKIP LINK ──────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.75rem 1.5rem;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: var(--text-base);
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

/* ─── SCREEN-READER ONLY ─────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── UTILITIES ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; }

@media (max-width: 640px) {
  nav { padding: 0.75rem 1rem; }
}
