/* theme.css — ScenarioTrace production visual theme.
 *
 * Loaded (as a plain <link>, never a JS import — see the note in
 * BaseLayout.astro) ONLY for PRODUCT=scenariotrace, after the shared
 * src/styles/global.css. Restyles the SAME real markup/class names/layout
 * every product's templates share (site-header, blog-hero, analyze-cta,
 * article-grid, article-card, article, article__header, related, etc.) —
 * no template fork, no markup change, no route/canonical/sitemap/schema
 * change. Every other product's rendering is untouched: this file is never
 * linked into any other product's build.
 *
 * The site-header/site-footer brand mark (the dot + "ScenarioTrace" +
 * "blog" wordmark) is left exactly as global.css already renders it — this
 * file adds no rule for `.site-header` / `.brand` / `.site-footer` at all.
 *
 * Direction: typography-led, generous whitespace, minimal decoration,
 * restrained color, subtle CSS-only micro-interactions.
 *
 * Every override selector is prefixed with `body ` (or uses `html:root` for
 * the :root custom-property tokens) purely to guarantee higher specificity
 * than global.css's bare `.foo {}` / `:root {}` rules regardless of which
 * <link> the compiled HTML happens to emit first — not a stylistic choice.
 */

html:root {
  --color-text: #1a1a2e;
  --color-muted: #6b6b76;
  --color-faint: #8a8a93;
  --color-border: rgba(26, 26, 46, 0.08);
  --color-border-strong: rgba(26, 26, 46, 0.14);
  --color-bg: #fbfbfc;
  --color-bg-subtle: #f5f5f7;
  /* Accent matched to ScenarioTrace's own live site (measured via computed
     style of its primary CTA button: rgb(22,162,73)) — not the shared
     Shopify-Polaris green (#008060) global.css otherwise ships for every
     product. Text neutral likewise matches ST's own near-black (#1a1a2e). */
  --color-accent: #16a34a;
  --color-accent-hover: #0f7a37;
  --color-accent-soft: rgba(22, 163, 74, 0.08);
  --color-accent-rgb: 22, 163, 74;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* Dedicated generous-whitespace scale for this theme, NOT global.css's
     --space-*. Same names, roughly double the pixel values -- global.css's
     --space-6/-12/-16 etc. are exactly (or nearly) half of these, so an
     earlier draft that reused --space-* directly quietly rendered every
     "generous" gap at about half its intended size. Revert instructions:
     see the header comment at the top of this file. */
  --st-space-1: 8px;
  --st-space-2: 16px;
  --st-space-3: 24px;
  --st-space-4: 32px;
  --st-space-6: 48px;
  --st-space-8: 64px;
  --st-space-12: 96px;
  --st-space-16: 144px;
}

/* Dark mode: OS-driven only (prefers-color-scheme), no toggle -- this repo
   ships zero client JS, so there is no mechanism (or need) for a manual
   switch. Every rule above/below reads these same token names, so nothing
   else needs a dark-specific override. */
@media (prefers-color-scheme: dark) {
  html:root {
    --color-text: #f5f5f7;
    --color-muted: #98989d;
    --color-faint: #6e6e73;
    --color-border: rgba(255, 255, 255, 0.12);
    --color-border-strong: rgba(255, 255, 255, 0.2);
    --color-bg: #000000;
    --color-bg-subtle: #1c1c1e;
    --color-accent: #22c55e;
    --color-accent-hover: #4ade80;
    --color-accent-soft: rgba(34, 197, 94, 0.12);
    --color-accent-rgb: 34, 197, 94;
  }
}

/* ---------- Hero: soft gradient panel behind the type, not a hard card ---------- */
body .blog-hero {
  /* The prototype's hero was a narrow 640px editorial column, not a
     full-width panel -- missing this max-width was the actual cause of the
     headline "looking totally different": same font-size, but a much
     wider box means far fewer, longer-wrapped lines. */
  max-width: 640px;
  /* Compressed from --st-space-12 (96px) -- gap before the CTA, same HQ
     read as the CTA's own spacing below. */
  margin-bottom: var(--st-space-8);
  padding: var(--st-space-6);
  border-radius: 28px;
  background: radial-gradient(130% 170% at 12% 0%, rgba(var(--color-accent-rgb), 0.14), transparent 62%),
    var(--color-bg);
  border: 1px solid var(--color-border);
}

body .blog-hero__kicker {
  display: inline-flex;
  margin: 0 0 var(--st-space-3);
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(var(--color-accent-rgb), 0.14);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--color-accent);
}

body .blog-hero__title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.06;
}

body .blog-hero__title em {
  font-style: normal;
  color: var(--color-accent);
}

body .blog-hero__lead {
  font-size: 1.25rem;
  line-height: 1.5;
}

body .blog-hero__meta {
  margin-top: var(--st-space-2);
}

/* ---------- Browse by topic: flat rows, not bordered boxes ---------- */
body .cluster-map__title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

body .cluster-nav__item {
  border: none;
  border-radius: 0;
  padding: var(--st-space-4) 0;
  border-top: 1px solid var(--color-border);
  background: transparent;
}

body .cluster-nav__item:last-child {
  border-bottom: 1px solid var(--color-border);
}

@media (hover: hover) and (pointer: fine) {
  body .cluster-nav__item {
    transition: background-color 160ms var(--ease-out);
  }
  body .cluster-nav__item:hover {
    background: var(--color-accent-soft);
  }
}

body .cluster-nav__title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- AnalyzeCTA: filled pill, the primary product action ----------
   Matches both Apple's own product-page convention and ScenarioTrace's real
   "Analyze logs free" button (solid green, not a text link). */
body .analyze-cta {
  max-width: var(--width-article);
  /* Compressed (was --st-space-12/-6/-6) -- same HQ read as .article-main:
     the CTA reads as strong visually, but the extra whitespace around it
     didn't actually shorten the reader's path to it. */
  margin: 0 auto var(--st-space-8);
  padding-top: var(--st-space-4);
  padding-bottom: var(--st-space-4);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

body .blog-index .analyze-cta {
  max-width: 100%;
}

body .analyze-cta__lead {
  margin: 0 0 var(--st-space-3);
  font-size: 1.0625rem;
  color: var(--color-text);
}

body .analyze-cta__action {
  margin: 0 0 var(--st-space-3);
}

body .analyze-cta__action a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  transition: transform 100ms var(--ease-out);
}

body .analyze-cta__action a:active {
  transform: scale(0.97);
}

body .analyze-cta__action a::after {
  content: '\2192';
}

@media (hover: hover) and (pointer: fine) {
  body .analyze-cta__action a {
    transition: transform 100ms var(--ease-out), background-color 160ms var(--ease-out);
  }
  body .analyze-cta__action a:hover {
    background: var(--color-accent-hover);
    color: #fff;
  }
}

body .analyze-cta__note {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-faint);
}

/* ---------- Article grid: the existing 2-column boxed-card arrangement,
   restyled (color/typography only, same ArticleCard.astro component and
   grid layout every product shares) ---------- */
body .cluster-section__title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

body .article-grid {
  gap: var(--st-space-4);
}

@media (min-width: 700px) {
  body .article-grid {
    gap: var(--st-space-6);
  }
}

body .article-card {
  /* Compressed from --st-space-6 (48px) -- same HQ read: card padding was
     part of "the page got longer" without adding readability value. */
  padding: var(--st-space-4);
  border-radius: 20px;
  background: var(--color-bg);
  box-shadow: none !important;
  /* CSS-only stagger entrance for a one-time page-load reveal. Degrades to
     an instant appearance without animation support; neutralized entirely
     under prefers-reduced-motion below. */
  opacity: 1;
  animation: st-card-in 420ms var(--ease-out) both;
}

body .cluster-sections .article-card:nth-child(1) { animation-delay: 0ms; }
body .cluster-sections .article-card:nth-child(2) { animation-delay: 40ms; }
body .cluster-sections .article-card:nth-child(3) { animation-delay: 80ms; }
body .cluster-sections .article-card:nth-child(4) { animation-delay: 120ms; }
body .cluster-sections .article-card:nth-child(5) { animation-delay: 160ms; }
body .cluster-sections .article-card:nth-child(n+6) { animation-delay: 200ms; }

@keyframes st-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (hover: hover) and (pointer: fine) {
  body .article-card {
    transition: border-color 160ms var(--ease-out);
  }
  body .article-card:hover {
    border-color: var(--color-accent);
  }
}

body .article-card:focus-within {
  border-color: var(--color-accent);
}

/* A soft background tint, not a border -- a persistent border-color here
   would look identical to the hover/focus state on every other card (read
   as a stuck hover, not a deliberate highlight). A tint can't be confused
   with an interaction state.

   NOTE (#123 follow-up): global.css (bundled in /_astro/*.css) sets a PERMANENT
   `.article-card--featured { border-color: var(--color-accent) }` (green). The tint
   above did not override it, so the featured card kept a stuck green frame on
   ScenarioTrace. Reset the border-color here to the normal card border so only the
   tint highlights it. `body .article-card--featured` (0,1,1) beats global.css
   `.article-card--featured` (0,1,0) for the resting state; hover still greens the
   border via the shared :hover rule, matching every other card. */
body .article-card--featured {
  background: var(--color-accent-soft);
  border-color: var(--color-border);
}

body .article-card__tags {
  gap: var(--st-space-2);
}

body .tag {
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--color-faint);
  font-weight: 600;
}

/* The "Start here" pillar keeps a touch of accent color -- in a grid of
   otherwise-equal boxes, position alone (unlike a linear list) doesn't
   telegraph which article to read first. */
body .tag--pillar {
  background: transparent;
  color: var(--color-accent);
}

body .article-card__title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

@media (hover: hover) and (pointer: fine) {
  body .article-card__link {
    transition: color 160ms var(--ease-out);
  }
}
body .article-card:hover .article-card__link {
  color: var(--color-accent);
}

body .article-card__desc {
  color: var(--color-muted);
}

/* ---------- Article page: larger display headline, quieter chrome ---------- */
body .article-main {
  /* Compressed from --st-space-16 (144px) per the #OWNER-SHORTHAND-01-style
     HQ read: this is a troubleshooting/how-to blog, not an Apple product
     page -- readers need to reach the answer fast, and the page has no
     screenshots/diagrams yet to justify slowing them down further. Keeps
     the Apple-esque quiet feel, cuts "time to the first word". */
  padding-top: var(--st-space-12);
}

body .article__header {
  border-bottom: 1px solid var(--color-border);
}

body .article__header h1 {
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

body .article__eyebrow a {
  font-weight: 500;
}

body .article h2 {
  font-weight: 600;
  letter-spacing: -0.015em;
}

body .article a {
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--color-accent-rgb), 0.35);
}

@media (hover: hover) and (pointer: fine) {
  body .article a {
    transition: border-color 160ms var(--ease-out);
  }
  body .article a:hover {
    border-color: var(--color-accent);
  }
}

body .related {
  border-top: 1px solid var(--color-border);
}

body .related__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ST-16 follow-up: real ScenarioTrace analyzer screenshots in article bodies
   (figure/figcaption, no JS). img itself already gets max-width:100%/height:auto
   from the shared global.css rule; this only styles the caption. */
body .article-main figure {
  margin: var(--st-space-6) 0;
}

body .article-main figcaption {
  margin-top: var(--st-space-2);
  font-size: 0.875rem;
  color: var(--color-muted);
  text-align: center;
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  body .analyze-cta__action a,
  body .article-card,
  body .article-card__link,
  body .cluster-nav__item,
  body .article a {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
  }
}

/* ---------- Read-next funnel (#201): one curated next article + progress hint ----------
   Presentation-only, ScenarioTrace-only (other products keep their `.related`
   list). Uses only the theme's existing tokens, so it inherits dark mode. */
body .read-next {
  max-width: var(--width-article);
  margin: 0 auto var(--st-space-8);
  padding-top: var(--st-space-6);
  border-top: 1px solid var(--color-border);
}
body .read-next__eyebrow {
  margin: 0 0 var(--st-space-2);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--color-accent);
}
body .read-next__title {
  margin: 0 0 var(--st-space-3);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
body .read-next__card {
  display: block;
  padding: var(--st-space-4);
  border-radius: 20px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  text-decoration: none;
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  body .read-next__card:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
  }
}
body .read-next__card-title {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}
body .read-next__card-desc {
  display: block;
  margin-top: var(--st-space-1);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-muted);
}
body .read-next__card-cta {
  display: inline-block;
  margin-top: var(--st-space-2);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-accent);
}
body .read-next__more {
  margin: var(--st-space-3) 0 0;
  font-size: 0.875rem;
  color: var(--color-faint);
}
body .read-next__more a {
  color: var(--color-muted);
}

/* Figure images: a subtle framed edge so dark screenshots do not float on a
   light OS-forced background, consistent with the card system's radius. */
body .article__body figure img {
  border: 1px solid var(--color-border);
  border-radius: 12px;
}
