/* ==========================================================================
   Field guide — shared design system for the shorter Automation Arsenal
   case studies (Postman, Kane AI, Browser Use). Each page sets --accent.
   ========================================================================== */

:root {
  --accent: #38bdf8;
  --accent-2: #a78bfa;
  --bg: #070b14;
  --bg-2: #0b1120;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f1f5f9;
  --ink-soft: #cbd5e1;
  --muted: #8b98ad;
  --ok: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --display: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---------- Backdrop ---------- */

.fg-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.fg-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 20%, transparent 75%);
}

.fg-orb {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.28;
  animation: fg-drift 22s var(--ease) infinite alternate;
}

.fg-orb--a {
  top: -260px;
  right: -120px;
  background: var(--accent);
}

.fg-orb--b {
  top: 520px;
  left: -300px;
  background: var(--accent-2);
  opacity: 0.14;
  animation-delay: -8s;
}

@keyframes fg-drift {
  to {
    transform: translate3d(-70px, 60px, 0) scale(1.1);
  }
}

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

.fg-wrap {
  width: min(1120px, 100% - 32px);
  margin: 0 auto;
}

.fg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0;
}

.fg-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.fg-back:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}

.fg-top-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.fg-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.fg-pill--accent {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--ink);
}

.fg-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* ---------- Hero ---------- */

.fg-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding: clamp(28px, 6vw, 72px) 0 clamp(40px, 6vw, 72px);
}

.fg-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.fg-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.fg-hero h1 {
  margin: 18px 0 18px;
  font-size: clamp(40px, 6.4vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 700;
}

.fg-hero h1 span {
  display: block;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.fg-lede {
  max-width: 560px;
  margin: 0;
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--ink-soft);
}

.fg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.fg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 15px/1 var(--display);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease;
}

.fg-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.fg-btn--primary {
  border-color: transparent;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 14px 34px -14px var(--accent);
}

.fg-btn--primary:hover {
  box-shadow: 0 18px 44px -12px var(--accent);
}

.fg-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.fg-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.fg-fact {
  padding: 18px 20px;
}

.fg-fact:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.fg-fact:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.fg-fact dt {
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.fg-fact dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.fg-logo {
  display: block;
  width: 84px;
  height: 84px;
  margin-bottom: 20px;
  border-radius: 22px;
  box-shadow: 0 20px 50px -18px var(--accent), 0 0 0 1px var(--line-strong);
}

/* ---------- Sections ---------- */

.fg-section {
  padding: clamp(48px, 7vw, 88px) 0 0;
}

.fg-section-head {
  max-width: 680px;
  margin-bottom: clamp(24px, 4vw, 40px);
}

.fg-section-head h2 {
  margin: 14px 0 10px;
  font-size: clamp(28px, 3.6vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.fg-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

[data-reveal].in {
  opacity: 1;
  transform: none;
}

/* ---------- How it works ---------- */

.fg-steps {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  counter-reset: step;
}

.fg-steps::before {
  content: "";
  position: absolute;
  top: 34px;
  left: 8%;
  right: 8%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.35;
}

.fg-step {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  transition: border-color 0.3s ease, transform 0.3s var(--ease);
}

.fg-step:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  transform: translateY(-4px);
}

.fg-step-num {
  position: relative;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font: 700 12px/1 var(--mono);
}

.fg-step h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.fg-step p {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
}

.fg-step code {
  font-family: var(--mono);
  font-size: 0.88em;
  color: var(--ink-soft);
}

/* ---------- Demo shell ---------- */

.fg-demo {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 8%, var(--bg-2)), var(--bg-2) 45%);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.fg-demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.fg-demo-bar strong {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 13px/1 var(--mono);
  color: var(--ink-soft);
}

.fg-demo-bar strong::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
}

.fg-sim {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fg-demo-body {
  padding: clamp(16px, 3vw, 28px);
}

/* ---------- Code ---------- */

.fg-code {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050810;
  overflow: hidden;
}

.fg-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.fg-tab {
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 500 13px/1 var(--mono);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.fg-tab:hover {
  color: var(--ink);
}

.fg-tab[aria-selected="true"] {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.fg-copy {
  margin-left: auto;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font: 500 12px/1 var(--mono);
  cursor: pointer;
  white-space: nowrap;
}

.fg-copy:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.fg-panel[hidden] {
  display: none;
}

.fg-panel pre {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  font: 400 13.5px/1.75 var(--mono);
  color: #e2e8f0;
  tab-size: 2;
}

.fg-panel figcaption {
  padding: 0 24px 18px;
  font-size: 13.5px;
  color: var(--muted);
}

.tk-c {
  color: #64748b;
  font-style: italic;
}
.tk-s {
  color: #86efac;
}
.tk-k {
  color: #c4b5fd;
}
.tk-n {
  color: #fdba74;
}
.tk-f {
  color: #7dd3fc;
}

/* ---------- Pipeline fit ---------- */

.fg-fit {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.fg-fit-stage {
  position: relative;
  padding: 18px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--muted);
  text-decoration: none;
}

.fg-fit-stage b {
  display: block;
  margin: 6px 0 4px;
  color: var(--ink-soft);
  font-size: 15px;
}

.fg-fit-stage span {
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.1em;
}

.fg-fit-stage small {
  display: block;
  font-size: 12.5px;
  line-height: 1.45;
}

.fg-fit-stage.is-here {
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--ink-soft);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent),
    0 20px 40px -20px var(--accent);
}

.fg-fit-stage.is-here b {
  color: var(--ink);
}

.fg-fit-stage.is-here::after {
  content: "this tool";
  position: absolute;
  top: -10px;
  right: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font: 700 10px/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Trade-offs ---------- */

.fg-tradeoffs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.fg-list {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.fg-list h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 18px;
}

.fg-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.fg-list li {
  position: relative;
  padding-left: 28px;
  font-size: 15px;
  color: var(--ink-soft);
}

.fg-list li b {
  color: var(--ink);
}

.fg-list li::before {
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font: 700 11px/1 var(--mono);
}

.fg-list--pro li::before {
  content: "+";
  background: color-mix(in srgb, var(--ok) 20%, transparent);
  color: var(--ok);
}

.fg-list--con li::before {
  content: "!";
  background: color-mix(in srgb, var(--warn) 20%, transparent);
  color: var(--warn);
}

/* ---------- Verdict + next ---------- */

.fg-verdict {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  margin: clamp(48px, 7vw, 88px) 0 120px;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line-strong);
  border-radius: calc(var(--radius) + 8px);
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--bg-2);
}

.fg-verdict h2 {
  margin: 12px 0 10px;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.02em;
}

.fg-verdict p {
  margin: 0;
  color: var(--ink-soft);
}

.fg-checks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.fg-checks li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 14.5px;
  color: var(--ink-soft);
}

.fg-checks li::before {
  content: "✓";
  flex: none;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font: 700 11px/1 var(--mono);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .fg-hero,
  .fg-verdict {
    grid-template-columns: 1fr;
  }

  .fg-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fg-steps::before {
    display: none;
  }

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

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

@media (max-width: 560px) {
  .fg-steps {
    grid-template-columns: 1fr;
  }

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

  .fg-fact:nth-child(odd) {
    border-right: 0;
  }

  .fg-fact:nth-child(n + 2) {
    border-top: 1px solid var(--line);
  }

  .fg-top-meta .fg-pill:not(.fg-pill--accent) {
    display: none;
  }

  .fg-actions .fg-btn {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
