/*
 * Shared marketing shell for every public page.
 *
 * The homepage uses the pixel rail as its primary layout. Older content
 * pages still render their own page sections, so this file gives those
 * sections the same rail offset, readable measure, cards, and responsive
 * behavior without touching the editor or dashboard surfaces.
 */
:root {
  --marketing-rail: 274px;
  --marketing-rail-tablet: 226px;
  --marketing-content: 1110px;
  --marketing-gutter: clamp(1rem, 3.5vw, 2.25rem);
  --marketing-surface: #0b0b0e;
  --marketing-surface-raised: #151519;
  --marketing-line: rgba(255, 255, 255, .12);
  --marketing-copy: #deddd8;
  --marketing-copy-muted: #aaa9a6;
  --marketing-accent: #d4e55f;
  --marketing-accent-warm: #f07e34;
}

/* Global responsive guardrails consolidated from the legacy marketing sheet. */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; }
body { max-width: 100%; overflow-x: hidden; }
img, svg, video, canvas, iframe { max-width: 100%; }
pre, code { max-width: 100%; overflow-x: auto; }
table { max-width: 100%; }

.page-shell, .page-shell > .container, .page-shell .container,
.site-cinematic .container, .legal-page .container {
  width: min(1180px, calc(100% - 40px));
  max-width: 100%;
  margin-inline: auto;
}

.sf-hero-art img { display: none; }
.sf-grid-art img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; opacity: .88; }
.sf-grid-art { background-image: linear-gradient(#ffffff12 1px, transparent 1px), linear-gradient(90deg, #ffffff12 1px, transparent 1px); background-size: 32px 32px; }

/* The rail is shared by all pages that include marketing_nav. */
body:has(.sf-sidebar) > main:not(.sf-main) {
  width: calc(100% - var(--marketing-rail));
  margin-left: var(--marketing-rail);
  margin-right: 0;
}

body:has(.sf-sidebar) > main.page-shell {
  padding-top: clamp(2rem, 5vw, 4.5rem);
}

body:has(.sf-sidebar) .page-header {
  padding-block: clamp(3rem, 7vw, 7rem) 2.5rem;
}

/* Product pages previously rendered full-viewport content behind the rail. */
body:has(.sf-sidebar) > main.product-page {
  padding-inline: var(--marketing-gutter);
  padding-top: clamp(2.5rem, 6vw, 5rem);
}

/* Non-landing product pages use the full content canvas; the rail rule above
   is only activated on the homepage where marketing_sidebar is enabled. */
.product-page {
  width: min(var(--marketing-content), calc(100% - 2 * var(--marketing-gutter)));
  margin-inline: auto;
  padding-top: clamp(2.5rem, 6vw, 5rem);
}
.product-page > .product-wrap,
.product-page .product-wrap { width: 100%; }

.product-page > .product-wrap,
.product-page .product-wrap {
  width: min(var(--marketing-content), 100%);
  margin-inline: auto;
}

.product-page h1,
.product-page h2,
.product-page h3 {
  font-family: SFPixel, var(--font-display, ui-monospace), monospace;
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: .01em;
}

.product-page h1 {
  max-width: 18ch;
  margin: 0 0 1.25rem;
  color: #fff;
  font-size: clamp(2.8rem, 6vw, 5.6rem);
}

.product-page h2 {
  color: #fff;
  font-size: clamp(1.9rem, 3.2vw, 3rem);
}

.product-page p,
.product-page li {
  color: var(--marketing-copy);
  font-family: Inter, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

.product-page .product-lede {
  max-width: 62ch;
  margin: 0 0 2.25rem;
  color: var(--marketing-copy-muted);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
}

/* Template catalogue/detail surfaces share the editor's dense, pixel-art
   language while keeping the marketing shell quiet and conversion-focused. */
body:has(.template-catalog) { background: #0b0f17; color: var(--marketing-copy); }
.template-catalog { padding-bottom: clamp(4rem, 8vw, 8rem); }
.template-catalog__header { max-width: 760px; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.template-eyebrow,
.template-starter-card__meta {
  margin: 0 0 .85rem;
  color: var(--marketing-accent-warm);
  font-family: SFPixel, var(--font-display, ui-monospace), monospace;
  font-size: .75rem;
  letter-spacing: .08em;
  line-height: 1.3;
  text-transform: uppercase;
}
.template-catalog h1,
.template-catalog h2 { font-family: SFPixel, var(--font-display, ui-monospace), monospace; font-weight: 400; }
.template-catalog h1 { margin: 0 0 1.25rem; color: #fff; font-size: clamp(2.8rem, 6vw, 5.6rem); line-height: 1.04; }
.template-catalog h1 em { color: var(--marketing-accent); font-style: normal; }
.template-catalog h2 { color: #fff; line-height: 1.12; }
.template-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--marketing-copy-muted);
  font-family: SFPixel, var(--font-display, ui-monospace), monospace;
  font-size: .75rem;
  text-transform: uppercase;
}
.template-breadcrumb a { color: var(--marketing-accent); text-decoration: none; }
.template-breadcrumb a:hover { color: #fff; text-decoration: underline; }
.template-starter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
}
.template-starter-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
  background: #151b26;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .28);
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.template-starter-card:hover,
.template-starter-card:focus-within {
  border-color: var(--marketing-accent-warm);
  background: #1a2330;
  transform: translateY(-2px);
}
.template-starter-card__media {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  background: #070a10;
}
.template-starter-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  transition: transform .2s ease;
}
.template-starter-card:hover .template-starter-card__media img,
.template-starter-card:focus-within .template-starter-card__media img { transform: scale(1.025); }
.template-starter-card__body { display: flex; flex: 1; flex-direction: column; padding: 1.25rem; }
.template-starter-card__body h2 { margin: 0 0 .7rem; font-size: clamp(1.25rem, 2vw, 1.65rem); }
.template-starter-card__body h2 a { color: #fff; text-decoration: none; }
.template-starter-card__body h2 a:hover { color: var(--marketing-accent); }
.template-starter-card__body p:not(.template-starter-card__meta) { margin: 0; color: var(--marketing-copy-muted); font-size: .95rem; line-height: 1.6; }
.template-starter-card__cta,
.template-login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 46px;
  border: 1px solid #ffb27d;
  background: var(--marketing-accent-warm);
  color: #160e0a !important;
  font-family: SFPixel, var(--font-display, ui-monospace), monospace;
  font-size: .8rem;
  text-decoration: none;
  box-shadow: 3px 3px 0 #07080b;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.template-starter-card__cta { width: 100%; margin-top: auto; padding: .75rem 1rem; }
.template-login-button { width: 100%; padding: .8rem 1.15rem; }
.template-starter-card__cta:hover,
.template-login-button:hover { border-color: #ffe0c6; background: #ff9758; transform: translate(-1px, -1px); }
.template-starter-card__cta:focus-visible,
.template-login-button:focus-visible,
.template-breadcrumb a:focus-visible,
.template-starter-card__media:focus-visible,
.template-starter-card__body h2 a:focus-visible { outline: 2px solid #77e6ff; outline-offset: 3px; }
.template-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: clamp(1.5rem, 5vw, 4.5rem);
  align-items: start;
}
.template-detail-hero__media {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .22);
  background: #070a10;
  box-shadow: 7px 7px 0 rgba(0, 0, 0, .28);
}
.template-detail-hero__media img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.template-detail-hero__copy { min-width: 0; padding-top: .35rem; }
.template-detail-hero__copy h1 { overflow-wrap: anywhere; }
.template-lede { max-width: 54ch; margin: 0 0 1.75rem; color: var(--marketing-copy-muted); font-size: clamp(1rem, 1.4vw, 1.2rem); line-height: 1.65; }
.template-specs { margin: 0 0 1.75rem; border-top: 1px solid rgba(255, 255, 255, .15); }
.template-specs > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 1rem; padding: .8rem 0; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.template-specs dt { color: var(--marketing-accent-warm); font-family: SFPixel, var(--font-display, ui-monospace), monospace; font-size: .7rem; text-transform: uppercase; }
.template-specs dd { margin: 0; color: var(--marketing-copy); font-size: .9rem; line-height: 1.45; }
.template-detail-hero__action { padding: 1.1rem; border: 1px solid rgba(255, 255, 255, .14); background: #151b26; }
.template-detail-hero__action p { margin: 0 0 .9rem; color: var(--marketing-copy-muted); font-size: .9rem; }
.template-detail-note { max-width: 700px; margin-top: clamp(3rem, 8vw, 7rem); padding-top: 2rem; border-top: 1px solid rgba(255, 255, 255, .14); }
.template-detail-note h2 { margin: 0 0 .9rem; font-size: clamp(1.7rem, 3vw, 2.7rem); }
.template-detail-note p:last-child { max-width: 56ch; margin: 0; color: var(--marketing-copy-muted); }

/* 10-product.css was authored for the old rail on every page. Scope that
   offset to the actual landing rail so public subpages and workspace pages
   remain centered and wide. */
.product-footer { margin-left: 0; }
body:has(.sf-sidebar) .product-footer { margin-left: var(--marketing-rail); }

/* Keep an individual starter map readable on desktop and intentional on mobile. */
.product-template-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  margin-top: 2.5rem;
}

.product-template-detail > img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--marketing-line);
  background: #08080a;
  image-rendering: pixelated;
}

.product-template-detail > aside {
  padding: clamp(1.25rem, 2.5vw, 2rem);
  border: 1px solid var(--marketing-line);
  background: var(--marketing-surface-raised);
}

.product-template-detail > aside h2 { margin: .45rem 0 1rem; }
.product-template-detail > aside .product-button,
.product-template-detail > aside .product-text-link { display: block; width: 100%; margin-top: 1rem; text-align: center; }

.product-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
}

.product-plan {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: clamp(1.25rem, 2.3vw, 2rem);
  border: 1px solid var(--marketing-line);
  background: var(--marketing-surface-raised);
}

.product-plan h2 { margin: 0 0 .85rem; }
.product-plan > p:not(.product-eyebrow):not(.product-small) { margin: 0 0 1rem; }
.product-plan-list { margin: 0 0 1.5rem; padding-left: 1.25rem; }
.product-plan-list li { padding: .35rem 0; }
.product-plan .product-button { margin-top: auto; }

/* Shared three-column feature grid used by guides and SEO landing pages. */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.feature-card {
  min-width: 0;
  padding: clamp(1.1rem, 2vw, 1.75rem);
  border: 1px solid var(--marketing-line);
  border-radius: 0;
  background: var(--marketing-surface-raised);
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}

.feature-card:hover,
.feature-card:focus-within {
  border-color: rgba(212, 229, 95, .55);
  background: #1b1b20;
  transform: translateY(-2px);
}

.feature-card h3 {
  margin: 0 0 .65rem;
  color: #fff;
  font-family: SFPixel, var(--font-display, ui-monospace), monospace;
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  font-weight: 400;
  line-height: 1.15;
}

.feature-card p {
  margin: 0;
  color: var(--marketing-copy-muted);
  font-size: .95rem;
  line-height: 1.65;
}

.feature-card p + p { margin-top: .85rem; }

/* Make the shared page-header card and body sections sit on the same grid. */
body:has(.sf-sidebar) .page-shell > .container,
body:has(.sf-sidebar) .page-shell > .page-header,
body:has(.sf-sidebar) .page-shell > .section {
  width: min(var(--marketing-content), calc(100% - 2 * var(--marketing-gutter)));
  margin-inline: auto;
}

body:has(.sf-sidebar) .page-shell .section {
  padding-block: clamp(3.5rem, 7vw, 6rem);
}

body:has(.sf-sidebar) .page-shell .section.section-tight {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

body:has(.sf-sidebar) .page-shell .section-alt {
  background: rgba(13, 14, 20, .82);
}

/* One predictable focus treatment for links and controls in the marketing shell. */
body:has(.sf-sidebar) a:focus-visible,
body:has(.sf-sidebar) button:focus-visible,
body:has(.sf-sidebar) summary:focus-visible {
  outline: 2px solid var(--marketing-accent);
  outline-offset: 3px;
}

@media (max-width: 1050px) {
  body:has(.sf-sidebar) > main:not(.sf-main) {
    width: calc(100% - var(--marketing-rail-tablet));
    margin-left: var(--marketing-rail-tablet);
  }

  .product-pricing-grid,
  .feature-grid,
  .template-starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .product-template-detail,
  .template-detail-hero { grid-template-columns: 1fr; }
}

/* The fixed rail leaves a narrow tablet content column; keep the homepage
   pricing cards inside that column instead of letting intrinsic copy widths
   push the third card off-screen. */
@media (max-width: 900px) and (min-width: 721px) {
  .sf-pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sf-pricing-grid article { min-width: 0; }
}

@media (max-width: 720px) {
  body:has(.sf-sidebar) > main:not(.sf-main) {
    width: 100%;
    margin-left: 0;
  }

  body:has(.sf-sidebar) .page-shell > .container,
  body:has(.sf-sidebar) .page-shell > .page-header,
  body:has(.sf-sidebar) .page-shell > .section {
    width: calc(100% - 2 * var(--marketing-gutter));
  }

  body:has(.sf-sidebar) > main.product-page {
    padding-inline: var(--marketing-gutter);
  }

  .product-page { width: calc(100% - 2 * var(--marketing-gutter)); }

  .product-pricing-grid,
  .feature-grid,
  .template-starter-grid { grid-template-columns: 1fr; }
  .product-template-detail,
  .template-detail-hero { margin-top: 1.5rem; }
  .product-page h1 { max-width: 15ch; font-size: clamp(2.35rem, 12vw, 4rem); }
  .template-catalog h1 { max-width: 15ch; font-size: clamp(2.35rem, 12vw, 4rem); }
  .template-starter-card__body { padding: 1rem; }
  .template-detail-hero__copy { padding-top: 0; }
}

@media (max-width: 430px) {
  :root { --marketing-gutter: .75rem; }
  .product-page p, .product-page li,
  .template-specs dd { font-size: .95rem; }
  .template-specs > div { grid-template-columns: 76px minmax(0, 1fr); gap: .75rem; }
}

@media (max-width: 760px) {
  .page-shell, .page-shell > .container, .page-shell .container,
  .site-cinematic .container, .legal-page .container { width: min(100% - 28px, 680px); }
  .page-header-shell, .page-header-shell--split, .content-grid, .comparison-grid,
  .article-grid, .docs-layout, .form-grid { grid-template-columns: 1fr !important; }
  .page-header-aside, .page-header-card, .page-header-actions { width: 100%; }
  .page-header-actions, .hero-actions, .cta-row, .form-actions { flex-wrap: wrap; }
  .page-header-actions > *, .hero-actions > *, .cta-row > * { flex: 1 1 180px; }
  .btn, .btn-cta, .btn-gold, .btn-outline, .glass-button { min-height: 44px; }
  .docs-body, .prose, .article-body { overflow-wrap: anywhere; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .page-breadcrumb { overflow-x: auto; white-space: nowrap; }
  .section, .section-tight, .section-alt { padding-block: 52px; }
}

@media (max-width: 480px) {
  .page-shell, .page-shell > .container, .page-shell .container,
  .site-cinematic .container, .legal-page .container { width: calc(100% - 24px); }
  h1 { font-size: clamp(2rem, 10vw, 3.2rem); }
  h2 { font-size: clamp(1.65rem, 8vw, 2.5rem); }
  .btn, .btn-cta, .btn-gold, .btn-outline, .glass-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .template-starter-card,
  .template-starter-card__media img,
  .template-starter-card__cta,
  .template-login-button { transition: none; }
}

/* Workspace/admin chrome is separate from the landing-page pixel rail. */
.dashboard-body { padding-top: 0; }
.dashboard-topbar {
  position: relative;
  z-index: 20;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: #141416;
}
.dashboard-topbar-inner {
  display: flex;
  width: min(1480px, calc(100% - 48px));
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-inline: auto;
}
.dashboard-brand {
  color: #fff;
  font-family: SFPixel, var(--font-display, ui-monospace), monospace;
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  letter-spacing: .02em;
  text-decoration: none;
  white-space: nowrap;
}
.dashboard-brand span:first-of-type { color: var(--marketing-accent); }
.dashboard-topbar-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(.7rem, 2vw, 1.4rem);
  flex-wrap: wrap;
}
.dashboard-topbar-links a,
.dashboard-topbar-logout {
  border: 0;
  background: transparent;
  color: #d6d5d0;
  font-family: Inter, system-ui, sans-serif;
  font-size: .82rem;
  text-decoration: none;
  cursor: pointer;
}
.dashboard-topbar-links a:hover,
.dashboard-topbar-links a:focus-visible,
.dashboard-topbar-logout:hover,
.dashboard-topbar-logout:focus-visible { color: var(--marketing-accent); }
.dashboard-topbar-public { color: var(--marketing-accent) !important; }

.dashboard-shell {
  width: min(1480px, calc(100% - 48px));
  max-width: none;
}
.admin-layout .dashboard-shell { width: 100%; }
.admin-layout > .admin-main > .container {
  width: min(1480px, calc(100% - 48px));
  max-width: none;
  margin-inline: auto;
}

.pack-row--art {
  align-items: center;
}

.pack-row-art {
  width: 12rem;
  height: 8rem;
  flex: 0 0 12rem;
  object-fit: cover;
  image-rendering: pixelated;
  border: 1px solid var(--gold-ring);
  border-radius: var(--radius-md);
  background: #101722;
}

@media (max-width: 700px) {
  .pack-row--art {
    align-items: stretch;
    flex-direction: column;
  }

  .pack-row-art {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    flex-basis: auto;
  }

  .pack-row-cta {
    align-self: flex-start;
  }
}

@media (max-width: 720px) {
  .dashboard-topbar-inner {
    width: calc(100% - 28px);
    align-items: flex-start;
    flex-direction: column;
    gap: .65rem;
    padding-block: .75rem;
  }
  .dashboard-topbar-links { width: 100%; justify-content: flex-start; gap: .65rem 1rem; }
  .dashboard-topbar-links a, .dashboard-topbar-logout { font-size: .76rem; }
  .dashboard-shell { width: calc(100% - 28px); }
  .admin-layout > .admin-main > .container { width: calc(100% - 28px); }
}
