/* type-system.css — the shared type system (font_best.md, Part 7).
   Products never edit this file. Typography only: per the 2026-10-15 rollout,
   each site keeps its own color palette, so the color tokens of Part 7 are not shipped here.
   Spec pin: font_best.md sha256 211a743c9038d195b77e8cfac14fd9de25e0c218c4925c8857b8218a518738ab,
   retrieved 2026-10-15, family Inter (_shared/design/FONT_SPEC.lock, ADR-DS01).
   Canonical copy: _shared/design/type-system.css. Every site copy is byte-identical;
   `python3 _shared/tools/design_lint.py --sync` rewrites them, the lint fails on drift. */
@layer ts-tokens, ts-base, ts-utilities;  /* prefixed so they never reorder a host site's own layers */

@font-face {
  font-family: "Inter";
  src: url("../../../assets/fonts/inter-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("Helvetica");
  size-adjust: 107.1%;
  ascent-override: 90.4%;
  descent-override: 22.5%;
  line-gap-override: 0%;
}

@layer ts-tokens {
  :root {
    --font-sans: "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    --font-size-caption: 0.75rem;
    --font-size-small:   0.875rem;
    --font-size-body:    1rem;
    --font-size-lead:    1.125rem;
    --font-size-sub:     1.25rem;
    --font-size-heading: 1.5rem;
    --font-size-title:   clamp(2rem, 1.75rem + 1vw, 2.5rem);
    --font-size-display: clamp(2.75rem, 2.4rem + 1.4vw, 3.75rem);

    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;

    --leading-display: 1.05;
    --leading-title: 1.1;
    --leading-heading: 1.2;
    --leading-sub: 1.3;
    --leading-body: 1.55;
    --leading-small: 1.5;
    --leading-caption: 1.45;
    --leading-label: 1.3;

    --tracking-display: -0.02em;
    --tracking-title: -0.015em;
    --tracking-heading: -0.01em;
    --tracking-caps: 0.06em;

    --measure: 65ch;
    --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
    --space-5: 1.5rem;  --space-6: 2rem;   --space-7: 3rem;    --space-8: 4rem;
    --space-9: 6rem;    --space-10: 8rem;
    --space-paragraph: 1em;
    --space-heading-above: 2.5em;
    --space-heading-below: 0.5em;
    --space-card: var(--space-5);
    --space-section-app: var(--space-7);
    --space-section: clamp(2.5rem, 8vw, 6rem);
    --gutter: clamp(1rem, 3.5vw, 2.5rem);
  }
}

@layer ts-base {
  html {
    font-family: var(--font-sans);
    font-synthesis: none;
    font-optical-sizing: auto;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body { font: var(--weight-regular) var(--font-size-body) / var(--leading-body) var(--font-sans); }
  :lang(ja), :lang(zh), :lang(ko) { line-height: 1.7; font-style: normal; }
  h1 { font-size: var(--font-size-title);   font-weight: var(--weight-semibold); line-height: var(--leading-title);   letter-spacing: var(--tracking-title);   text-wrap: balance; }
  h2 { font-size: var(--font-size-heading); font-weight: var(--weight-medium);   line-height: var(--leading-heading); letter-spacing: var(--tracking-heading); text-wrap: balance; }
  h3 { font-size: var(--font-size-sub);     font-weight: var(--weight-medium);   line-height: var(--leading-sub);     text-wrap: balance; }
  h4, h5, h6 { font-size: var(--font-size-body); font-weight: var(--weight-medium); line-height: var(--leading-body); }
  p, li { text-wrap: pretty; }
  p { max-inline-size: var(--measure); }
  small { font-size: var(--font-size-caption); line-height: var(--leading-caption); }
  strong, b { font-weight: var(--weight-medium); }
  em { font-style: normal; font-weight: var(--weight-medium); color: var(--color-text, inherit); }
  :where(h1, .t-display, .t-title) em { font-weight: inherit; }
  code, kbd, pre, samp { font-family: var(--font-mono); font-size: max(0.875em, 0.875rem); }
  pre { overflow-x: auto; max-inline-size: 100%; }
  td, th, [data-numeric] { font-variant-numeric: tabular-nums; }
  input, select, textarea, button { font: inherit; }
  input, select, textarea { font-size: max(var(--font-size-body), 100%); }
  a { text-underline-offset: 0.15em; }
}

@layer ts-utilities {
  .t-display    { font-size: var(--font-size-display); font-weight: var(--weight-semibold); line-height: var(--leading-display); letter-spacing: var(--tracking-display); text-wrap: balance; }
  .t-title      { font-size: var(--font-size-title);   font-weight: var(--weight-semibold); line-height: var(--leading-title);   letter-spacing: var(--tracking-title); }
  .t-heading    { font-size: var(--font-size-heading); font-weight: var(--weight-medium);   line-height: var(--leading-heading); letter-spacing: var(--tracking-heading); }
  .t-subheading { font-size: var(--font-size-sub);     font-weight: var(--weight-medium);   line-height: var(--leading-sub); }
  .t-lead       { font-size: var(--font-size-lead);    font-weight: var(--weight-regular);  line-height: var(--leading-body); }
  .t-body       { font-size: var(--font-size-body);    font-weight: var(--weight-regular);  line-height: var(--leading-body); }
  .t-body-sm    { font-size: var(--font-size-small);   font-weight: var(--weight-regular);  line-height: var(--leading-small); }
  .t-label      { font-size: var(--font-size-small);   font-weight: var(--weight-medium);   line-height: var(--leading-label); }
  .t-overline   { font-size: var(--font-size-caption); font-weight: var(--weight-medium);   line-height: var(--leading-label);   letter-spacing: var(--tracking-caps); text-transform: uppercase; }
  .t-caption    { font-size: var(--font-size-caption); font-weight: var(--weight-regular);  line-height: var(--leading-caption); }
  .t-code       { font-family: var(--font-mono); font-size: max(0.875em, 0.875rem); }
  .t-numeric    { font-variant-numeric: tabular-nums; }
  .reading { font-size: var(--font-size-lead); }
}

/**
 * TWC Core Design Tokens
 * TheWorkCompany Ecosystem — Shared Visual Language
 *
 * EVERY app and widget imports this file FIRST.
 * Partners override tokens via CSS custom properties or THEME_* config vars.
 * Canonical copy: _shared/design/twc_core.css. Site copies are byte-identical
 * (_shared/tools/design_lint.py checks them); products never redefine --twc-*
 * here or elsewhere except as aliases to their own --<project>-* tokens (ADR-DS04).
 *
 * Design principles (constitution §13):
 *   - Light theme by default. Warm off-white background. Near-black text.
 *   - Pastel-neutral palette. Mild accent pastels for CTAs and status only.
 *   - No gradients. Flat color only. No drop shadows on text.
 *   - Big fonts, not bold fonts. Hierarchy comes from SIZE, never WEIGHT.
 *     Body and headings share weight 400. Emphasis caps at 500. Never 600+.
 *   - Generous whitespace. Generous line-height (1.65 body, 1.2 heading).
 *   - Mobile-first, fluid responsive. Base styles target mobile.
 *   - Flat single-weight line icons (Lucide / Phosphor / Heroicons outline).
 */

/* ══════════════════════════════════════════════
   1. DESIGN TOKENS
   ══════════════════════════════════════════════ */

:root {
    /* ── Color: Base ── */
    --twc-bg:              #FAFAF8;
    --twc-surface:         #FFFFFF;
    --twc-surface-hover:   #F5F5F0;
    --twc-border:          #E8E6E1;
    --twc-divider:         #F0EEEA;

    /* ── Color: Text ── */
    --twc-text:            #1A1A1A;
    --twc-text-secondary:  #6B6B6B;
    --twc-text-muted:      #5A5A5A; /* 6.7:1 on --twc-bg (was #9B9B9B, 2.7:1) */
    --twc-text-inverse:    #FFFFFF;
    --twc-overlay:         rgba(0,0,0,0.3);

    /* ── Color: Accent Pastels ── */
    --twc-accent:          #5B8DEF;
    --twc-accent-hover:    #4A7DE0;
    --twc-accent-light:    #EBF1FD;
    --twc-success:         #6BC67E;
    --twc-success-light:   #EDF8F0;
    --twc-warning:         #E8C356;
    --twc-warning-light:   #FDF8E8;
    --twc-error:           #E07070;
    --twc-error-light:     #FDEDED;
    --twc-success-text:    #2D7A3F;
    --twc-warning-text:    #8A6D1B;
    --twc-error-text:      #A63D3D;
    --twc-highlight:       #C4B0F5;
    --twc-highlight-light: #F3EFFD;

    /* ── Focus ── */
    --twc-focus:           var(--twc-accent);
    --twc-focus-ring:      0 0 0 2px var(--twc-bg), 0 0 0 4px var(--twc-focus);

    /* ── Typography ── */
    /* Hierarchy comes from SIZE, not WEIGHT.
       Body and headings both use weight 400. Emphasis tops out at 500.
       --twc-font-weight-bold is an alias for 500 (do NOT exceed 500). */
    --twc-font:            "Inter", "Inter Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
    --twc-font-mono:       "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
    --twc-font-display:    var(--twc-font);  /* logo fallback + display use: the one approved family */
    --twc-font-weight:        400;   /* body, headings, default */
    --twc-font-weight-medium: 500;   /* UI emphasis: buttons, labels, card titles */
    --twc-font-weight-bold:   500;   /* alias — kept for back-compat. Do not exceed 500. */

    /* ── Type Scale (fluid) ── bigger than typical defaults — "big fonts" by design */
    --twc-text-xs:    0.875rem; /* 13-14px — labels only */
    --twc-text-sm:    1rem;     /* 15-16px — supporting */
    --twc-text-base:  1.125rem;   /* 17-19px — body */
    --twc-text-lg:    1.5rem;     /* 20-24px — card titles */
    --twc-text-xl:    clamp(2rem, 1.75rem + 1vw, 2.5rem);           /* 24-32px — section heading */
    --twc-text-2xl:   clamp(2rem, 1.75rem + 1vw, 2.5rem);       /* 32-46px — page title */
    --twc-text-3xl:   clamp(2.75rem, 2.4rem + 1.4vw, 3.75rem);           /* 40-64px — hero headline */
    --twc-line-height:       1.55;   /* body — generous, breathable */
    --twc-line-height-tight: 1.2;    /* headings — large size carries it */

    /* ── Spacing Scale ── */
    --twc-space-1:  0.25rem;
    --twc-space-2:  0.5rem;
    --twc-space-3:  0.75rem;
    --twc-space-4:  1rem;
    --twc-space-6:  1.5rem;
    --twc-space-8:  2rem;
    --twc-space-12: 3rem;
    --twc-space-16: 4rem;
    --twc-space-24: 6rem;

    /* ── Layout ── */
    --twc-content-width:  1200px;
    --twc-narrow-width:   720px;
    --twc-header-height:  64px;
    --twc-sidebar-width:  260px;
    --twc-radius:         8px;
    --twc-radius-sm:      4px;
    --twc-radius-lg:      16px;
    --twc-radius-full:    9999px;

    /* ── Transitions ── */
    --twc-transition:      150ms ease;
    --twc-transition-slow: 300ms ease;

    /* ── Shadows (minimal) ── */
    --twc-shadow-sm:   0 1px 2px rgba(0,0,0,0.04);
    --twc-shadow:      0 1px 4px rgba(0,0,0,0.06);
    --twc-shadow-lg:   0 4px 12px rgba(0,0,0,0.08);

    /* ── Logo sizing ── */
    --twc-logo-sm:  32px;
    --twc-logo-md:  48px;
    --twc-logo-lg:  72px;
    --twc-logo-xl:  120px;
}


/* ══════════════════════════════════════════════
   1a. FONT FACES
   ══════════════════════════════════════════════ */
/* None. Inter is declared once, in type-system.css (load it before this file);
   monospace uses system fonts (ui-monospace etc.), nothing to download. */


/* ══════════════════════════════════════════════
   2. RESET & BASE
   ══════════════════════════════════════════════ */

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

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    font-family: var(--twc-font);
    font-size: var(--twc-text-base);
    font-weight: var(--twc-font-weight);
    line-height: var(--leading-body, 1.55);
    color: var(--twc-text);
    background-color: var(--twc-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--twc-accent); text-decoration: none; transition: color var(--twc-transition); }
a:hover { color: var(--twc-accent-hover); }

/* Focus: the ring is a box-shadow, so a transparent outline stays underneath for
   forced-colors mode, which drops box-shadow but repaints the outline. */
:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: var(--twc-focus-ring);
}
@media (forced-colors: active) {
    :focus-visible { outline: 2px solid CanvasText; }
}


/* ══════════════════════════════════════════════
   3. TYPOGRAPHY CLASSES
   ══════════════════════════════════════════════ */

.twc-hero-headline {
    font-size: var(--twc-text-3xl);
    font-weight: var(--weight-semibold, 600);
    line-height: var(--leading-display, 1.05);
    color: var(--twc-text);
    letter-spacing: var(--tracking-display, -0.02em);
}

.twc-page-title {
    font-size: var(--twc-text-2xl);
    font-weight: var(--weight-semibold, 600);
    line-height: var(--leading-title, 1.1);
    color: var(--twc-text);letter-spacing:var(--tracking-title, -0.015em);
}

.twc-section-heading {
    font-size: var(--twc-text-xl);
    font-weight: var(--weight-semibold, 600);
    line-height: var(--leading-title, 1.1);
    color: var(--twc-text);letter-spacing:var(--tracking-title, -0.015em);
}

.twc-card-title {
    font-size: var(--twc-text-lg);
    font-weight: var(--weight-medium, 500);
    line-height: var(--leading-heading, 1.2);
    color: var(--twc-text);letter-spacing:var(--tracking-heading, -0.01em);
}

.twc-body { font-size: var(--twc-text-base); }
.twc-supporting { font-size: var(--twc-text-sm); color: var(--twc-text-secondary); }
.twc-label {
    font-size: var(--font-size-caption, 0.75rem);
    font-weight: var(--weight-medium, 500);
    line-height: var(--leading-label, 1.3);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps, 0.06em);
    color: var(--twc-text-muted);
}

/* Reading width constraint for long-form text */
.twc-prose { max-width: var(--twc-narrow-width); }


/* ══════════════════════════════════════════════
   3a. LOGO — image with first-letter fallback
   ══════════════════════════════════════════════ */
/* Use logo_helper::app_logo_html() to render. The helper picks <img> if
   APP_LOGO is configured AND the file exists, otherwise the fallback below. */

.twc-logo,
.twc-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--twc-logo-md);
    height: var(--twc-logo-md);
    border-radius: var(--twc-radius-full);
    flex-shrink: 0;
    overflow: hidden;
    line-height: 1;
}

.twc-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.twc-logo-fallback {
    background: var(--twc-accent-light);
    color: var(--twc-accent);
    font-family: var(--twc-font-display);
    font-weight: var(--twc-font-weight-medium);
    font-size: calc(var(--twc-logo-md) * 0.5);
    text-transform: uppercase;
    user-select: none;
}

.twc-logo--sm,
.twc-logo--sm.twc-logo-fallback { width: var(--twc-logo-sm); height: var(--twc-logo-sm); }
.twc-logo--sm.twc-logo-fallback { font-size: calc(var(--twc-logo-sm) * 0.5); }

.twc-logo--lg,
.twc-logo--lg.twc-logo-fallback { width: var(--twc-logo-lg); height: var(--twc-logo-lg); }
.twc-logo--lg.twc-logo-fallback { font-size: calc(var(--twc-logo-lg) * 0.5); }

.twc-logo--xl,
.twc-logo--xl.twc-logo-fallback { width: var(--twc-logo-xl); height: var(--twc-logo-xl); }
.twc-logo--xl.twc-logo-fallback { font-size: calc(var(--twc-logo-xl) * 0.5); }


/* ══════════════════════════════════════════════
   4. LAYOUT PRIMITIVES
   ══════════════════════════════════════════════ */

.twc-layout {
    width: 100%;
    padding: var(--twc-space-4);
}

@media (min-width: 768px) {
    .twc-layout { padding: var(--twc-space-8); }
}

@media (min-width: 1024px) {
    .twc-layout {
        max-width: var(--twc-content-width);
        margin: 0 auto;
        padding: var(--twc-space-12);
    }
}

.twc-section {
    padding-top: var(--twc-space-12);
    padding-bottom: var(--twc-space-12);
}

@media (min-width: 768px) {
    .twc-section {
        padding-top: var(--twc-space-16);
        padding-bottom: var(--twc-space-16);
    }
}

@media (min-width: 1024px) {
    .twc-section {
        padding-top: var(--twc-space-24);
        padding-bottom: var(--twc-space-24);
    }
}

.twc-center { text-align: center; margin-left: auto; margin-right: auto; }


/* ══════════════════════════════════════════════
   5. COMPONENT CLASSES
   ══════════════════════════════════════════════ */

/* ── Card ── */
.twc-card {
    background: var(--twc-surface);
    border: 1px solid var(--twc-border);
    border-radius: var(--twc-radius);
    padding: var(--twc-space-6);
    box-shadow: var(--twc-shadow-sm);
    transition: box-shadow var(--twc-transition), border-color var(--twc-transition);
}

.twc-card:hover {
    box-shadow: var(--twc-shadow);
    border-color: var(--twc-accent-light);
}

/* ── Button: Primary ── */
.twc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--twc-space-2);
    padding: var(--twc-space-3) var(--twc-space-6);
    font-family: var(--twc-font);
    font-size: var(--twc-text-base);
    font-weight: var(--weight-medium, 500);
    line-height: var(--leading-body, 1.55);
    color: var(--twc-text-inverse);
    background: var(--twc-accent);
    border: none;
    border-radius: var(--twc-radius);
    cursor: pointer;
    transition: background var(--twc-transition);
    min-height: 44px; /* WCAG touch target */
    min-width: 44px;
}

.twc-btn:hover { background: var(--twc-accent-hover); }

/* ── Button: Secondary ── */
.twc-btn-secondary {
    composes: twc-btn;
    color: var(--twc-text);
    background: var(--twc-surface);
    border: 1px solid var(--twc-border);
}

.twc-btn-secondary:hover {
    background: var(--twc-surface-hover);
    border-color: var(--twc-accent);
}

/* ── Button: Ghost ── */
.twc-btn-ghost {
    color: var(--twc-accent);
    background: transparent;
    border: none;
    padding: var(--twc-space-2) var(--twc-space-4);
    font-family: var(--twc-font);
    font-size: var(--twc-text-base);
    font-weight: var(--weight-medium, 500);
    cursor: pointer;
    transition: background var(--twc-transition);
    border-radius: var(--twc-radius-sm);
    min-height: 44px;
}

.twc-btn-ghost:hover { background: var(--twc-accent-light); }

/* ── Input ── */
.twc-input {
    width: 100%;
    padding: var(--twc-space-3) var(--twc-space-4);
    font-family: var(--twc-font);
    font-size: var(--twc-text-base);
    color: var(--twc-text);
    background: var(--twc-surface);
    border: 1px solid var(--twc-border);
    border-radius: var(--twc-radius-sm);
    transition: border-color var(--twc-transition);
    min-height: 44px;
}

.twc-input:focus {
    outline: 2px solid transparent;
    border-color: var(--twc-accent);
    box-shadow: 0 0 0 3px var(--twc-accent-light);
}

.twc-input::placeholder { color: var(--twc-text-muted); }

/* ── Badge / Tag ── */
.twc-badge {
    display: inline-block;
    padding: var(--twc-space-1) var(--twc-space-3);
    font-size: var(--twc-text-xs);
    font-weight: var(--weight-medium, 500);
    border-radius: var(--twc-radius-full);
    line-height: var(--leading-label, 1.3);
}

.twc-badge-accent  { background: var(--twc-accent-light);    color: var(--twc-accent); }
.twc-badge-success { background: var(--twc-success-light);   color: var(--twc-success-text); }
.twc-badge-warning { background: var(--twc-warning-light);   color: var(--twc-warning-text); }
.twc-badge-error   { background: var(--twc-error-light);     color: var(--twc-error-text); }

/* ── Divider ── */
.twc-divider {
    border: none;
    border-top: 1px solid var(--twc-divider);
    margin: var(--twc-space-8) 0;
}

/* ── Skeleton loading placeholder ── */
.twc-skeleton {
    background: linear-gradient(90deg, var(--twc-divider) 25%, var(--twc-surface-hover) 50%, var(--twc-divider) 75%);
    background-size: 200% 100%;
    animation: twc-shimmer 1.5s infinite;
    border-radius: var(--twc-radius-sm);
}

@keyframes twc-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ══════════════════════════════════════════════
   6. NAVIGATION CHROME — HEADER & FOOTER
   ══════════════════════════════════════════════ */

/* ── Header ── */
.twc-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--twc-header-height);
    padding: 0 var(--twc-space-4);
    background: var(--twc-surface);
    border-bottom: 1px solid var(--twc-border);
}

.twc-header-left,
.twc-header-right {
    display: flex;
    align-items: center;
    gap: var(--twc-space-2);
}

.twc-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--twc-text);
    border-radius: var(--twc-radius-sm);
    cursor: pointer;
    transition: background var(--twc-transition);
    font-size: var(--font-size-sub, 1.25rem);
    position: relative;line-height:var(--leading-sub, 1.3);
}

.twc-header-icon:hover { background: var(--twc-surface-hover); }

/* Notification badge dot */
.twc-header-icon[data-badge]::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: var(--twc-radius-full);
    background: var(--twc-error);
    border: 2px solid var(--twc-surface);
}

/* ── Dropdown (desktop) ── */
.twc-dropdown {
    position: absolute;
    top: calc(var(--twc-header-height) - var(--twc-space-2));
    min-width: 240px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--twc-surface);
    border: 1px solid var(--twc-border);
    border-radius: var(--twc-radius);
    box-shadow: var(--twc-shadow-lg);
    padding: var(--twc-space-2) 0;
    display: none;
    z-index: 1001;
}

.twc-dropdown.is-open { display: block; }

.twc-dropdown-left  { left: var(--twc-space-4); }
.twc-dropdown-right { right: var(--twc-space-4); }

.twc-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--twc-space-3);
    padding: var(--twc-space-3) var(--twc-space-4);
    font-size: var(--twc-text-sm);
    color: var(--twc-text);
    text-decoration: none;
    transition: background var(--twc-transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--twc-font);
    min-height: 44px;
}

.twc-dropdown-item:hover { background: var(--twc-surface-hover); }

.twc-dropdown-divider {
    border: none;
    border-top: 1px solid var(--twc-divider);
    margin: var(--twc-space-2) 0;
}

/* ── Bottom Sheet (mobile dropdown replacement) ── */
.twc-bottomsheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    background: var(--twc-surface);
    border-top-left-radius: var(--twc-radius-lg);
    border-top-right-radius: var(--twc-radius-lg);
    box-shadow: var(--twc-shadow-lg);
    padding: var(--twc-space-4) var(--twc-space-4) calc(var(--twc-space-4) + env(safe-area-inset-bottom, 0px));
    max-height: 70vh;
    overflow-y: auto;
}

.twc-bottomsheet.is-open { display: block; }

.twc-bottomsheet-handle {
    width: 36px;
    height: 4px;
    background: var(--twc-border);
    border-radius: var(--twc-radius-full);
    margin: 0 auto var(--twc-space-4);
}

.twc-bottomsheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: var(--twc-overlay);
}

.twc-bottomsheet-overlay.is-open { display: block; }

/* ── Footer: Desktop Left Strip ── */
.twc-footer-strip {
    position: fixed;
    top: var(--twc-header-height);
    left: 0;
    bottom: 0;
    width: 60px;
    display: none; /* hidden on mobile */
    flex-direction: column;
    align-items: center;
    gap: var(--twc-space-4);
    padding: var(--twc-space-6) var(--twc-space-2);
    background: var(--twc-surface);
    border-right: 1px solid var(--twc-border);
    z-index: 900;
}

@media (min-width: 1024px) {
    .twc-footer-strip { display: flex; }

    /* Offset main content when strip is visible */
    .twc-has-footer-strip {
        margin-left: 60px;
    }
}

.twc-footer-strip-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--twc-space-1);
    color: var(--twc-text-secondary);
    font-size: var(--twc-text-xs);
    text-decoration: none;
    padding: var(--twc-space-2);
    border-radius: var(--twc-radius-sm);
    transition: background var(--twc-transition), color var(--twc-transition);
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
}

.twc-footer-strip-icon:hover {
    background: var(--twc-surface-hover);
    color: var(--twc-text);
}

/* ── Footer: Mobile Bottom Bar ── */
.twc-footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--twc-surface);
    border-top: 1px solid var(--twc-border);
    z-index: 900;
}

@media (min-width: 1024px) {
    .twc-footer-bar { display: none; }
}

.twc-footer-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--twc-space-1);
    color: var(--twc-text-secondary);
    font-size: var(--twc-text-xs);
    text-decoration: none;
    padding: var(--twc-space-2);
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
}

.twc-footer-bar-item.is-active { color: var(--twc-accent); }

/* Body padding to prevent content hiding behind fixed chrome */
.twc-app-body {
    padding-top: var(--twc-header-height);
    padding-bottom: 56px; /* mobile footer bar */
}

@media (min-width: 1024px) {
    .twc-app-body {
        padding-bottom: 0; /* no bottom bar on desktop */
    }
}


/* ══════════════════════════════════════════════
   7. DEMO BANNER (repositioned above footer on mobile)
   ══════════════════════════════════════════════ */

.twc-demo-banner {
    position: fixed;
    bottom: 56px; /* sits above mobile footer bar */
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--twc-space-4);
    padding: var(--twc-space-3) var(--twc-space-4);
    background: var(--twc-highlight-light);
    border-top: 1px solid var(--twc-highlight);
    font-size: var(--twc-text-sm);
    color: var(--twc-text-secondary);
}

.twc-demo-banner a {
    font-weight: var(--twc-font-weight-medium);
    color: var(--twc-accent);
}

@media (min-width: 1024px) {
    .twc-demo-banner {
        bottom: 0; /* no footer bar on desktop */
        left: 60px; /* offset for left strip */
    }
}


/* ══════════════════════════════════════════════
   7. UTILITY CLASSES
   ══════════════════════════════════════════════ */

.twc-sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.twc-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twc-noindex { /* Reminder: also add <meta name="robots" content="noindex"> in HTML */ }

/* Inter, the one family of the shared type system (font_best.md): its @font-face lives in type-system.css only */
:root { --blog-accent-fg: var(--twc-text-inverse); }
/**
 * blogs — public blog styles.
 * Loaded after twc_core.css. Tokens only: no raw colors, no gradients,
 * font-weight never above 500, mobile-first.
 */

.blog-body { min-height: 100vh; display: flex; flex-direction: column; }

.blog-skip {
    position: absolute; left: var(--twc-space-4); top: -4rem;
    padding: var(--twc-space-3) var(--twc-space-4);
    background: var(--twc-surface); color: var(--twc-text);
    border: 1px solid var(--twc-border); border-radius: var(--twc-radius-sm);
    z-index: 10;
}
.blog-skip:focus { top: var(--twc-space-4); }

a:focus-visible, .blog-btn:focus-visible, .twc-input:focus-visible {
    outline: 2px solid var(--twc-accent);
    outline-offset: 2px;
}

/* ── Header ── */
.blog-header { border-bottom: 1px solid var(--twc-border); background: var(--twc-bg); }
.blog-header-inner {
    max-width: var(--twc-content-width); margin: 0 auto;
    min-height: var(--twc-header-height);
    padding: var(--twc-space-2) var(--twc-space-4);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--twc-space-2) var(--twc-space-6);
}
.blog-brand { display: inline-flex; align-items: center; gap: var(--twc-space-3); color: var(--twc-text); min-height: 44px; }
.blog-brand:hover { color: var(--twc-text); }
.blog-brand-name { font-size: var(--twc-text-lg); font-weight: var(--weight-medium, 500);line-height:var(--leading-heading, 1.2);letter-spacing:var(--tracking-heading, -0.01em); }
.blog-nav { display: flex; flex-wrap: wrap; gap: var(--twc-space-1) var(--twc-space-4); }
.blog-nav a {
    display: inline-flex; align-items: center; min-height: 44px;
    color: var(--twc-text-secondary); font-size: var(--twc-text-sm);
}
.blog-nav a:hover { color: var(--twc-text); }

/* Site header mode (BLOG_SITE_NAV): the site's links, one filled action. */
.blog-header--site .twc-logo-fallback { display: none; }   /* site headers are wordmarks; no stray letter tile */
.blog-header--site .blog-brand-name { font-size: var(--twc-text-xl, 1.25rem); }
.blog-body .blog-nav--site a:not([class]) { color: var(--twc-text-secondary); text-decoration: none; }
.blog-body .blog-nav--site a:not([class]):hover { color: var(--twc-text); }
.blog-body .blog-nav a[aria-current="page"] { color: var(--twc-text); text-decoration: underline; text-underline-offset: 0.35em; }
.blog-nav-cta {
    padding: 0 var(--twc-space-4); border-radius: 999px;
    background: var(--twc-accent); color: var(--blog-accent-fg) !important; font-weight: var(--weight-medium, 500);
}
.blog-nav-cta:hover { background: var(--twc-accent-hover); }
@media (max-width: 767px) {
    .blog-header--site .blog-header-inner { flex-direction: column; flex-wrap: nowrap; align-items: stretch; min-width: 0; }
    .blog-nav--site { min-width: 0; max-width: 100%; }
    .blog-nav--site { flex-wrap: nowrap; overflow-x: auto; gap: var(--twc-space-4); scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
    .blog-nav--site::-webkit-scrollbar { display: none; }
    .blog-nav--site a { white-space: nowrap; }
}

/* ── Layout ── */
.blog-main { flex: 1; width: 100%; }
.blog-wrap {
    max-width: var(--twc-content-width); margin: 0 auto;
    padding: var(--twc-space-8) var(--twc-space-4) var(--twc-space-12);
}
.blog-count { margin-top: var(--twc-space-2); }

/* ── Search + categories ── */
.blog-search { display: flex; flex-wrap: wrap; gap: var(--twc-space-3); margin: var(--twc-space-6) 0; max-width: var(--twc-narrow-width); }
.blog-search .twc-input { flex: 1 1 14rem; width: auto; }

.blog-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: var(--twc-space-2) var(--twc-space-6);
    font-family: var(--twc-font); font-size: var(--twc-text-base);
    font-weight: var(--weight-medium, 500); line-height: var(--leading-body, 1.55);
    border-radius: var(--twc-radius); cursor: pointer;
    color: var(--twc-text);
}

.blog-cats { display: flex; flex-wrap: wrap; gap: var(--twc-space-2); margin-bottom: var(--twc-space-8); }
.blog-pill {
    display: inline-flex; align-items: center; gap: var(--twc-space-2);
    min-height: 44px; padding: var(--twc-space-1) var(--twc-space-4);
    font-size: var(--twc-text-sm); color: var(--twc-text);
    background: var(--twc-surface); border: 1px solid var(--twc-border);
    border-radius: var(--twc-radius-full);
}
.blog-pill:hover { background: var(--twc-surface-hover); color: var(--twc-text); }
.blog-pill.is-active { background: var(--twc-accent-light); border-color: var(--twc-accent); }
.blog-pill-n { color: var(--twc-text-secondary); font-size: var(--twc-text-xs); }

/* ── List ── */
.blog-list { list-style: none; display: grid; gap: var(--twc-space-6); }
.blog-card { display: grid; gap: var(--twc-space-4); }
.blog-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--twc-radius-sm); }
.blog-card-body { min-width: 0; }
.blog-meta { margin-bottom: var(--twc-space-2); }
.blog-meta a { color: var(--twc-text-secondary); text-decoration: underline; text-underline-offset: 0.2em; }
.blog-title-link { color: var(--twc-text); }
.blog-title-link:hover { color: var(--twc-accent-hover); }
.blog-excerpt { margin-top: var(--twc-space-2); color: var(--twc-text-secondary); max-width: var(--twc-narrow-width); overflow-wrap: anywhere; }
.blog-empty { margin: var(--twc-space-12) 0; color: var(--twc-text-secondary); }

.blog-pager {
    display: flex; align-items: center; justify-content: space-between; gap: var(--twc-space-4);
    margin-top: var(--twc-space-12);
}

/* ── Article ── */
.blog-article { max-width: var(--twc-narrow-width); }
.blog-article .twc-page-title { margin: var(--twc-space-2) 0 var(--twc-space-8); overflow-wrap: anywhere; }
.blog-hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--twc-radius); margin-bottom: var(--twc-space-8); }
.blog-tags { margin-top: var(--twc-space-8); display: flex; flex-wrap: wrap; gap: var(--twc-space-2); }
.blog-back { margin-top: var(--twc-space-12); }

.blog-prose { overflow-wrap: anywhere; }
.blog-prose > * + * { margin-top: var(--twc-space-6); }
.blog-prose h2 { font-size: var(--font-size-heading, 1.5rem); font-weight: var(--twc-font-weight); line-height: var(--leading-heading, 1.2); margin-top: var(--twc-space-12);letter-spacing:var(--tracking-heading, -0.01em); }
.blog-prose h3 { font-size: var(--font-size-sub, 1.25rem); font-weight: var(--twc-font-weight); line-height: var(--leading-sub, 1.3); margin-top: var(--twc-space-8); }
.blog-prose h4 { font-size: var(--font-size-body, 1rem); font-weight: var(--weight-medium, 500); margin-top: var(--twc-space-8); }
.blog-prose strong { font-weight: var(--twc-font-weight-medium); }
.blog-prose em { font-style: normal; font-weight: var(--twc-font-weight-medium); color: var(--twc-text); }
.blog-prose a, .blog-back a { color: var(--twc-text); text-decoration: underline; text-underline-offset: 0.2em; }
.blog-prose a:hover, .blog-back a:hover { text-decoration-thickness: 2px; }
.blog-prose ul, .blog-prose ol { padding-left: var(--twc-space-6); }
.blog-prose li + li { margin-top: var(--twc-space-2); }
.blog-prose blockquote { padding-left: var(--twc-space-6); border-left: 3px solid var(--twc-border); color: var(--twc-text-secondary); }
.blog-prose hr { border: none; border-top: 1px solid var(--twc-border); }
.blog-prose img { border-radius: var(--twc-radius-sm); }
.blog-prose code {
    font-family: var(--twc-font-mono); font-size: 0.9em;
    background: var(--twc-surface-hover); padding: 0.1em 0.35em; border-radius: var(--twc-radius-sm);
}
.blog-prose pre {
    font-family: var(--twc-font-mono); font-size: var(--twc-text-sm);
    background: var(--twc-surface-hover); border: 1px solid var(--twc-border);
    border-radius: var(--twc-radius); padding: var(--twc-space-4); overflow-x: auto;
}
.blog-prose pre code { background: none; padding: 0; }

/* ── Author profiles ── */
.blog-avatar {
    flex: none; display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--twc-radius-full); object-fit: cover;
    background: var(--twc-accent-light); color: var(--twc-text);
    font-weight: var(--twc-font-weight-medium);
}
.blog-avatar-md { width: 56px; height: 56px; font-size: var(--twc-text-xl);line-height:var(--leading-title, 1.1);letter-spacing:var(--tracking-title, -0.015em);font-weight:var(--weight-semibold, 600); }
.blog-avatar-lg { width: 96px; height: 96px; font-size: var(--twc-text-xl);line-height:var(--leading-title, 1.1);letter-spacing:var(--tracking-title, -0.015em);font-weight:var(--weight-semibold, 600); }
.blog-byline-card {
    display: flex; align-items: center; gap: var(--twc-space-4);
    margin-top: var(--twc-space-12); padding: var(--twc-space-4);
    border: 1px solid var(--twc-border); border-radius: var(--twc-radius); background: var(--twc-surface);
}
.blog-authors { list-style: none; display: grid; gap: var(--twc-space-4); margin-top: var(--twc-space-8); }
.blog-author-card { display: flex; align-items: flex-start; gap: var(--twc-space-4); }
.blog-author-text { min-width: 0; }
.blog-profile { display: flex; flex-wrap: wrap; align-items: center; gap: var(--twc-space-6); }
.blog-profile-text { min-width: 0; flex: 1 1 16rem; }
.blog-profile .twc-page-title { overflow-wrap: anywhere; }
.blog-profile a, .blog-author-text a.blog-ext { text-decoration: underline; text-underline-offset: 0.2em; }
.blog-bio { margin-top: var(--twc-space-8); max-width: var(--twc-narrow-width); overflow-wrap: anywhere; }
.blog-synthetic { margin-top: var(--twc-space-2); }
.blog-sites-label { margin-top: var(--twc-space-8); }
ul.blog-cats { list-style: none; margin-top: var(--twc-space-3); padding: 0; }
.blog-posts-heading { margin: var(--twc-space-12) 0 var(--twc-space-6); }
.blog-tags-inline { margin-top: var(--twc-space-3); }
@media (min-width: 768px) { .blog-authors { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Footer ── */
.blog-footer {
    border-top: 1px solid var(--twc-border);
    padding: var(--twc-space-6) var(--twc-space-4);
    text-align: center;
}
.blog-footer a { color: var(--twc-text-secondary); text-decoration: underline; text-underline-offset: 0.2em; }

/* ── Wider screens ── */
@media (min-width: 768px) {
    .blog-wrap { padding: var(--twc-space-12) var(--twc-space-8) var(--twc-space-16); }
    .blog-header-inner { padding: var(--twc-space-2) var(--twc-space-8); }
    .blog-card:has(.blog-cover) { grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); align-items: start; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}

/* ── Owner mode ── */
.blog-ownerbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--twc-space-2) var(--twc-space-6);
    padding: var(--twc-space-2) var(--twc-space-4); font-size: var(--twc-text-sm);
    background: var(--twc-highlight-light, var(--twc-accent-light)); border-bottom: 1px solid var(--twc-border);
}
.blog-ownerbar a, .blog-linkbtn { color: var(--twc-text); text-decoration: underline; text-underline-offset: 0.2em; }
.blog-ownerbar form { margin: 0; }
.blog-linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; min-height: 44px; }
.blog-owner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--twc-space-2); margin: 0 0 var(--twc-space-6); }
.blog-owner-list { list-style: none; display: grid; gap: var(--twc-space-3); margin-top: var(--twc-space-6); }
.blog-owner-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--twc-space-3); }
.blog-owner-main { min-width: 0; flex: 1 1 16rem; }
.blog-owner-row .blog-owner-actions { margin: 0; }
.blog-status { text-transform: capitalize; }
.blog-status-draft, .blog-status-archived { color: var(--twc-text-secondary); font-style: italic; }
.blog-btn-primary { background: var(--twc-accent); color: var(--twc-text); border: 1px solid var(--twc-accent); }
.blog-btn-primary:hover { background: var(--twc-accent-hover); }
.blog-btn-danger { background: var(--twc-surface); color: var(--twc-text); border: 1px solid var(--twc-error, var(--twc-border)); }
.blog-btn-danger:hover { background: var(--twc-error-light, var(--twc-surface-hover)); }
.blog-notice, .blog-error {
    padding: var(--twc-space-3) var(--twc-space-4); border-radius: var(--twc-radius);
    border: 1px solid var(--twc-border); margin: var(--twc-space-4) 0;
}
.blog-notice { background: var(--twc-success-light, var(--twc-surface)); }
.blog-error { background: var(--twc-error-light, var(--twc-surface)); }
.blog-form { display: grid; gap: var(--twc-space-6); margin-top: var(--twc-space-6); }
.blog-field { display: grid; gap: var(--twc-space-2); min-width: 0; border: 0; padding: 0; margin: 0; }
.blog-field > span, .blog-field legend { font-size: var(--twc-text-sm); color: var(--twc-text-secondary); }
.blog-field small { color: var(--twc-text-secondary); }
.blog-field .twc-input { width: 100%; }
.blog-textarea { min-height: 18rem; font-family: var(--twc-font-mono); font-size: var(--twc-text-sm); line-height: var(--leading-body, 1.55); resize: vertical; }
.blog-field-row { display: grid; gap: var(--twc-space-6); }
.blog-check { display: flex; align-items: center; gap: var(--twc-space-3); min-height: 44px; }
.blog-check input { width: 20px; height: 20px; }
.blog-form-cover { width: 100%; max-height: 14rem; object-fit: cover; border-radius: var(--twc-radius-sm); }
.blog-form-actions { display: flex; flex-wrap: wrap; gap: var(--twc-space-3); }
@media (min-width: 768px) { .blog-field-row { grid-template-columns: 1fr 1fr; } }

/* threat: site tokens and header alignment for the shared blog (light theme only) */
:root {
  --threat-blog-bg: #f0f0eb;
  --threat-blog-surface: #fafaf7;
  --threat-blog-surface-hover: #e5e4df;
  --threat-blog-border: #bfbfba;
  --threat-blog-border-input: #666663;
  --threat-blog-text: #191919;
  --threat-blog-text-secondary: #40403e;
  --threat-blog-accent: #8f452c;
  --threat-blog-accent-hover: #7a3a24;
  --threat-blog-cta-hover: #7a140c;
  --threat-blog-accent-light: #f3e5de;

  --twc-bg: var(--threat-blog-bg);
  --twc-surface: var(--threat-blog-surface);
  --twc-surface-hover: var(--threat-blog-surface-hover);
  --twc-border: var(--threat-blog-border);
  --twc-text: var(--threat-blog-text);
  --twc-text-secondary: var(--threat-blog-text-secondary);
  --twc-accent: var(--threat-blog-accent);
  --twc-accent-hover: var(--threat-blog-accent-hover);
  --twc-accent-light: var(--threat-blog-accent-light);
  --twc-link: var(--threat-blog-accent);
}
.blog-body a:not([class]) { color: var(--twc-link); text-decoration: underline; text-underline-offset: 0.15em; }
.blog-header--site .blog-brand::before {
  content: "";
  display: inline-block;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M17.60 6.97L27.80 24.63Q29.40 27.40 26.20 27.40L5.80 27.40Q2.60 27.40 4.20 24.63L14.40 6.97Q16.00 4.20 17.60 6.97Z' fill='none' stroke='%23cc785c' stroke-width='2.8' stroke-linejoin='round'/%3E%3Cpath d='M7.6 19.6h16.8M16 19.6v7.8' fill='none' stroke='%23cc785c' stroke-width='2.6' stroke-linecap='round'/%3E%3Ccircle cx='16' cy='14.5' r='1.9' fill='none' stroke='%23cc785c' stroke-width='1.2'/%3E%3Ccircle cx='16.45' cy='14.5' r='0.8' fill='%23cc785c'/%3E%3C/svg%3E");
}
.blog-header--site .blog-brand-name { font-size: var(--font-size-body, 1rem); }
.blog-nav-cta {
  background: transparent;
  color: var(--twc-text) !important;
  border: 1px solid var(--threat-blog-border-input);
}
.blog-nav-cta:hover {
  background: var(--twc-surface-hover);
  border-color: var(--twc-text);
}

