/*
 * shell.css — site chrome shared by every page (2026-09-16 redesign).
 *
 * Header (sticky, mega-menu, hamburger), footer (5 columns) and the design
 * tokens the redesign introduces. Loaded AFTER main.css on every page so the
 * legacy .header/.nav/.footer rules there are simply unused. The homepage
 * adds home.css on top. Tool pages keep their own typography: only the new
 * tokens --font-serif / --font-sans are introduced, --font-display and
 * --font-mono are untouched (see the note in home.css for the dark override).
 */

:root {
    /* Surfaces / ink — aliases of the main.css palette so a single change
       (or the dark override in home.css) flips the whole shell. */
    --bg:          var(--cream);
    --bg-2:        var(--cream-dark);
    --bg-3:        var(--cream-darker);
    --ink-2:       var(--ink-light);
    --ink-3:       var(--ink-muted);
    --line:        var(--cream-darker);
    --line-strong: var(--border-control);
    --accent:      var(--red);
    --accent-hover: var(--red-hover);
    --on-accent:   #f2ebe0;

    /* Category accents (left borders on cards + mega-menu columns).
       Decorative, but every one is ≥ 4.5:1 on --cream so they can also be
       used for small labels. */
    --cat-house:      #b83224;
    --cat-spicy:      #a63c00;
    --cat-compliance: #7a5600;
    --cat-side:       #276b2b;
    --cat-workflow:   #2c5aa0;

    /* Typography (self-hosted, see fonts.css) */
    --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-sans:  'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Layout */
    --maxw:   1180px;
    --gutter: 28px;
    --radius: 6px;
    --shell-h: 64px;
    --ease: 0.16s ease;
}

/* In-page anchors land below the sticky header. */
html { scroll-padding-top: calc(var(--shell-h) + 12px); }

/* Wider content column for the whole site (was 1060px / 2rem). */
.container { max-width: var(--maxw); padding: 0 var(--gutter); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .sh *, .sh *::before, .sh *::after, .sf * { transition: none !important; animation: none !important; }
}


/* =====================================================================
   Header
   ===================================================================== */
.sh {
    position: sticky; top: 0; z-index: 500;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    font-family: var(--font-sans);
}
.sh__inner {
    position: relative;
    max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter);
    min-height: var(--shell-h);
    display: flex; align-items: center; gap: 1.25rem;
}

/* Logo + tagline */
.sh__logo {
    display: flex; flex-direction: column; justify-content: center;
    line-height: 1; color: var(--ink); text-decoration: none;
    padding: 0.5rem 0; margin-right: 0.25rem; flex-shrink: 0;
}
.sh__logo:hover { color: var(--ink); }
.sh__wordmark {
    font-family: var(--font-serif); font-weight: 700; font-size: 1.45rem;
    letter-spacing: -0.02em; font-variation-settings: 'opsz' 40;
}
.sh__wordmark .cyber { color: var(--accent); }
.sh__tagline {
    font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--ink-3); margin-top: 0.3rem;
}

/* Primary nav */
.sh__nav { display: flex; align-items: center; flex: 1; gap: 1rem; min-width: 0; }
.sh__list { list-style: none; display: flex; align-items: center; gap: 0.1rem; margin: 0; padding: 0; }
.sh__item { position: relative; }
.sh__link {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.55rem 0.7rem; min-height: 40px;
    font: inherit; font-size: 0.86rem; font-weight: 500; color: var(--ink-2);
    background: none; border: 0; border-radius: var(--radius); cursor: pointer;
    text-decoration: none; white-space: nowrap;
    transition: color var(--ease), background var(--ease);
}
.sh__link:hover { color: var(--accent); background: var(--bg-2); }
.sh__link.is-active { color: var(--accent); font-weight: 600; }
.sh__link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sh__chev { width: 0.7em; height: 0.7em; transition: transform var(--ease); }
.sh__item.is-open > .sh__link .sh__chev { transform: rotate(180deg); }

/* Right-hand actions */
.sh__actions { display: flex; align-items: center; gap: 0.45rem; margin-left: auto; }
.sh__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius);
    color: var(--ink-2); transition: color var(--ease), background var(--ease);
}
.sh__icon svg { width: 18px; height: 18px; }
.sh__icon:hover { color: var(--accent); background: var(--bg-2); }
.sh__icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sh__ghost, .sh__cta {
    display: inline-flex; align-items: center; gap: 0.35rem;
    min-height: 40px; padding: 0 0.85rem; border-radius: var(--radius);
    font-size: 0.8rem; font-weight: 600; letter-spacing: 0.01em;
    text-decoration: none; white-space: nowrap;
    transition: color var(--ease), background var(--ease), border-color var(--ease);
}
.sh__ghost { color: var(--ink-2); border: 1px solid var(--line-strong); background: transparent; }
.sh__ghost:hover { color: var(--accent); border-color: var(--accent); }
.sh__ghost svg { width: 14px; height: 14px; }
.sh__cta { color: var(--on-accent); background: var(--accent); border: 1px solid var(--accent); }
.sh__cta:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.sh__ghost:focus-visible, .sh__cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Language switcher (self-hides until >1 language) keeps its own markup. */
.sh__actions .lang-switch { margin-left: 0.25rem; }

/* Hamburger (≤860px only) */
.sh__burger {
    display: none; margin-left: auto;
    width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: transparent; color: var(--ink); cursor: pointer; padding: 0;
    align-items: center; justify-content: center;
}
.sh__burger svg { width: 22px; height: 22px; }
.sh__burger .ico-close { display: none; }
.sh.is-open .sh__burger .ico-open { display: none; }
.sh.is-open .sh__burger .ico-close { display: block; }
.sh__burger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* ---------------------------------------------------------------------
   Mega-menu (desktop: floating panel under "Tools")
   --------------------------------------------------------------------- */
.sh__mega {
    display: none;
    position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
    width: min(920px, 92vw);
    background: var(--bg); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(26, 18, 16, 0.16), 0 2px 6px rgba(26, 18, 16, 0.08);
    padding: 1.3rem 1.4rem 1.1rem;
    z-index: 600;
}
/* The trigger's <li> is position:relative for the chevron only; the panel is
   centred on the header row itself. */
.sh__item--mega { position: static; }
.sh__item--mega.is-open > .sh__mega { display: block; }
/* No-JS / mouse fallback: hover opens it too (never on touch, where a tap
   would "stick" the :hover state and fight the button toggle). */
@media (hover: hover) and (min-width: 861px) {
    .sh__item--mega:hover > .sh__mega { display: block; }
}

.sh__mega-grid {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.2rem;
}
.sh__col { --cat: var(--accent); border-left: 3px solid var(--cat); padding-left: 0.75rem; min-width: 0; }
.sh__col--house { --cat: var(--cat-house); } .sh__col--spicy { --cat: var(--cat-spicy); }
.sh__col--compliance { --cat: var(--cat-compliance); } .sh__col--side { --cat: var(--cat-side); }
.sh__col--workflow { --cat: var(--cat-workflow); }
.sh__col-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.4rem; margin-bottom: 0.45rem; }
.sh__col-title { font-family: var(--font-serif); font-weight: 700; font-size: 0.98rem; color: var(--ink); line-height: 1.2; }
.sh__col-jp { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-3); white-space: nowrap; }
.sh__col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.sh__col li a, .sh__col li .sh__soon {
    display: block; padding: 0.28rem 0.35rem; margin-left: -0.35rem; border-radius: 4px;
    font-size: 0.82rem; color: var(--ink-2); text-decoration: none; line-height: 1.35;
}
.sh__col li a:hover { color: var(--accent); background: var(--bg-2); }
.sh__col li a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sh__col li .sh__soon { color: var(--ink-3); }
.sh__col li .sh__soon .sh__pill { margin-left: 0.3rem; }
.sh__viewall {
    display: inline-block; margin-top: 0.5rem;
    font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; color: var(--accent);
}
.sh__viewall:hover { text-decoration: underline; }
.sh__pill {
    display: inline-block; font-family: var(--font-mono); font-size: 0.58rem; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase; padding: 0.08em 0.4em; border-radius: 3px;
    border: 1px solid currentColor; vertical-align: middle;
}

.sh__mega-more {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
    margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--line);
}
.sh__mega-more-label { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; margin-right: 0.2rem; }
.sh__chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.6rem; border-radius: 999px; border: 1px solid var(--line);
    background: var(--bg-2); color: var(--ink-2); font-size: 0.76rem; text-decoration: none;
    transition: border-color var(--ease), color var(--ease);
}
.sh__chip:hover { border-color: var(--accent); color: var(--accent); }
.sh__chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sh__chip-n { font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-3); }
.sh__browse { margin-left: auto; font-family: var(--font-mono); font-size: 0.76rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
.sh__browse:hover { text-decoration: underline; }


/* ---------------------------------------------------------------------
   ≤ 860px — hamburger panel, mega-menu becomes a static block
   --------------------------------------------------------------------- */
@media (max-width: 860px) {
    .sh__inner { flex-wrap: wrap; gap: 0.75rem; }
    .sh__burger { display: inline-flex; }
    .sh__nav {
        display: none; flex-direction: column; align-items: stretch; gap: 0.75rem;
        flex-basis: 100%; padding: 0.5rem 0 1rem;
        max-height: calc(100vh - var(--shell-h)); overflow-y: auto;
        border-top: 1px solid var(--line);
    }
    .sh.is-open .sh__nav { display: flex; }
    .sh__list { flex-direction: column; align-items: stretch; gap: 0; }
    .sh__link { width: 100%; justify-content: space-between; min-height: 44px; font-size: 0.95rem; }
    .sh__actions { margin-left: 0; flex-wrap: wrap; gap: 0.5rem; }
    .sh__cta, .sh__ghost { flex: 1 1 auto; justify-content: center; min-height: 44px; }

    .sh__item--mega { position: relative; }
    .sh__mega {
        position: static; transform: none; width: auto;
        box-shadow: none; border: 0; border-left: 1px solid var(--line); border-radius: 0;
        padding: 0.4rem 0 0.6rem 0.9rem; margin: 0.2rem 0 0.4rem 0.7rem;
    }
    .sh__mega-grid { grid-template-columns: 1fr; gap: 1rem; }
    .sh__col li a, .sh__col li .sh__soon { min-height: 40px; display: flex; align-items: center; }
    .sh__browse { margin-left: 0; }
    /* On touch the trigger toggles; never hover-open. */
    .sh__item--mega:hover > .sh__mega { display: none; }
    .sh__item--mega.is-open > .sh__mega { display: block; }
}
@media (max-width: 540px) {
    :root { --gutter: 16px; }
    .sh__tagline { display: none; }
    .sh__wordmark { font-size: 1.3rem; }
}


/* =====================================================================
   Footer
   ===================================================================== */
.sf {
    margin-top: 4rem; border-top: 1px solid var(--line);
    background: var(--bg); color: var(--ink-2); font-family: var(--font-sans);
}
.sf__inner { max-width: var(--maxw); margin: 0 auto; padding: 2.6rem var(--gutter) 1.8rem; }
.sf__grid {
    display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 2rem;
}
.sf__brand .sh__wordmark { font-size: 1.35rem; display: block; color: var(--ink); }
.sf__brand p { font-size: 0.82rem; line-height: 1.6; color: var(--ink-3); margin: 0.6rem 0 0; max-width: 34ch; }
.sf__brand a { color: var(--accent); font-weight: 600; }
.sf__col h2 {
    font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.7rem;
}
.sf__col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.sf__col a {
    display: inline-block; padding: 0.22rem 0; font-size: 0.85rem; color: var(--ink-2); text-decoration: none;
}
.sf__col a:hover { color: var(--accent); }
.sf__col a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sf__col .sf__soon { font-size: 0.85rem; color: var(--ink-3); }
.sf__bottom {
    margin-top: 2rem; padding-top: 1.1rem; border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1.5rem;
    font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3);
}
.sf__bottom p { margin: 0; }
.sf__bottom a { color: var(--accent); }
.sf__privacy { font-size: 0.74rem; line-height: 1.6; color: var(--ink-3); margin: 1.4rem 0 0; max-width: 90ch; }
.sf__privacy a { color: var(--accent); }

@media (max-width: 860px) {
    .sf__grid { grid-template-columns: 1fr 1fr; gap: 1.6rem; }
    .sf__brand { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
    .sf__grid { grid-template-columns: 1fr; }
    .sf__bottom { flex-direction: column; align-items: flex-start; }
}
