/* MailManager Static Pages — Swiss Monochrome Design System
 * Mirrors src/index.css, src/components/Navigation.tsx, src/components/Layout.tsx, and src/pages/HowItWorks.tsx.
 */

:root {
  color-scheme: light;
  --bg-app: #fcfcfc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #fafafa;
  --bg-surface-muted: #f3f3f3;

  --text-main: #111111;
  --text-muted: #595959;
  --text-dim: #525252;
  --text-inverted: #ffffff;

  --accent: #111111;
  --accent-text: #ffffff;

  --bg-band: #111111;
  --text-band: #ffffff;

  --border: #ebebeb;
  --border-highlight: #d4d4d4;

  --good: #065f46;
  --bad: #b91c1c;
  --warn: #92400e;
}

html.dark {
  color-scheme: dark;
  --bg-app: #0a0a0a;
  --bg-surface: #141414;
  --bg-surface-alt: #1a1a1a;
  --bg-surface-muted: #1f1f1f;

  --text-main: #f5f5f5;
  --text-muted: #a3a3a3;
  --text-dim: #a3a3a3;
  --text-inverted: #0a0a0a;

  --accent: #ffffff;
  --accent-text: #0a0a0a;

  --bg-band: #000000;
  --text-band: #f5f5f5;

  --border: #262626;
  --border-highlight: #3a3a3a;

  --good: #6ee7b7;
  --bad: #f87171;
  --warn: #fcd34d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

a {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: var(--border-highlight);
  text-underline-offset: 4px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  text-decoration-color: var(--text-main);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Top Navigation (mirrors src/components/Navigation.tsx) ──────────────── */

.site-nav {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(229, 229, 229, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

html.dark .site-nav {
  background: rgba(23, 23, 23, 0.95);
  border-bottom-color: rgba(64, 64, 64, 0.65);
}

.site-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 16px;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px;
  margin-left: -8px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  border-radius: 6px;
}

.site-brand:hover {
  text-decoration: none;
  opacity: 0.85;
}

.site-brand svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.site-nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

.site-nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav-links a:hover,
.site-nav-links a[aria-current='page'] {
  color: var(--text-main);
}

.site-nav-links a[aria-current='page'] {
  font-weight: 600;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-highlight);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  background: var(--bg-surface-muted);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .icon-moon {
  display: none;
}

html.dark .theme-toggle .icon-sun {
  display: none;
}

html.dark .theme-toggle .icon-moon {
  display: block;
}

/* ── Main Content Container ──────────────────────────────────────────────── */

.wrap {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 44px 24px 80px;
  flex: 1 0 auto;
}

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 20px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--text-main);
  text-decoration: underline;
}

h1 {
  font-size: clamp(30px, 4.5vw, 44px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  color: var(--text-main);
}

h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 48px 0 16px;
  color: var(--text-main);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 28px 0 10px;
  color: var(--text-main);
}

p {
  margin: 0 0 16px;
}

.lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 28px;
}

.muted,
.sources,
.cite {
  font-size: 14px;
  color: var(--text-muted);
}

.cite {
  margin-top: -8px;
  margin-bottom: 18px;
}

.src {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-surface-muted);
  color: var(--text-main);
}

ul,
ol {
  padding-left: 22px;
  margin: 0 0 18px;
}

li {
  margin: 7px 0;
}

blockquote {
  margin: 20px 0;
  padding: 14px 20px;
  background: var(--bg-surface-alt);
  border-left: 3px solid var(--border-highlight);
  color: var(--text-main);
  font-style: italic;
}

/* ── Answer Blocks, Callouts & Steps ─────────────────────────────────────── */

.answer,
.callout {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 20px 24px;
  margin: 24px 0 28px;
}

.answer > p:last-child,
.callout > p:last-child {
  margin-bottom: 0;
}

.step {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 22px 24px;
  margin: 16px 0;
}

.step .label {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.step h3 {
  margin: 0 0 8px;
}

.step p:last-child {
  margin-bottom: 0;
}

/* ── Primary Swiss CTA Button (mirrors HowItWorks.tsx) ───────────────────── */

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  background: var(--accent);
  color: var(--accent-text);
  padding: 12px 24px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  margin: 8px 8px 4px 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cta:hover {
  opacity: 0.88;
  text-decoration: none;
}

/* ── Visual Figures (Dark-Mode Native Swiss Diagrams) ────────────────────── */

.visual {
  margin: 28px 0 32px;
  padding: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.visual img {
  display: block;
  width: 100%;
  height: auto;
  transition: filter 0.25s ease;
}

/* Pure monochrome Swiss SVG diagrams invert cleanly into MailManager's exact #141414 dark surface palette */
html.dark .visual img {
  filter: invert(0.922);
}

.visual-video video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
}

.visual figcaption {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Semantic Tables ─────────────────────────────────────────────────────── */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0 28px;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.table-wrap table {
  margin: 0;
  border: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: 14.5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--bg-surface-alt);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-main);
}

tbody th {
  font-weight: 600;
  color: var(--text-main);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: none;
}

.good {
  color: var(--good);
  font-weight: 600;
}

.bad {
  color: var(--bad);
  font-weight: 600;
}

/* ── Hub Cards ───────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 16px 0 28px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 22px 24px;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: var(--border-highlight);
}

.card h3 {
  margin: 0 0 8px;
}

.card p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 15px;
}

.card a.title-link {
  color: var(--text-main);
  text-decoration: none;
}

.card a.title-link:hover {
  text-decoration: underline;
  text-decoration-color: var(--text-main);
}

.tag {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

/* ── Interactive Tool Styles (Gmail Filter Builder) ──────────────────────── */

fieldset.rule {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 22px 24px;
  margin: 16px 0;
  min-width: 0;
}

fieldset.rule legend {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 8px;
}

.group-title {
  font-weight: 600;
  margin: 4px 0 10px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-main);
}

input[type='text'] {
  font: inherit;
  font-size: 15px;
  font-weight: 400;
  padding: 9px 12px;
  border: 1px solid var(--border-highlight);
  background: var(--bg-app);
  color: var(--text-main);
  width: 100%;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin: 14px 0 0;
}

.checks label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  cursor: pointer;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0 0;
}

.out {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border-highlight);
}

.query {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  padding: 12px 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  margin: 6px 0 10px;
}

.msg {
  font-size: 14px;
  color: var(--warn);
  margin: 6px 0 0;
}

.msg:empty {
  display: none;
}

main button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  min-height: 44px;
  cursor: pointer;
  border: 1px solid var(--border-highlight);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

main button:hover {
  background: var(--bg-surface-muted);
  border-color: var(--text-main);
}

main button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  padding: 12px 24px;
}

main button.primary:hover {
  opacity: 0.88;
  background: var(--accent);
  border-color: var(--accent);
}

main button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 18px 0;
}

details {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 12px 16px;
}

details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

details pre {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  padding: 12px;
  margin: 12px 0 0;
  overflow: auto;
  max-height: 360px;
}

.status {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── 4-Column Swiss Footer (mirrors src/components/Layout.tsx) ───────────── */

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 48px 0;
  margin-top: auto;
}

.site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.footer-brand-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 12px;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 12px;
}

.footer-disambiguation {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

.footer-heading {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.footer-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-list li {
  margin: 0;
}

.footer-list a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
}

.footer-list a:hover {
  color: var(--text-main);
  text-decoration: none;
}

.footer-bottom {
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
}

.footer-legal a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
}

.footer-legal a:hover {
  color: var(--text-main);
  text-decoration: none;
}

.footer-legal svg {
  width: 16px;
  height: 16px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .wrap {
    padding: 32px 16px 64px;
  }

  .site-nav-links {
    gap: 2px 10px;
  }

  .site-nav-links a {
    font-size: 13.5px;
    padding: 0 6px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  table {
    font-size: 13px;
  }

  th,
  td {
    padding: 9px 8px;
  }

  fieldset.rule {
    padding: 16px;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}
