/* ===========================================================================
   Brand overrides — re-skin Material's default indigo to a terminal green so
   the whole site feels bespoke rather than templated. Applies to both schemes.
   =========================================================================== */
:root,
[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #15794a;
  --md-primary-fg-color--light: #1f9d5f;
  --md-primary-fg-color--dark: #0e5a36;
  --md-accent-fg-color: #1f9d5f;
}

/* ===========================================================================
   Home page — terminal-themed hero. All rules scoped under .ag-home so they
   never leak into tutorial pages (home.css is loaded site-wide).
   =========================================================================== */
.ag-home {
  --ag-bg: #0a0e14;
  --ag-panel: #0f141d;
  --ag-line: #1d2735;
  --ag-fg: #cdd8e6;
  --ag-dim: #7c8aa0;
  --ag-green: #5ef38c;
  --ag-blue: #6cb6ff;
  --ag-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono",
    Menlo, Consolas, "Liberation Mono", monospace;
}

/* Give the landing page room: the hero is a full-width dark panel. */
.ag-hero {
  position: relative;
  overflow: hidden;
  background: var(--ag-bg);
  color: var(--ag-fg);
  border: 1px solid var(--ag-line);
  border-radius: 16px;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.3rem, 5vw, 4rem);
  margin: 0 0 3.5rem;
}

/* faint grid texture */
.ag-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--ag-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ag-line) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.18;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 0%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 70% at 30% 0%, #000 30%, transparent 80%);
  pointer-events: none;
}

/* soft green glow, top-right */
.ag-hero::after {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(94, 243, 140, 0.18), transparent 65%);
  pointer-events: none;
}

.ag-hero__inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

/* Staggered entrance */
.ag-hero__inner > * {
  opacity: 0;
  animation: ag-rise 0.6s ease forwards;
}
.ag-hero__inner > *:nth-child(1) { animation-delay: 0.05s; }
.ag-hero__inner > *:nth-child(2) { animation-delay: 0.15s; }
.ag-hero__inner > *:nth-child(3) { animation-delay: 0.25s; }
.ag-hero__inner > *:nth-child(4) { animation-delay: 0.35s; }
.ag-hero__inner > *:nth-child(5) { animation-delay: 0.45s; }
@keyframes ag-rise {
  to { opacity: 1; transform: none; }
}
.ag-hero__inner > * { transform: translateY(14px); }

/* ---- terminal window ---- */
.ag-term {
  font-family: var(--ag-mono);
  background: var(--ag-panel);
  border: 1px solid var(--ag-line);
  border-radius: 10px;
  max-width: 430px;
  margin: 0 0 2rem;
  box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
}
.ag-term__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--ag-line);
}
.ag-term__bar i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #39414f;
}
.ag-term__bar i:nth-child(1) { background: #ff5f56; }
.ag-term__bar i:nth-child(2) { background: #ffbd2e; }
.ag-term__bar i:nth-child(3) { background: #27c93f; }
.ag-term__title {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--ag-dim);
}
.ag-term__body {
  padding: 0.9rem 1.05rem 1.05rem;
  font-size: 0.82rem;
  line-height: 1.75;
}
.ag-term__body p { margin: 0; }
.ag-prompt { color: var(--ag-green); }
.ag-path { color: var(--ag-blue); }
.ag-out { color: var(--ag-dim); margin: 0.1rem 0 0.7rem !important; }
.ag-type {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  width: 0;
  animation: ag-typing 1.6s steps(9) 0.9s forwards;
}
@keyframes ag-typing { to { width: 9ch; } }
.ag-cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  background: var(--ag-green);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: ag-blink 1.05s step-end infinite;
}
@keyframes ag-blink { 50% { opacity: 0; } }

/* ---- headline & copy ---- */
.ag-title {
  font-family: var(--ag-mono);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #f4f8fd;
  margin: 0 0 1rem;
  max-width: 20ch;
}
.ag-title em { color: var(--ag-green); font-style: normal; }
.ag-sub {
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  color: var(--ag-dim);
  line-height: 1.65;
  max-width: 56ch;
  margin: 0 0 2rem;
}

/* ---- CTAs ---- */
.ag-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 0 0 2.4rem; }
.ag-btn {
  font-family: var(--ag-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.72rem 1.25rem;
  border-radius: 9px;
  border: 1px solid var(--ag-line);
  color: var(--ag-fg);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    background 0.18s ease, box-shadow 0.18s ease;
}
.ag-btn:hover {
  border-color: var(--ag-green);
  color: var(--ag-green);
  transform: translateY(-2px);
}
.ag-btn--primary {
  background: var(--ag-green);
  color: #052012;
  border-color: var(--ag-green);
}
.ag-btn--primary:hover {
  background: #7df7a4;
  color: #052012;
  box-shadow: 0 12px 34px -12px rgba(94, 243, 140, 0.6);
}

/* ---- stats strip ---- */
.ag-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.8rem;
  margin: 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--ag-line);
  font-family: var(--ag-mono);
  font-size: 0.8rem;
  color: var(--ag-dim);
}
.ag-stats strong {
  display: block;
  color: #f4f8fd;
  font-size: 1.5rem;
  line-height: 1.1;
  margin-bottom: 0.15rem;
}

/* ===========================================================================
   Stage cards — these adopt the site theme (light/dark) via Material vars.
   =========================================================================== */
.ag-stages { margin: 0 0 1rem; }
.ag-eyebrow {
  font-family: var(--ag-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--md-primary-fg-color);
  margin: 0 0 0.4rem;
}
.ag-h2 {
  font-family: var(--ag-mono);
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  letter-spacing: -0.01em;
  margin: 0 0 1.6rem;
}
.ag-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 1rem;
}
.ag-card {
  position: relative;
  display: block;
  padding: 1.5rem 1.4rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 13px;
  text-decoration: none;
  color: inherit;
  background: var(--md-default-bg-color);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.ag-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 3px;
  background: var(--md-primary-fg-color);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.2s ease;
}
.ag-card:hover {
  transform: translateY(-3px);
  border-color: var(--md-primary-fg-color);
  box-shadow: 0 18px 44px -24px rgba(0, 0, 0, 0.55);
}
.ag-card:hover::before { transform: scaleY(1); }
.ag-card__num {
  font-family: var(--ag-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--md-primary-fg-color);
}
.ag-card h3 { margin: 0.35rem 0 0.45rem; font-size: 1.08rem; }
.ag-card p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--md-default-fg-color--light);
}
.ag-card__go {
  display: inline-block;
  margin-top: 0.9rem;
  font-family: var(--ag-mono);
  font-size: 0.78rem;
  color: var(--md-primary-fg-color);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.ag-card:hover .ag-card__go { opacity: 1; transform: none; }

@media (max-width: 480px) {
  .ag-term { max-width: 100%; }
  .ag-stats { gap: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ag-home *,
  .ag-home *::before,
  .ag-home *::after {
    animation: none !important;
  }
  .ag-hero__inner > * { opacity: 1; transform: none; }
  .ag-type { width: 9ch; }
}
