/* tokens.css — Core shell design tokens + Validator brand kit
 * Version: 1.0 (2026-06-09)
 * Brand kit (memory reference_vd_chart_branding): Montserrat · #F5F4F0 / #295BFF / #F7931A
 * Loaded by every Core page. Add new tokens HERE before using them on a page.
 */

/* Montserrat — self-hosted-equivalent via Google Fonts (no analytics/instrumentation). */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  /* Brand */
  --vd-cream:   #F5F4F0;
  --vd-blue:    #295BFF;
  --vd-orange:  #F7931A;

  /* Semantic — light */
  --bg:           var(--vd-cream);
  --surface:      #ffffff;
  --surface-2:    #ecebe6;
  --border:       #dddcd6;
  --text:         #14151a;
  --text-secondary: #5f6168;
  --accent:       var(--vd-blue);
  --accent-warm:  var(--vd-orange);

  /* Per-app accent tokens (apps.json `accent` field references these) */
  --a-portfolio:  #10b981;
  --a-market:     var(--vd-blue);
  --a-research:   #8b5cf6;

  /* Type */
  --font-ui:   'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', Menlo, Consolas, monospace;

  /* Shape */
  --radius:      8px;
  --radius-pill: 999px;
  --shadow:      0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg:   0 4px 16px rgba(0,0,0,0.08);

  /* Status dots */
  --ok:   #10b981;
  --warn: #f59e0b;
  --bad:  #ef4444;
}

html[data-theme="dark"] {
  --bg:           #0b0c0f;
  --surface:      #16181d;
  --surface-2:    #1f2229;
  --border:       #2a2e37;
  --text:         #f3f4f6;
  --text-secondary: #9ca3af;
  --shadow:       0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.4);
  --shadow-lg:    0 6px 24px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); }

/* ---- Shell header ---- */
.core-header {
  padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 50;
}
.core-brand { display: inline-flex; align-items: center; gap: 12px; }
.core-brand img { width: 32px; height: 32px; border-radius: 0; object-fit: contain; display: block; }
/* Dark mode: swap the black logo mark for its white inverse (icons/logo-only-dark.png,
   generated from logo-only.png — same alpha, inverted color) so it reads on dark surfaces. */
html[data-theme="dark"] .core-brand img[src$="logo-only.png"] { content: url("../icons/logo-only-dark.png"); }
.core-brand .titles h1 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
.core-brand .titles .sub { color: var(--text-secondary); font-size: 12px; margin-top: 1px; }
.core-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.core-btn {
  padding: 7px 13px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-family: var(--font-ui);
  font-size: 13px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.core-btn:hover { background: var(--border); text-decoration: none; }

/* ---- Nav (top, data-driven) ---- */
/* Sticky below the header (shell.js measures the header into --core-header-h) so it can
   hide on scroll-down and slide back on scroll-up mid-page. The header itself never moves. */
.core-nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 20px; border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: var(--core-header-h, 64px); z-index: 45; }
.core-nav a { padding: 5px 11px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.core-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.core-nav a.active { background: var(--accent); color: #fff; }
.core-nav a.disabled { opacity: 0.45; pointer-events: none; }

/* Nav section dropdown (multi-app sections, e.g. Library) — mirrors the home grouping */
.core-nav-group { position: relative; display: inline-flex; }
.core-nav-trigger { padding: 5px 11px; border: none; background: none; border-radius: var(--radius-pill); font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; font-family: var(--font-ui); display: inline-flex; align-items: center; gap: 5px; }
.core-nav-trigger:hover { background: var(--surface-2); color: var(--text); }
.core-nav-trigger.active { background: var(--accent); color: #fff; }
.core-nav-trigger .caret { font-size: 9px; }
.core-nav-dropdown { display: none; position: absolute; top: calc(100% + 5px); left: 0; min-width: 168px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 5px; z-index: 60; flex-direction: column; gap: 2px; }
.core-nav-group.open .core-nav-dropdown { display: flex; }
.core-nav-dropdown a { padding: 7px 11px; border-radius: var(--radius); font-size: 13px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.core-nav-dropdown a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.core-nav-dropdown a.active { background: var(--accent); color: #fff; }
.core-nav-dropdown a.disabled { opacity: 0.45; pointer-events: none; }

/* ---- Layout ---- */
.core-main { padding: 28px 24px; max-width: 1100px; margin: 0 auto; }
.core-section { margin-bottom: 30px; }
.core-section > h2 { font-size: 13px; font-weight: 600; margin: 0 0 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }

.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.app-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; gap: 6px; transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
  border-left: 3px solid var(--accent);
}
.app-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.app-card.disabled { opacity: 0.55; pointer-events: none; }
.app-card .title { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.app-card .desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.app-card .tag { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-pill); letter-spacing: 0.03em; text-transform: uppercase; }
.tag.soon { background: var(--surface-2); color: var(--text-secondary); }
.tag.slot { background: var(--surface-2); color: var(--accent-warm); }
.tag.live { background: var(--ok); color: #fff; }

.core-footer { padding: 16px 24px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; background: var(--surface); }

/* ---- Scroll-reveal nav (all screens) ----
   ONLY the pill nav hides; the header stays pinned (Michael 2026-06-12). The nav slides
   up past its own height PLUS the header's, so it's fully off-screen behind the header. */
.core-nav {
  transition: transform 0.25s ease;
}
body.nav-hidden .core-nav {
  transform: translateY(calc(-100% - var(--core-header-h, 64px)));
}

/* ---- Bottom nav (mobile only) ---- */
.core-bottom-nav {
  display: none; /* desktop: hidden */
}

@media (max-width: 768px) {
  /* Lock the layout viewport to the device width on EVERY shell page. Any child wider than
     the screen makes iOS lay out a zoomed-out layout viewport — and a fixed bottom:0 bar
     anchors to the LAYOUT viewport bottom, which then renders mid-screen and "moves" as you
     pan. (aum.css already did this per-page; promoted to the shell 2026-06-10.) */
  html, body { overflow-x: clip; max-width: 100%; }

  /* Make room for the bottom bar */
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  .core-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 50;
    align-items: stretch;
    transition: transform 0.25s ease;
  }

  .core-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.12s;
    -webkit-tap-highlight-color: transparent;
  }

  .core-bottom-nav-item:hover,
  .core-bottom-nav-item:active { color: var(--accent); text-decoration: none; }
  .core-bottom-nav-item.active { color: var(--accent); }

  .core-bottom-nav-icon { font-size: 20px; line-height: 1; }

  /* Bottom nav hides on scroll-down (mobile only — bottom nav only renders on mobile). */
  body.nav-hidden .core-bottom-nav {
    transform: translateY(100%);
  }
}
