/* ============================================================
   MailCull site chrome — shared public header + footer
   v1.0 — 2026-06-10

   One header, one footer, every public page:
   /, /tools/*, /pricing, /blog(+posts), /help, /contact,
   /privacy-policy, /terms-of-service.
   NOT for: /dashboard, /jobs, /account, /single-check, /admin*,
   /login, /register, OAuth/API system pages.

   In production this is injected server-side: pages carry the
   `<!--site:header-->` / `<!--site:footer-->` markers and
   src/views/siteChrome.js renders the .mc-header (with the drawer) and
   .mc-footer into them, alongside this stylesheet + site-chrome.js
   (dropdown keyboard support, drawer, scrolled border, body scroll lock).

   The kit's `@container` rules were converted to `@media` here because the
   chrome spans the full viewport on a real page, so NO `.mc-viewport`
   wrapper is needed. Auth-aware: the server sets data-auth="in" on
   .mc-header to collapse the right side to a single Dashboard button
   (default is logged out). Tokens only, no new colors, fonts, or radii.

   Every var() carries a literal fallback (the design-system.css base
   values) because the chrome is injected into pages that may NOT load
   design-system.css — the landing page defines its own aliased tokens
   (--r-card, not --radius-card), so without fallbacks the header and
   dropdown lose radius/shadow there. Keep fallbacks in sync if the
   design-system base values ever change.
   ============================================================ */

/* Skip link — first focusable element on every page */
.mc-skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--ink, #111111);
  color: #ffffff;
  border-radius: var(--radius-btn, 4px);
  font-size: 14px;
  transition: top 0.12s ease;
}
.mc-skip:focus-visible {
  top: 12px;
}

/* ── Focus (per ACCESSIBILITY.md) ─────────────────────────── */
.mc-header a:focus-visible,
.mc-header button:focus-visible,
.mc-footer a:focus-visible,
.mc-skip:focus-visible {
  outline: 2px solid rgba(255, 86, 0, 0.35);
  outline-offset: 2px;
}

/* ============================================================
   HEADER
   ============================================================ */
.mc-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg, #faf9f6);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.mc-header.is-scrolled {
  border-bottom-color: var(--line, #dedbd6);
}

.mc-header-inner {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

/* ── Brand lockup (canonical) ─────────────────────────────── */
.mc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.mc-brand-badge {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-nav, 6px);
  background: var(--ink, #111111);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
  flex-shrink: 0;
}
.mc-brand-badge::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 3px;
  height: 3px;
  background: var(--accent, #ff5600);
  border-radius: 1px;
}
.mc-brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink, #111111);
}

/* ── Primary nav ──────────────────────────────────────────── */
.mc-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mc-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: var(--radius-nav, 6px);
  font-size: 14px;
  color: var(--muted, #7b7b78);
  transition: background 0.12s ease, color 0.12s ease;
}
.mc-nav-link:hover,
.mc-nav-link[aria-expanded="true"] {
  background: var(--surface, #f5f3ef);
  color: var(--ink, #111111);
}
.mc-nav-link[aria-current="page"] {
  color: var(--ink, #111111);
  font-weight: 500;
}

/* The Tools trigger is a <button>; neutralize the global button
   styles from design-system.css so it sits in the nav like a link. */
button.mc-nav-link {
  min-height: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  border-radius: var(--radius-nav, 6px) !important;
  font-weight: 400 !important;
  font-family: inherit;
  cursor: pointer;
}
button.mc-nav-link:hover,
button.mc-nav-link:active {
  transform: none;
}
button.mc-nav-link:hover {
  background: var(--surface, #f5f3ef);
  color: var(--ink, #111111);
}
.mc-caret {
  display: block;
  transition: transform 0.12s ease;
}
.mc-nav-link[aria-expanded="true"] .mc-caret {
  transform: rotate(180deg);
}

/* ── Tools dropdown (disclosure nav pattern) ──────────────── */
.mc-tools {
  position: relative;
}
.mc-tools-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 560px;
  background: var(--panel, #ffffff);
  border: 1px solid var(--line, #dedbd6);
  border-radius: var(--radius-card, 8px);
  box-shadow: var(--shadow-modal, 0 4px 24px rgba(0, 0, 0, 0.10));
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.mc-tools.is-open .mc-tools-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .mc-tools-menu,
  .mc-caret,
  .mc-skip,
  .mc-drawer {
    transition: none;
  }
}

.mc-tools-cols {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 8px;
  padding: 16px;
}
/* The Features dropdown: a single narrow column (no group label, no footer).
   Overrides the 560px two-column Tools width — four short items don't need it. */
.mc-tools-menu.mc-menu-narrow { width: 340px; min-width: 0; }
.mc-menu-narrow .mc-tools-cols { grid-template-columns: 1fr; }
.mc-tools-group-label {
  margin: 0 0 6px;
  padding: 0 10px;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #7b7b78);
}
.mc-tools-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}
.mc-tools-item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-nav, 6px);
  transition: background 0.12s ease;
}
.mc-tools-item:hover {
  background: var(--surface, #f5f3ef);
}
.mc-tools-item .name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink, #111111);
  line-height: 1.3;
}
.mc-tools-item .hint {
  display: block;
  font-size: 12.5px;
  color: var(--muted, #7b7b78);
  line-height: 1.35;
  margin-top: 1px;
}
.mc-tools-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 26px;
  border-top: 1px solid var(--line, #dedbd6);
  background: var(--panel-strong, #fdfcfa);
  border-radius: 0 0 var(--radius-card, 8px) var(--radius-card, 8px);
}
.mc-tools-foot .note {
  font-size: 13px;
  color: var(--muted, #7b7b78);
}
.mc-tools-foot .all {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink, #111111);
  padding: 4px 8px;
  margin-right: -8px;
  border-radius: var(--radius-nav, 6px);
}
.mc-tools-foot .all:hover {
  background: var(--surface, #f5f3ef);
  color: var(--accent-dark, #cc4400);
}

/* ── Right side: auth-aware actions ───────────────────────── */
.mc-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.mc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn, 4px);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.mc-btn-accent {
  background: var(--accent, #ff5600);
  color: #ffffff;
}
.mc-btn-accent:hover {
  background: var(--accent-dark, #cc4400);
  color: #ffffff;
}
.mc-btn-ink {
  background: var(--ink, #111111);
  color: #ffffff;
}
.mc-btn-ink:hover {
  background: #2a2a28;
  color: #ffffff;
}

/* Logged out (default) shows .mc-auth-out; data-auth="in" swaps. */
.mc-header .mc-auth-in,
.mc-drawer .mc-auth-in {
  display: none;
}
.mc-header[data-auth="in"] .mc-auth-in,
.mc-header[data-auth="in"] ~ .mc-drawer .mc-auth-in,
.mc-drawer[data-auth="in"] .mc-auth-in {
  display: inline-flex;
}
.mc-header[data-auth="in"] .mc-auth-out,
.mc-header[data-auth="in"] ~ .mc-drawer .mc-auth-out,
.mc-drawer[data-auth="in"] .mc-auth-out {
  display: none;
}

/* ── Mobile menu button ───────────────────────────────────── */
.mc-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  border-radius: var(--radius-nav, 6px) !important;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.mc-menu-btn:hover,
.mc-menu-btn:active {
  transform: none;
  background: var(--surface, #f5f3ef);
}
.mc-menu-btn .bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink, #111111);
  border-radius: 1px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.mc-menu-btn[aria-expanded="true"] .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mc-menu-btn[aria-expanded="true"] .bar:nth-child(2) {
  opacity: 0;
}
.mc-menu-btn[aria-expanded="true"] .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Mobile drawer ────────────────────────────────────────── */
.mc-drawer {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 39;
  display: none;
  flex-direction: column;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  background: var(--bg, #faf9f6);
  border-top: 1px solid var(--line, #dedbd6);
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.mc-drawer.is-open {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
.mc-drawer-nav {
  display: grid;
  gap: 2px;
  padding: 12px 16px;
}
.mc-drawer-link {
  display: block;
  padding: 12px 10px;
  border-radius: var(--radius-nav, 6px);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink, #111111);
}
.mc-drawer-link:hover {
  background: var(--surface, #f5f3ef);
}
.mc-drawer-tools {
  padding: 8px 16px 16px;
  border-top: 1px solid var(--line, #dedbd6);
  display: grid;
  gap: 16px;
}
.mc-drawer-tools .mc-tools-group-label {
  padding: 0 10px;
  margin: 12px 0 4px;
}
.mc-drawer-tools .mc-tools-group ul {
  gap: 0;
}
.mc-drawer-tools .mc-tools-item {
  padding: 10px;
}
.mc-drawer-cta {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--bg, #faf9f6);
  border-top: 1px solid var(--line, #dedbd6);
}
.mc-drawer-cta .mc-btn {
  width: 100%;
  min-height: 48px;
  font-size: 15px;
}
.mc-drawer-cta .signin {
  text-align: center;
  padding: 10px;
  font-size: 14.5px;
  color: var(--muted, #7b7b78);
  border-radius: var(--radius-nav, 6px);
}
.mc-drawer-cta .signin:hover {
  color: var(--ink, #111111);
  background: var(--surface, #f5f3ef);
}
body.mc-no-scroll {
  overflow: hidden;
}

/* ── Responsive: collapse to mobile bar ───────────────────── */
@media (max-width: 860px) {
  .mc-header-inner {
    min-height: 56px;
    width: calc(100% - 32px);
  }
  .mc-nav,
  .mc-header-actions {
    display: none;
  }
  .mc-menu-btn {
    display: flex;
    margin-left: auto;
  }
  .mc-drawer {
    height: calc(100vh - 57px);
    height: calc(100dvh - 57px);
  }
}

/* ============================================================
   FOOTER
   ============================================================ */
.mc-footer {
  margin-top: 64px;
  background: var(--panel-strong, #fdfcfa);
  border-top: 1px solid var(--line, #dedbd6);
}
.mc-footer-inner {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
}
.mc-footer-head {
  margin: 0 0 14px;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #7b7b78);
}
.mc-footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.mc-footer-link {
  font-size: 14px;
  color: var(--ink, #111111);
  font-weight: 400;
}
.mc-footer-link:hover {
  color: var(--accent-dark, #cc4400);
}

.mc-footer-bottom {
  width: min(1220px, calc(100% - 32px));
  margin: 40px auto 0;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line, #dedbd6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.mc-footer-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mc-footer-lockup .mc-brand-badge {
  width: 24px;
  height: 24px;
  font-size: 10px;
  border-radius: var(--radius-btn, 4px);
}
.mc-footer-lockup .mc-brand-badge::after {
  top: 3px;
  right: 3px;
}
.mc-footer-descriptor {
  font-size: 13.5px;
  color: var(--muted, #7b7b78);
}
.mc-footer-legal-line {
  font-size: 13px;
  color: var(--muted, #7b7b78);
}

@media (max-width: 720px) {
  .mc-footer-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 24px;
    padding-top: 36px;
  }
  .mc-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-top: 32px;
  }
}
