/* ==========================================================================
   chrome.css: the cooking kit's header, footer and theme switcher, for TOOL
   pages only.

   Tool pages load the studio's tokens.css, components.css and tools.css
   (from /css/studio/) for the tool itself. The kit's full base.css and
   components.css are NOT loaded there, because both define .btn, .num,
   .card, .table, .input, .label and more, and would restyle the tool.
   Instead, this file carries only the kit rules the header, footer, skip
   link and theme switcher need, copied from jjk-theme-kit v2.1 with every
   selector scoped to .site-header, .site-footer or .skip-link. The last
   section undoes studio element and class rules that would otherwise reach
   into the header and footer.

   Content pages (home, videos, cookbook, blog, privacy, 404) load the kit's
   own base.css and components.css instead of this file.

   Load order on a tool page:
     fonts/fonts.css, css/studio/tokens.css, css/studio/components.css,
     css/studio/tools.css, the tool's styles.css, css/tokens.css (kit),
     css/chrome.css, css/tool-bridge.css
   ========================================================================== */

/* ---------- page ground (kit base.css) ---------- */
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--text-base)/var(--leading-body) var(--font-sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-theme) var(--ease-out), color var(--dur-theme) var(--ease-out);
}
::selection { background: var(--selection); color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

/* ---------- kit base.css, scoped ---------- */
:is(.site-header, .site-footer) a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: .18em; }
:is(.site-header, .site-footer) :is(button, input, select, textarea) { font: inherit; color: inherit; }
:is(.site-header, .site-footer) a:hover { color: var(--primary-hover); }
/* kit v2.4 (base.css): in cast iron, links keep --primary on hover and the underline thickens */
:where([data-theme="cast-iron"]) :is(.site-header, .site-footer) a:hover { color: var(--primary); text-decoration-thickness: 2px; }
:is(.site-header, .site-footer) h2 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  margin: 0;
  text-wrap: balance;
  font-size: var(--text-2xl);
}
.site-footer .tagline {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  color: var(--text-muted);
  margin: 0;
}
:is(.site-header, .site-footer) .mark {
  font: 700 1em/1 var(--font-display);
  color: var(--mark);
  letter-spacing: -.02em;
  display: inline-flex; align-items: baseline;
}
:is(.site-header, .site-footer) .mark .amp {
  font-style: italic; font-weight: 500;
  font-size: .69em; color: var(--mark-amp);
  margin: 0 .06em;
}
.site-footer .divider {
  display: flex; align-items: center; justify-content: center; gap: var(--space-5);
  color: var(--accent);
  margin: 0;
}
.site-footer .divider::before, .site-footer .divider::after {
  content: ""; width: clamp(60px, 8vw, 120px); height: 2px; background: currentColor;
}
.site-footer .divider > .diamond, .site-footer .diamond {
  width: 10px; height: 10px; transform: rotate(45deg); background: currentColor; flex: none;
}
.site-footer .divider--inline { gap: var(--space-4); }
.site-footer .divider--inline::before, .site-footer .divider--inline::after { width: 56px; }
:is(.site-header, .site-footer) .container { width: min(100% - 2rem, var(--container)); margin-inline: auto; }
.site-footer .wordmark {
  font: 600 var(--text-xs)/1 var(--font-sans);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: var(--tracking-eyebrow);
  text-align: center;
}
.site-footer .tabular { font-variant-numeric: var(--numeric-features); }

/* theme switcher */
.site-header .theme-switch {
  display: inline-flex; gap: 4px; padding: 3px;
  border: 1px solid var(--text); border-radius: var(--radius-pill);
  background: transparent;
}
.site-header .theme-switch button {
  appearance: none; border: 0; cursor: pointer;
  padding: 7px 12px; border-radius: var(--radius-pill);
  background: transparent; color: var(--text);
  font: 600 var(--text-xs)/1 var(--font-sans); letter-spacing: .04em; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.site-header .theme-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.site-header .theme-switch .swatch {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.25);
  background: var(--swatch);
}
.site-header .theme-switch [data-theme-set="cream"]     .swatch { --swatch: var(--swatch-cream); }
.site-header .theme-switch [data-theme-set="mint"]      .swatch { --swatch: var(--swatch-mint); }
.site-header .theme-switch [data-theme-set="rust"]      .swatch { --swatch: var(--swatch-rust); }
.site-header .theme-switch [data-theme-set="cast-iron"] .swatch { --swatch: var(--swatch-cast-iron); }
@media (max-width: 640px) {
  .site-header .theme-switch--compact button span.label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

/* ---------- kit components.css, scoped ---------- */
.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 100; padding: .6em 1em; background: var(--primary); color: var(--text-on-primary); border-radius: var(--radius-pill); font: 600 var(--text-sm)/1 var(--font-sans); }
.skip-link:focus { top: var(--space-4); }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
  transition: background-color var(--dur-theme) var(--ease-out);
}
.site-header__inner {
  display: flex; align-items: center; gap: var(--space-4);
  min-height: 4.25rem;
}
.site-header .mark { font-size: 1.9rem; text-decoration: none; }
.site-header .brand { display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--text); }
/* the scoped a:hover above outranks .site-header .brand, which it does not in the kit: the brand keeps its colour on hover, as on content pages */
.site-header .brand:hover { color: var(--text); text-decoration: none; }
.site-header .brand__name { font: 600 var(--text-sm)/1.1 var(--font-sans); letter-spacing: .08em; text-transform: uppercase; }
.site-header .site-nav { margin-left: auto; display: flex; align-items: center; gap: var(--space-6); }
.site-header .site-nav__list { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-5); }
.site-header .site-nav__list a {
  display: inline-block; padding: .5em .1em;
  color: var(--text); text-decoration: none;
  font: 600 var(--text-sm)/1 var(--font-sans); letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.site-header .site-nav__list a:hover { color: var(--primary); }
.site-header .site-nav__list a[aria-current="page"] { border-bottom-color: var(--primary); color: var(--primary); }
.site-header .nav-toggle {
  display: none; margin-left: auto;
  width: 2.75rem; height: 2.75rem; border-radius: var(--radius-pill);
  border: 1px solid var(--text); background: transparent; color: var(--text); cursor: pointer;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px;
}
.site-header .nav-toggle span { display: block; width: 18px; height: 2px; background: currentColor; transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out); }
.site-header[data-nav-open] .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-header[data-nav-open] .nav-toggle span:nth-child(2) { opacity: 0; }
.site-header[data-nav-open] .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 899px) {
  .site-header .nav-toggle { display: inline-flex; }
  .site-header .site-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: var(--space-5);
    padding: var(--space-5) var(--space-4) var(--space-6);
    background: var(--bg);
    border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow-card);
    max-height: calc(100dvh - 4.25rem); overflow-y: auto;
  }
  .site-header[data-nav-open] .site-nav { display: flex; }
  .site-header .site-nav__list { flex-direction: column; gap: 0; }
  .site-header .site-nav__list a { display: block; padding: .9em 0; border-bottom: 1px solid var(--hairline); font-size: var(--text-base); }
  .site-header .site-nav__list li:last-child a { border-bottom: 0; }
  .site-header .site-nav .theme-switch { align-self: flex-start; }
  .site-header .brand__name { display: none; }
}

.site-footer {
  margin-top: clamp(3rem, 8vw, 6rem);
  border-top: 1px solid var(--hairline);
  padding: clamp(2.5rem, 6vw, 4rem) 0 var(--space-10);
  color: var(--text-muted);
  font: 400 var(--text-sm)/1.6 var(--font-sans);
}
.site-footer__grid {
  display: grid; gap: var(--space-8);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}
.site-footer__brand { display: grid; gap: var(--space-4); align-content: start; }
.site-footer__brand .mark { font-size: 2.4rem; }
.site-footer h2 {
  font: 700 var(--text-xs)/1 var(--font-sans); letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase; color: var(--text); margin: 0 0 var(--space-4);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }
.site-footer address { font-style: normal; }
.site-footer__legal {
  margin-top: var(--space-10); padding-top: var(--space-6);
  border-top: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); align-items: center; justify-content: space-between;
}
.site-footer__legal ul { display: flex; flex-wrap: wrap; gap: var(--space-4); }

@media (prefers-reduced-motion: reduce) {
  .site-header .nav-toggle span { transition: none; }
}

/* ---------- undo studio rules that reach into the header and footer ---------- */
/* studio components.css: a { font-weight: 500; text-decoration: none }, p { margin; max-width; color },
   h1-h4 { text-wrap, weight }, .wordmark { inline-flex; ::before square }, .label { block; margin; colour } */
:is(.site-header, .site-footer) a { font-weight: inherit; }
a.skip-link { text-decoration-line: underline; }
:is(.site-header, .site-footer) p { max-width: none; }
.site-footer .wordmark { display: block; gap: normal; white-space: normal; }
.site-footer .wordmark::before { content: none; }
.site-header .theme-switch .label { display: inline; margin: 0; font: inherit; color: inherit; }

/* the studio brands line under the legal row (not in the kit) */
.site-footer__brands { margin: var(--space-4) 0 0; font-size: var(--text-xs); line-height: 1.5; color: var(--text-muted); }
