/* ============================================================
   TwoTail site system (light)
   Extracted from the homepage build, 2026-08-17. Tokens, nav,
   panels, type, footer, and the shared data-viz primitives.
   Page-specific styles live in each page's own <style>.
   ============================================================ */

:root {
    --paper:      #f4f6fb;
    --surface:    #ffffff;
    --wash:       #e9eefa;
    --wash-deep:  #dde5f8;

    --ink:        #0d1420;
    --ink-2:      #454f63;
    --ink-3:      #737e95;
    --line:       #dde3ef;
    --line-soft:  #e8ecf5;

    --blue:       #2b4bc4;
    --blue-hover: #21389a;
    --blue-deep:  #101a45;
    --blue-soft:  #7194e6;
    --blue-pale:  #c6d5f7;

    --find:       #b4530a;
    --find-fill:  #f2a33c;
    --agree:      #0b7a57;

    --font-display: 'Source Serif 4', Georgia, serif;
    --font-ui: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'Geist Mono', ui-monospace, 'SF Mono', monospace;

    --gutter: clamp(12px, 1.6vw, 22px);
    --radius: 24px;      /* every card and panel */
    --radius-sm: 10px;   /* every control and inset */
    --shadow: 0 1px 2px rgba(13, 20, 32, 0.04), 0 16px 40px -20px rgba(13, 20, 32, 0.16);
    --shadow-sm: 0 1px 2px rgba(13, 20, 32, 0.05), 0 6px 18px -12px rgba(13, 20, 32, 0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-ui);
    background: var(--paper);
    color: var(--ink-2);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection { background: var(--blue-pale); color: var(--ink); }

a { color: inherit; }

:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
    border-radius: 4px;
}

.shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 clamp(1.25rem, 4vw, 3rem);
}

/* Rounded inset panel: the page's one structural idea */
.panel {
    position: relative;
    margin: 0 var(--gutter) var(--gutter);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel-surface { background: var(--surface); border: 1px solid var(--line-soft); }
.panel-wash { background: var(--wash); }
.panel-navy { background: var(--blue-deep); color: #cfd8f0; }
.panel-blue { background: var(--blue); color: #e6ecfd; }

.panel-pad { padding: clamp(3rem, 7vw, 6rem) 0; }
/* position: sticky children need a non-clipping ancestor */
.panel-open { overflow: visible; }

/* ---------- type ---------- */
h1, h2, h3 { color: var(--ink); font-weight: 400; letter-spacing: -0.02em; }

h1 {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 5.6vw, 4.35rem);
    line-height: 1.04;
    letter-spacing: -0.028em;
}

h2 {
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 4.2vw, 3.4rem);
    line-height: 1.08;
    letter-spacing: -0.025em;
}

h3 { font-family: var(--font-ui); font-weight: 600; letter-spacing: -0.012em; }

.panel-navy h1, .panel-navy h2, .panel-navy h3,
.panel-blue h1, .panel-blue h2, .panel-blue h3 { color: #fff; }

/* Mono is only ever used where a real value is being shown. */
.val { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.eyebrow {
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--blue);
    display: block;
    margin-bottom: 1.1rem;
}
.panel-navy .eyebrow, .panel-blue .eyebrow { color: rgba(255, 255, 255, 0.6); }

.section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 3.75rem); }
.section-head p {
    font-size: 1rem;
    color: var(--ink-2);
    margin-top: 1rem;
    max-width: 36rem;
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.82rem 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); transform: translateY(-1px); box-shadow: 0 8px 20px -8px rgba(43, 75, 196, 0.45); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.panel-navy .btn-ghost, .panel-blue .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, 0.35); }
.panel-navy .btn-ghost:hover, .panel-blue .btn-ghost:hover { border-color: #fff; background: rgba(255, 255, 255, 0.08); }
.btn-light { background: #fff; color: var(--blue); }
.btn-light:hover { transform: translateY(-1px); background: #f2f5ff; }

.textlink {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--blue);
    text-decoration: none;
}
.textlink svg { transition: transform 0.18s ease; }
.textlink:hover svg { transform: translateX(3px); }
.panel-navy .textlink, .panel-blue .textlink { color: #fff; }

/* ============================================================
   Nav (floating pill)
   ============================================================ */
.header {
    position: sticky;
    top: var(--gutter);
    z-index: 100;
    padding: var(--gutter) var(--gutter) 0;
}
.nav {
    max-width: 1180px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.7rem 0.6rem 1.15rem;
}
@supports (animation-timeline: scroll()) {
    .nav { animation: nav-compact linear both; animation-timeline: scroll(); animation-range: 0 140px; }
    @keyframes nav-compact {
        to { padding-top: 0.45rem; padding-bottom: 0.45rem; box-shadow: var(--shadow); }
    }
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.06rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.logo-mark { height: 1.25em; width: auto; display: block; }
.nav-right { display: flex; align-items: center; gap: 0.4rem; }
.nav-links { display: flex; align-items: center; gap: 0.15rem; }
.nav-link {
    font-size: 0.9rem;
    color: var(--ink-2);
    text-decoration: none;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { color: var(--ink); background: var(--wash); }
.nav-link.active { color: var(--ink); }
.nav-cta {
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--ink);
    color: #fff;
    text-decoration: none;
    padding: 0.55rem 1.05rem;
    border-radius: var(--radius-sm);
    transition: background 0.18s ease;
}
.nav-cta:hover { background: var(--blue); }
.nav-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 0 9px;
    background: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.nav-menu-btn span { display: block; height: 1.5px; background: var(--ink); border-radius: 2px; }

/* ============================================================
   Footer
   ============================================================ */
.footer { padding: clamp(3rem, 5vw, 4.5rem) 0 2.5rem; }
.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr repeat(3, 1fr);
    gap: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--line);
}
.footer-brand .logo { margin-bottom: 0.8rem; }
.footer-brand p { font-size: 0.92rem; color: var(--ink-3); }
.footer-col h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-3);
    margin-bottom: 1rem;
}
.footer-col ul { list-style: none; display: grid; gap: 0.55rem; }
.footer-col a { font-size: 0.92rem; color: var(--ink-2); text-decoration: none; }
.footer-col a:hover { color: var(--blue); }
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-top: 1.75rem;
    font-size: 0.85rem;
    color: var(--ink-3);
}
.footer-bottom a { color: var(--ink-3); text-decoration: none; }
.footer-bottom a:hover { color: var(--blue); }

/* ============================================================
   Entrance
   ============================================================ */
.fade-in-up { opacity: 0; transform: translateY(12px); filter: blur(4px); transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.2, 0.6, 0.2, 1), filter 0.65s ease; }
.fade-in-up.visible { opacity: 1; transform: none; filter: none; }
/* siblings arrive with a slight stagger */
.fade-in-up:nth-child(2) { transition-delay: 0.07s; }
.fade-in-up:nth-child(3) { transition-delay: 0.14s; }
.fade-in-up:nth-child(4) { transition-delay: 0.21s; }
.fade-in-up:nth-child(5) { transition-delay: 0.28s; }
.fade-in-up:nth-child(n+6) { transition-delay: 0.35s; }

/* ============================================================
   Chart texture (single hue, edge-cropped, sparing)
   <use> clones don't match descendant selectors, so colours
   travel as custom properties resolved inside the shadow tree.
   ============================================================ */
.chart-deco { position: absolute; pointer-events: none; }
.chart-deco svg { width: 100%; height: 100%; display: block; }
#cg-arc circle { fill: var(--deco-dot, transparent); }
#cg-donut circle { fill: none; }
#cg-donut .cg-hi-s { stroke: var(--deco-hi, transparent); }
#cg-donut .cg-lo-s { stroke: var(--deco-lo, transparent); }
#cg-cols .cg-hi { fill: var(--deco-hi, transparent); }
#cg-cols .cg-lo { fill: var(--deco-lo, transparent); }

/* ============================================================
   Shared data-viz primitives
   ============================================================ */
.viz-cap {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    margin-bottom: 0.9rem;
}
.viz-cap b { font-weight: 500; color: var(--ink-2); }
.viz-cap .up { color: var(--agree); }

.mini-grid { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.mini-grid div { aspect-ratio: 1; border-radius: 2px; background: rgba(43, 75, 196, 0.07); }
.mini-grid div.g { background: rgba(113, 148, 230, 0.45); }
.mini-grid div.q { background: rgba(43, 75, 196, 0.1); box-shadow: inset 0 0 0 1.5px rgba(13, 20, 32, 0.6); }

.rlist { display: grid; gap: 0.45rem; }
.rlist-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--mono);
    font-size: 0.73rem;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.7rem;
}
.rlist-row .r-val { margin-left: auto; color: var(--ink); }
.rlist-row .r-tag {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(11, 122, 87, 0.12);
    color: var(--agree);
}
.rlist-row .r-tag.out { background: rgba(13, 20, 32, 0.06); color: var(--ink-3); }
.rlist-row .r-tag.mk { background: rgba(43, 75, 196, 0.1); color: var(--blue); }
.rlist-row .r-tag.new { background: rgba(242, 163, 60, 0.16); color: var(--find); }

.bar-rows { display: grid; gap: 0.6rem; }
.bar-row { display: grid; grid-template-columns: 10rem 1fr auto; align-items: center; gap: 0.75rem; font-size: 0.82rem; }
.bar-row .bar-name { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { display: block; height: 8px; border-radius: 4px; background: var(--wash-deep); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--blue-soft); }
.bar-row.low .bar-fill { background: var(--find-fill); }
.bar-row .bar-val { font-family: var(--mono); font-size: 0.72rem; color: var(--ink); font-variant-numeric: tabular-nums; }

.agree-meter { display: grid; gap: 0.5rem; }
.agree-track { height: 10px; border-radius: 5px; background: var(--wash-deep); overflow: hidden; position: relative; }
.agree-fill { height: 100%; width: 91%; background: var(--blue); border-radius: 5px; }
.agree-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); }

/* Finding -> evidence -> action as a mono ledger, no coloured pills. */
.ledger { font-family: var(--mono); font-size: 0.73rem; line-height: 1.55; }
.lg-row {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 0.9rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--line);
    color: var(--ink-2);
}
.lg-row:last-child { border-bottom: 1px solid var(--line); }
.lg-k { color: var(--ink-3); }
.lg-find { color: var(--find); }
.lg-act { color: var(--blue); }

.toolines { display: grid; gap: 0.45rem; font-family: var(--mono); font-size: 0.73rem; color: var(--ink-2); }
.toolines > span { display: block; }
.toolines .fn { color: var(--blue); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

@media (max-width: 720px) {
    :root { --gutter: 6px; }
    .shell { padding: 0 1.1rem; }
    .nav-links {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--surface);
        border: 1px solid var(--line-soft);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        padding: 0.5rem;
    }
    .nav.open .nav-links { display: flex; }
    .nav { position: relative; }
    .nav-link { padding: 0.7rem 0.85rem; }
    .nav-menu-btn { display: flex; }
    .bar-row { grid-template-columns: 7.5rem 1fr auto; }
    .footer-grid { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .fade-in-up { opacity: 1; transform: none; filter: none; }
}
