/* Pathogen Studio homepage — atmospheric direction.
 * Consumed by website/_worker.ts:renderHomepage(). All atmospheric
 * tokens (including the syntax-highlight palette --code-keyword /
 * --code-fn / --code-num / --code-str / --code-comment / --code-op /
 * --code-tp) live in theme.css; this file only carries the layout and
 * component styles for the homepage body. */

/* The homepage uses its own full-bleed main, not the narrow .site-main from
 * renderPage(). Override that container so the hero / showcase grid can
 * stretch to ~1280px. */
body:has(.homepage) main.site-main {
  max-width: none;
  padding: 0;
}

/* Nav surfacing — mobile-first.
 * < 800px: the inline text-strip nav inside the hero eyebrow is the
 *          primary nav surface; the tab row inside the global header
 *          is hidden, but the header itself stays so the logo lockup
 *          and theme/account actions remain reachable.
 * ≥ 800px: the global sticky header's tab row is the primary nav
 *          surface; the inline strip is hidden to avoid duplication. */
body:has(.homepage) .site-header nav.tabs-wrap { display: none; }
/* Below 800px the inline eyebrow strip is the primary nav, so the header
 * doesn't need to follow the user — let it scroll away with the hero.
 * Overrides the universal `.site-header { position: sticky }` declared in
 * the inline <style> block of renderPage(). */
body:has(.homepage) .site-header { position: relative; }
/* When the nav row is removed from the header grid (< 800px), auto-placement
 * would land .actions in the middle 'auto' track and lose the right-edge
 * alignment. Pin actions to track 3 explicitly so it stays right-aligned at
 * every viewport size. */
body:has(.homepage) .site-header .actions { grid-column: 3; }
@media (min-width: 800px) {
  body:has(.homepage) .site-header nav.tabs-wrap { display: revert; }
  body:has(.homepage) .site-header { position: sticky; top: 0; z-index: 50; }
  body:has(.homepage) .hero-nav-strip { display: none; }
}

.homepage { color: var(--text-primary); }

/* ===== Dev hero — centered single column, editor sits in its own row below ===== */
.dev-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 56px 24px 24px;
  text-align: center;
}
.dev-hero-text { max-width: 760px; margin: 0 auto; }
.dev-hero-text .hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--secondary-accent-text);
  margin: 0 0 18px;
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px 14px;
}
.hero-nav-strip {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: baseline;
}
.hero-nav-strip a {
  color: var(--secondary-accent-text);
  text-decoration: none;
  position: relative;
  padding-left: 14px;
}
.hero-nav-strip a::before {
  content: '·';
  position: absolute;
  left: 0;
  opacity: 0.55;
  letter-spacing: 0;
}
.hero-nav-strip a:hover { text-decoration: underline; text-underline-offset: 4px; }
.dev-hero-text h1 {
  font-family: var(--font-display);
  /* Lower floor (28px) so the headline shrinks gracefully on narrow phones
   * instead of forcing aggressive multi-line wrapping. Upper bound (56px)
   * is the same as before — desktop appearance is preserved. */
  font-size: clamp(28px, 6.5vw, 56px);
  font-weight: 400; line-height: 1.05; letter-spacing: -0.012em;
  color: var(--text-primary);
  margin: 0 0 18px;
}
.dev-hero-text h1 em {
  font-style: italic;
  background: linear-gradient(120deg, var(--secondary-from) 0%, var(--secondary-to) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.dev-hero-text .lede {
  font-size: 16.5px; line-height: 1.55;
  color: var(--text-secondary);
  max-width: 60ch; margin: 0 auto 28px;
}
.dev-cta-cluster { display: inline-flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }

.cta-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent-from) 0%, var(--accent-to) 100%);
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-glow);
  position: relative; overflow: hidden;
  transition: transform 0.12s ease;
}
.cta-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(255,255,255,0.35) 50%, transparent 65%);
  transform: translateX(-100%); transition: transform 0.6s ease;
  pointer-events: none;
}
.cta-primary:hover { transform: translateY(-1px); }
.cta-primary:hover::after { transform: translateX(100%); }
.cta-primary svg { width: 18px; height: 18px; fill: currentColor; position: relative; z-index: 1; }
.cta-primary span { position: relative; z-index: 1; }

.cta-mono {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 600;
  color: var(--secondary-accent-text);
  text-decoration: none;
  padding: 0.4rem 0.6rem;
  letter-spacing: 0.04em;
}
.cta-mono:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Editor row — full-width container for the code+render pane below the hero text */
.dev-editor-row {
  max-width: 1280px;
  margin: 32px auto 56px;
  padding: 0 24px;
}

/* Code-and-render editor pane — wider code column (5fr) than render (3fr) so
 * long Pathogen lines fit without horizontal scroll. */
.dev-editor {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 3fr);
  box-shadow:
    0 1px 2px rgba(var(--shadow-tint-rgb), 0.08),
    0 12px 32px rgba(var(--shadow-tint-rgb), 0.16),
    0 32px 64px rgba(var(--shadow-tint-rgb), 0.10);
}
.dev-editor > .dev-code,
.dev-editor > .dev-render { min-width: 0; }

.dev-code {
  padding: 18px 16px 18px 14px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-primary);
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  counter-reset: line;
  overflow-x: auto;
  margin: 0;
}
.dev-code .line { display: block; counter-increment: line; }
.dev-code .line::before {
  content: counter(line);
  display: inline-block;
  width: 22px;
  color: var(--text-tertiary);
  text-align: right;
  margin-right: 14px;
  opacity: 0.6;
}
.dev-code .kw { color: var(--code-keyword); font-weight: 600; }
.dev-code .fn { color: var(--code-fn); }
.dev-code .num { color: var(--code-num); }
.dev-code .str { color: var(--code-str); }
.dev-code .cm { color: var(--code-comment); font-style: italic; }
.dev-code .pun { color: var(--text-secondary); }

.dev-render {
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  position: relative;
}
.dev-render svg { width: 100%; height: 100%; max-width: 460px; max-height: 460px; }
.dev-render-caption {
  position: absolute;
  left: 14px; bottom: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ===== Terminal-styled section row ===== */
.dev-toolset {
  max-width: 1280px;
  margin: 24px auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.dev-tool {
  padding: 24px 28px;
  border-right: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
  display: flex; flex-direction: column;
}
.dev-tool:last-child { border-right: 0; }
.dev-tool:hover { background: var(--secondary-accent-subtle); }
.dev-tool .tool-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.dev-tool .tool-eyebrow svg { width: 14px; height: 14px; fill: currentColor; }
.dev-tool .tool-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.dev-tool .tool-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 16px;
  flex: 1;
}
.dev-tool .tool-cmd {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 7px 10px;
  overflow-x: auto;
  white-space: nowrap;
  margin-top: auto;
}
.dev-tool .tool-cmd .prompt { color: var(--text-tertiary); margin-right: 6px; }
.dev-tool .tool-cmd .cmd { color: var(--secondary-accent-text); font-weight: 600; }

/* ===== Blog + Showcase row ===== */
.dev-bottom {
  max-width: 1280px;
  margin: 0 auto;
  padding: 56px 24px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.5fr);
  gap: 32px;
}
.dev-bottom > * { min-width: 0; }
.dev-blog {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 26px;
  display: flex; flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.dev-blog:hover {
  box-shadow:
    0 4px 8px rgba(var(--shadow-tint-rgb), 0.08),
    0 16px 32px rgba(var(--shadow-tint-rgb), 0.12);
  border-color: var(--secondary-accent-subtle);
}
.dev-blog .blog-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--secondary-accent-text);
  margin: 0 0 12px;
}
.dev-blog .blog-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-primary);
  margin: 0 0 12px;
}
.dev-blog .blog-body {
  font-size: 14px; line-height: 1.6;
  color: var(--text-secondary);
  margin: 0 0 16px;
  flex: 1;
}
.dev-blog .blog-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.dev-showcase {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
}
.dev-tile {
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
}
.dev-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 8px rgba(var(--shadow-tint-rgb), 0.10),
    0 12px 24px rgba(var(--shadow-tint-rgb), 0.14);
}
.dev-tile img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 12px;
  display: block;
}
.dev-tile-label {
  position: absolute;
  left: 10px; bottom: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(6px);
  border-radius: 4px;
  padding: 3px 7px;
}

/* ===== Footer ===== */
.dev-footer {
  max-width: 1280px;
  margin: 0 auto;
  border-top: 1px solid var(--border-subtle);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
}
.dev-footer a {
  color: var(--secondary-accent-text);
  text-decoration: none;
  margin: 0 8px;
}
.dev-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ===== Responsive ===== */
/* Tablet + narrow desktop. The hero, tool cards, blog/showcase row,
 * and footer all collapse to single-column. The hero's inner editor
 * also stacks (code above render) — without this, the editor's own
 * 2-column grid was leaving the code pane and SVG render squeezed
 * into a narrow shared row. */
@media (max-width: 900px) {
  .dev-hero { padding: 40px 20px 20px; }
  .dev-editor-row { margin: 20px auto 40px; padding: 0 20px; }
  .dev-toolset { grid-template-columns: minmax(0, 1fr); padding: 16px 20px; }
  .dev-tool { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .dev-tool:last-child { border-bottom: 0; }
  .dev-bottom { grid-template-columns: minmax(0, 1fr); padding: 40px 20px; }
  .dev-showcase { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, 1fr); }
  .dev-footer { flex-direction: column; gap: 12px; padding: 20px; }

  /* Stack the editor: code above render. Code keeps its bottom border
   * as the separator; the desktop right-border between code and render
   * is removed since they're no longer side-by-side. */
  .dev-editor { grid-template-columns: minmax(0, 1fr); }
  .dev-code { border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .dev-render { aspect-ratio: 16 / 9; padding: 20px; }
  .dev-render svg { max-width: 320px; max-height: 320px; }
}

/* Mobile. Single-column showcase, vertical CTA cluster, smaller
 * paddings and font sizes throughout. Aligns with the 600px tier
 * already used elsewhere in playground/styles. */
@media (max-width: 600px) {
  .dev-hero { padding: 32px 16px 24px; gap: 24px; }
  .dev-hero-text .lede { font-size: 15px; }

  /* CTA cluster — stack vertically and stretch full-width */
  .dev-cta-cluster { flex-direction: column; align-items: stretch; gap: 10px; }
  .cta-primary { justify-content: center; }
  .cta-mono { text-align: center; padding: 0.5rem; }

  /* Editor — denser code gutter + smaller render */
  .dev-code { padding: 14px 12px 14px 10px; font-size: 12.5px; }
  .dev-code .line::before { width: 18px; margin-right: 10px; }
  .dev-render { padding: 16px; }
  .dev-render svg { max-width: 200px; max-height: 200px; }

  /* Tool cards */
  .dev-toolset { padding: 16px; }
  .dev-tool { padding: 18px 20px; }
  .dev-tool .tool-title { font-size: 20px; }
  .dev-tool .tool-body { font-size: 13px; }

  /* Blog card */
  .dev-bottom { padding: 32px 16px 40px; gap: 24px; }
  .dev-blog { padding: 20px; }
  .dev-blog .blog-title { font-size: 24px; }

  /* Showcase — single column on phones (was 2-col at the 900px tier).
   * Tile aspect goes 16:9 (wider/shorter) so a stack of 6 doesn't
   * become absurdly tall. */
  .dev-showcase {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(6, auto);
  }
  .dev-tile { aspect-ratio: 16 / 9; }

  .dev-footer { padding: 16px; font-size: 11px; }
}
