/* ==========================================================================
   yf-theme.css — Your Factotum design system, applied to FGC + FOC
   Source of truth: your-factotum-design-system (src/tokens/tokens.css) and
   the live yourfactotum.com surfaces. Shared by base.html and base_foc.html.
   ========================================================================== */

/* ─── Fonts ─────────────────────────────────────────────────────────────── */
/* JetBrains Mono loads from Google Fonts in the base templates.             */
@font-face {
    font-family: 'Futura Bold';
    src: url('/static/fonts/futura-bold-webfont.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'EB Garamond';
    src: url('/static/fonts/eb-garamond-v26-latin-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'EB Garamond';
    src: url('/static/fonts/eb-garamond-v26-latin-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ─── Brand palette (design-system tokens, exact values) ───────────── */
    --color-deep-blue:      #054992;
    --color-classic-navy:   #1E309C;
    --color-royal-purple:   #401F99;
    --color-magenta-purple: #711F8A;
    --color-wine-red:       #922358;
    --color-deep-crimson:   #B30435;
    --color-vibrant-orange: #FF8C00;
    --color-golden-yellow:  #F2B20E;
    --color-black:          #0D0D0D;
    --color-white:          #F5F5F5;
    --stripe-goldenrod:     #F2B20E;
    --stripe-red:           #B30435;
    --stripe-purple:        #401F99;
    --stripe-blue:          #054992;
    --site-panel:           #888888;
    --site-header:          #545454;
    --cta-gold-hover:       #d99d0c;

    --font-display: 'Futura Bold', 'Impact Condensed', Impact, sans-serif;
    --font-body:    'EB Garamond', Georgia, 'Times New Roman', serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

    /* ─── Surfaces (light-on-grey, as on yourfactotum.com) ─────────────── */
    --ground:      var(--site-panel);           /* page edge                 */
    --panel:       rgba(255, 255, 255, 0.35);   /* main content (~#b2b2b2)   */
    --raise:       rgba(255, 255, 255, 0.35);   /* cards inside the panel    */
    --raise-2:     rgba(255, 255, 255, 0.55);   /* inputs, hover rows        */
    --sunk:        rgba(0, 0, 0, 0.07);         /* table heads, code blocks  */
    --sunk-2:      rgba(0, 0, 0, 0.14);
    --sunk-3:      rgba(0, 0, 0, 0.25);
    --line:        rgba(0, 0, 0, 0.18);
    --line-strong: rgba(0, 0, 0, 0.35);

    /* ─── Text ──────────────────────────────────────────────────────────── */
    --ink:       #0D0D0D;
    --ink-muted: rgba(0, 0, 0, 0.72);
    --ink-faint: rgba(0, 0, 0, 0.55);
    --flag:      var(--color-wine-red);        /* problem values, errors     */
    --ok:        #1f6b2a;                       /* status only — not a brand token */
    --tint-gold: rgba(242, 178, 14, 0.28);
    --tint-ok:   rgba(31, 107, 42, 0.14);
    --tint-flag: rgba(179, 4, 53, 0.12);

    /* ─── Per-tool accent (body.tool-fgc / body.tool-foc override) ─────── */
    --accent:      var(--stripe-blue);
    --accent-text: var(--color-classic-navy);

    /* ─── Legacy names used throughout the page templates ─────────────── */
    --gold:      var(--color-golden-yellow);
    --red:       var(--color-deep-crimson);
    --purple:    var(--color-royal-purple);
    --navy:      var(--color-deep-blue);
    --charcoal:  var(--ground);
    --silver:    var(--ink-muted);
    --off-white: var(--ink);
    --mid-gray:  var(--ink-muted);
    --stripe-height: 6px;
}

body.tool-fgc { --accent: var(--stripe-blue);   --accent-text: var(--color-classic-navy); }
body.tool-foc { --accent: var(--stripe-purple); --accent-text: var(--color-royal-purple); }

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

body {
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ─── Header: nested corner-stripe brackets around the #545454 slab ────── */
/* Floating header: pinned to the top while the page scrolls; its bottom edge
   is the bottom of the goldenrod band. Inset from the left so the light-grey
   ground shows in the top-left corner. */
.yf-frame {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-left: 1.5rem;
    background: var(--stripe-goldenrod);
    padding-bottom: 10px;
    border-bottom-left-radius: 40px;
}
.yf-frame .b-red   { background: var(--stripe-red);    margin-left: 22px; padding-bottom: 8px; border-bottom-left-radius: 32px; }
.yf-frame .b-purple{ background: var(--stripe-purple); margin-left: 18px; padding-bottom: 7px; border-bottom-left-radius: 26px; }
.yf-frame .b-blue  { background: var(--stripe-blue);   margin-left: 14px; padding-bottom: 6px; border-bottom-left-radius: 21px; }
.yf-frame .slab    { background: var(--site-header); margin-left: 12px; border-bottom-left-radius: 18px; padding: 0 2rem; }

header .header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 0;
}
.logo { display: flex; align-items: center; text-decoration: none; }
.logo img { height: 48px; width: auto; display: block; }
.header-meta {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: rgba(245, 245, 245, 0.78);
    text-align: right;
    line-height: 1.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ─── Sub-header: search + FGC/FOC tabs ───────────────────────────────── */
.sub-header { padding: 0 2rem; margin-top: 1.25rem; }
.sub-header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.sub-header-form {
    display: flex;
    align-items: stretch;
    flex: 1;
    min-width: 200px;
    max-width: 600px;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    overflow: hidden;
}
.sub-header-form input {
    flex: 1;
    background: var(--color-white);
    border: none;
    color: var(--ink);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    outline: none;
    min-width: 0;
}
.sub-header-form input::placeholder { color: var(--ink-faint); }
.sub-header-form input:focus { background: #ffffff; }
.sub-header-form select {
    background: var(--color-white);
    border: none;
    border-left: 1px solid var(--line);
    color: var(--ink);
    padding: 0.5rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
    outline: none;
}
.sub-header-form button {
    background: var(--gold);
    color: var(--ink);
    border: none;
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
}
.sub-header-form button:hover { background: var(--cta-gold-hover); }
.sub-header-links { display: flex; gap: 0.4rem; align-items: center; flex-shrink: 0; }
.sub-header-links a {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.72rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
}
.sub-header-links a:hover { background: var(--raise-2); }
.sub-header-links a.active { background: var(--accent); border-color: var(--accent); color: var(--color-white); }
.sub-header-divider { width: 1px; height: 1.4rem; background: var(--line-strong); flex-shrink: 0; }

/* ─── Main panel ──────────────────────────────────────────────────────── */
main {
    margin: 1.25rem 0 3rem max(2rem, calc((100% - 1400px) / 2));
    padding: 2rem 3rem 2rem 2rem;
    background: var(--panel);
    border-radius: 24px 0 0 24px;
}

/* ─── Results & cards ─────────────────────────────────────────────────── */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
}
.result-card {
    background: var(--raise-2);
    padding: 1rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: background 0.1s;
    border-left: 3px solid transparent;
}
.result-card:hover { background: #ffffff; border-left-color: var(--accent); }

/* ─── Detail page components ──────────────────────────────────────────── */
.detail-header { border-left: 4px solid var(--accent); padding-left: 1.5rem; margin-bottom: 2rem; }
.detail-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.1rem;
    letter-spacing: 0.02em;
    line-height: 1.05;
    color: var(--ink);
    text-transform: uppercase;
}
.detail-sub {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--accent-text);
    margin-top: 0.35rem;
    letter-spacing: 0.05em;
}
.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.kv-label {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.62rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 0.15rem;
}
.kv-value { font-size: 0.95rem; color: var(--ink); }

/* ─── Data table ──────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-white);
    text-align: left;
    padding: 0.55rem 0.75rem;
    background: var(--color-black);
    border-bottom: 1px solid var(--color-black);
}
.data-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }

/* ─── Back link ───────────────────────────────────────────────────────── */
.back-link {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.68rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--accent-text); }

/* ─── Footer: rainbow key is footer-only ──────────────────────────────── */
.yf-footer {
    /* As on yourfactotum.com: flush to the page bottom, starts at the content
       column, runs off the right edge, only the top-left corner rounded. */
    margin: auto 0 0 max(2rem, calc((100% - 1400px) / 2));
    position: relative;
    overflow: hidden;
    min-height: 150px;
    background: var(--site-header);
    border-top-left-radius: 24px;
    color: rgba(245, 245, 245, 0.85);
    padding: 1.6rem 2rem 2rem;
}
.yf-footer-inner { position: relative; z-index: 1; max-width: 520px; }
.yf-footer .footer-mark { height: 30px; width: auto; display: block; margin-bottom: 1rem; }
.yf-footer .footer-blurb {
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
.yf-footer .footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-bottom: 0.6rem; }
.yf-footer .footer-links a {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-white);
    text-decoration: none;
}
.yf-footer .footer-links a:hover { text-decoration: underline; }
.yf-footer .footer-meta {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(245, 245, 245, 0.7);
}
/* Rainbow key lockup: footer-only brand accent, anchored bottom-right */
.yf-footer .footer-rainbow {
    position: absolute;
    right: 2rem;      /* keep the key's bow and bit fully inside the footer */
    bottom: -6px;     /* only the stripe tails run off the bottom edge      */
    height: 200px;    /* yf-rainbow.png carries ~30% empty space above the art */
    width: auto;
    pointer-events: none;
}

/* ─── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--site-header); }
::-webkit-scrollbar-thumb:hover { background: var(--color-black); }

@media (max-width: 720px) {
    .yf-frame { margin-left: 1rem; }
    .yf-frame .slab { padding: 0 1rem; }
    .header-meta { display: none; }
    main { border-radius: 0; padding: 1.25rem; }
    .sub-header { padding: 0 1rem; }
    main { margin-left: 0; padding-right: 1.25rem; }
    .yf-footer { margin-left: 0; border-top-left-radius: 0; padding-bottom: 7rem; }
    .yf-footer .footer-rainbow { height: 150px; }
}
