/* ==========================================================================
   FunnelStory pitch deck. base styles and components
   Depends on tokens.css.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out);
}

/* The theme switch sets this class for one frame to stop a flash of motion. */
body.theme-switching, body.theme-switching * { transition: none !important; }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-display);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--ink);
  font-weight: var(--weight-semibold);
  text-wrap: balance;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); letter-spacing: -0.01em; }

p { margin: 0; text-wrap: pretty; }

a {
  color: var(--primary);
  text-decoration-color: color-mix(in srgb, var(--primary) 40%, transparent);
  text-underline-offset: 3px;
}
a:hover { color: var(--primary-hover); }

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

code, pre { font-family: var(--font-mono); font-size: 0.8125em; }

img, svg, video { max-width: 100%; height: auto; display: block; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-7) 0;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* --------------------------------------------------------------------------
   Type helpers
   -------------------------------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-size: var(--text-display);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--ink);
  font-weight: var(--weight-semibold);
}

.lead {
  font-size: var(--text-lead);
  color: var(--text-muted);
  line-height: var(--leading-body);
  max-width: 62ch;
}

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--primary);
}

.small { font-size: var(--text-small); }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }

.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.metric {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: var(--tracking-display);
  color: var(--ink);
  font-weight: var(--weight-bold);
}

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}
.card:hover { border-color: var(--primary-border); box-shadow: var(--shadow-md); }

.card-flush { padding: 0; overflow: hidden; }

.panel {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.panel-brand {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.slide {
  min-height: var(--slide-min-height);
  display: grid;
  align-content: center;
  padding-block: var(--space-9);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.375rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: var(--primary-on); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-on); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }

.btn-gradient {
  background: var(--gradient-brand);
  color: #ffffff;
  border: 0;
}
.btn-gradient:hover { filter: brightness(1.06); }

/* --------------------------------------------------------------------------
   Badges and chips
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.02em;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}
.badge-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-warm { background: var(--accent-warm-soft); color: var(--accent-warm); border-color: transparent; }
.badge-neutral { background: var(--bg-inset); color: var(--text-muted); border-color: var(--border); }

/* --------------------------------------------------------------------------
   Theme switch
   -------------------------------------------------------------------------- */

.theme-toggle {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-overlay);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.theme-toggle button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--primary);
  color: var(--primary-on);
}
.theme-toggle svg { width: 14px; height: 14px; }

/* --------------------------------------------------------------------------
   Style-guide only helpers
   -------------------------------------------------------------------------- */

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }

.swatch {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}
.swatch .chip { height: 64px; }
.swatch .meta { padding: var(--space-3); border-top: 1px solid var(--border); }
.swatch .name { font-size: var(--text-micro); font-weight: var(--weight-semibold); color: var(--ink); }
.swatch .value { font-family: var(--font-mono); font-size: var(--text-micro); color: var(--text-muted); }

.section { padding-block: var(--space-8); border-top: 1px solid var(--border); }
.section:first-of-type { border-top: 0; }
.section-head { margin-bottom: var(--space-6); }

.row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

.spec-table { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.spec-table th, .spec-table td {
  text-align: left;
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.spec-table th { color: var(--text-muted); font-weight: var(--weight-semibold); font-size: var(--text-micro); text-transform: uppercase; letter-spacing: 0.06em; }
.spec-table td code { color: var(--primary); }
.table-scroll { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ============================================================
   Disclosure (collapsible section)
   ============================================================ */
.disclosure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  cursor: pointer;
  list-style: none;
  transition: background var(--duration-fast) var(--ease-out);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--bg-inset); }
.disclosure > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.disclosure-marker {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  transition: transform var(--duration-base) var(--ease-out);
}
.disclosure-marker svg { width: 16px; height: 16px; }
.disclosure[open] > summary .disclosure-marker { transform: rotate(90deg); }

.disclosure-title { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.disclosure-heading {
  font-family: var(--font-display);
  font-size: var(--text-h4);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  letter-spacing: var(--tracking-display);
}
.disclosure-hint { margin-left: auto; flex: none; }

.disclosure-body { padding: 0 var(--space-5) var(--space-5); border-top: 1px solid var(--border); padding-top: var(--space-5); }
.disclosure-list { margin-top: var(--space-3); padding-left: 1.1rem; line-height: 1.7; }
.disclosure-list > li + li { margin-top: var(--space-2); }

@media (max-width: 560px) {
  .disclosure-hint { display: none; }
}

/* ============================================================
   Job description block
   ============================================================ */
.jd { margin: 0; }
.jd > h4 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  color: var(--ink);
}
.jd > h4:first-child { margin-top: 0; }
.jd > p { max-width: 72ch; }
.jd > p + p { margin-top: var(--space-3); }
.jd > ul { max-width: 72ch; padding-left: 1.1rem; line-height: 1.7; }
.jd > ul > li + li { margin-top: var(--space-2); }
