:root {
  --prompt-line: var(--border-secondary);
  --prompt-panel: var(--surface-well);
  --prompt-field: #141414;
  --prompt-copy: #d7d7d7;
}

.prompt-library-page,
.prompt-guide-page {
  background: var(--bg);
  color: var(--text-primary);
}

.prompt-library-page main,
.prompt-guide-page main {
  overflow: clip;
}

.prompt-shell {
  width: min(var(--container-page), calc(100% - 32px));
  margin: 0 auto;
}

/* ==========================================================================
   HERO — the homepage poster translated to editorial pages
   ========================================================================== */

.prompt-hero {
  position: relative;
  isolation: isolate;
  min-height: 760px;
  padding: 132px 0 88px;
  overflow: hidden;
  text-align: center;
}

.prompt-hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: url("../assets/img/hero-backdrop.webp") center 46% / cover no-repeat;
  opacity: 0.74;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 26%,
    rgba(0, 0, 0, 0.06) 40%,
    #000 58%,
    #000 80%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 26%,
    rgba(0, 0, 0, 0.06) 40%,
    #000 58%,
    #000 80%,
    transparent 100%
  );
}

.prompt-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    radial-gradient(ellipse 58% 36% at 50% 34%, rgba(18, 18, 18, 0.86), rgba(18, 18, 18, 0.22) 68%, transparent 100%),
    linear-gradient(180deg, rgba(18, 18, 18, 0.08) 0%, rgba(18, 18, 18, 0.16) 48%, var(--bg) 100%);
  pointer-events: none;
}

.prompt-hero--guide {
  min-height: 720px;
}

.prompt-hero .prompt-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 44px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.breadcrumbs a {
  transition: color 0.15s ease;
}

.breadcrumbs a:hover {
  color: var(--text-primary);
}

.prompt-kicker,
.prompt-section__label,
.prompt-family-card__eyebrow,
.recipe-card__index {
  margin: 0 0 14px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt-hero h1 {
  max-width: 760px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

.prompt-hero--guide h1 {
  max-width: 820px;
}

.prompt-hero__lede {
  max-width: 660px;
  margin: 20px 0 0;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1.625;
  text-wrap: pretty;
}

.prompt-hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.guide-byline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin-top: 20px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.5;
}

.guide-byline a,
.text-link,
.method-card a {
  color: #7da4ff;
}

.prompt-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(660px, 100%);
  margin-top: 64px;
  padding: 20px 0;
  border-top: 1px solid var(--prompt-line);
  border-bottom: 1px solid var(--prompt-line);
}

.prompt-stat-row div {
  padding: 0 18px;
}

.prompt-stat-row div + div {
  border-left: 1px solid var(--prompt-line);
}

.prompt-stat-row strong,
.prompt-stat-row span {
  display: block;
}

.prompt-stat-row strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.prompt-stat-row span {
  margin-top: 7px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.4;
}

/* ==========================================================================
   EDITORIAL SECTIONS
   ========================================================================== */

.prompt-section {
  padding: 112px 0;
  border-top: 1px solid var(--prompt-line);
  scroll-margin-top: 96px;
}

.prompt-section--formula,
.prompt-section--quality,
.prompt-section--troubleshooting,
.prompt-section--related {
  background: #0d0d0d;
}

.prompt-section--builder,
.prompt-section--next {
  background: #101010;
}

.prompt-section h2,
.prompt-guide-cta h2 {
  max-width: 720px;
  margin: 0;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

.prompt-section h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.prompt-section p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.prompt-two-column,
.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: clamp(48px, 8vw, 112px);
  align-items: start;
}

.prompt-two-column > div:first-child > p:last-child {
  max-width: 560px;
  margin-top: 18px;
}

.formula-list,
.workflow-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--prompt-line);
}

.formula-list li,
.workflow-list li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--prompt-line);
}

.formula-list > li > span,
.workflow-list > li > span {
  padding-top: 3px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
}

.formula-list strong,
.workflow-list h3 {
  margin: 0;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
}

.formula-list p,
.workflow-list p {
  margin: 5px 0 0;
  font-size: 14px;
}

.prompt-section__header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 40px;
  margin-bottom: 48px;
}

.prompt-section__header > div > p:last-child {
  max-width: 640px;
  margin-top: 14px;
}

/* ==========================================================================
   HUB LIBRARY
   ========================================================================== */

.prompt-search {
  display: grid;
  gap: 8px;
  min-width: min(100%, 280px);
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.prompt-search input,
.prompt-builder input,
.prompt-builder select,
.prompt-builder textarea {
  width: 100%;
  border: 1px solid var(--border-secondary);
  border-radius: 10px;
  background: var(--prompt-field);
  color: var(--text-primary);
  font: 400 14px/1.5 var(--font-sans);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.prompt-search input,
.prompt-builder input,
.prompt-builder select {
  min-height: 44px;
  padding: 9px 12px;
}

.prompt-search input::placeholder,
.prompt-builder textarea::placeholder {
  color: var(--text-tertiary);
}

.prompt-search input:focus,
.prompt-builder input:focus,
.prompt-builder select:focus,
.prompt-builder textarea:focus {
  outline: 2px solid rgba(36, 90, 202, 0.45);
  outline-offset: 1px;
  border-color: rgba(125, 164, 255, 0.6);
  background: #171717;
}

.prompt-family-grid {
  border-top: 1px solid var(--prompt-line);
}

.prompt-family-card {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr) auto;
  gap: 40px;
  align-items: center;
  min-height: 250px;
  padding: 36px 0;
  border-bottom: 1px solid var(--prompt-line);
}

.prompt-family-card[hidden],
.prompt-empty[hidden] {
  display: none !important;
}

.prompt-family-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
}

.prompt-family-card h2 a {
  transition: color 0.15s ease;
}

.prompt-family-card h2 a:hover {
  color: #7da4ff;
}

.prompt-family-card > div > p:last-child {
  margin-top: 12px;
  font-size: 14px;
}

.prompt-family-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.prompt-family-card li::before {
  content: "—";
  margin-right: 8px;
  color: var(--text-tertiary);
}

.text-link {
  align-self: center;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s ease, transform 0.15s ease;
}

.text-link:hover {
  color: #a9c0ff;
  transform: translateX(2px);
}

.prompt-empty {
  padding: 28px 0;
  border-bottom: 1px solid var(--prompt-line);
  text-align: center;
}

.quality-grid,
.failure-grid,
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 48px;
}

.quality-grid article {
  min-height: 220px;
  padding: 0 28px;
}

.quality-grid article:first-child {
  padding-left: 0;
}

.quality-grid article + article {
  border-left: 1px solid var(--prompt-line);
}

.quality-grid article > span {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
}

.quality-grid h3 {
  margin: 48px 0 8px;
  font-size: 22px;
}

.next-links {
  display: grid;
  border-top: 1px solid var(--prompt-line);
}

.next-links a,
.related-grid a {
  display: grid;
  gap: 6px;
  padding: 22px 0;
  border-bottom: 1px solid var(--prompt-line);
  transition: color 0.15s ease, padding-left 0.15s ease;
}

.next-links a:hover,
.related-grid a:hover {
  padding-left: 8px;
  color: #7da4ff;
}

.next-links span,
.related-grid span {
  color: var(--text-tertiary);
  font-size: 13px;
  line-height: 1.5;
}

/* ==========================================================================
   GUIDE-SPECIFIC CONTENT
   ========================================================================== */

.guide-prose > p:not(.prompt-section__label) {
  margin: 0 0 20px;
  color: var(--prompt-copy);
  font-size: 16px;
}

.guide-callout {
  margin-top: 34px;
  padding: 4px 0 4px 22px;
  border-left: 2px solid var(--accent);
}

.guide-callout > strong {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-callout p {
  margin: 8px 0 0;
}

.guide-toc {
  position: sticky;
  top: 96px;
  display: grid;
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--prompt-panel);
}

.guide-toc p {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.guide-toc a {
  padding: 11px 0;
  border-top: 1px solid var(--prompt-line);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.4;
  transition: color 0.15s ease;
}

.guide-toc a:hover {
  color: #7da4ff;
}

.prompt-builder {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(400px, 1.05fr);
  gap: 28px;
  padding: 28px;
  border-radius: var(--radius-card);
  background: var(--prompt-panel);
}

.prompt-builder__controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.prompt-builder label {
  display: grid;
  align-content: start;
  gap: 7px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.prompt-builder__result {
  display: grid;
  align-content: start;
  gap: 10px;
}

.prompt-builder textarea {
  min-height: 220px;
  padding: 16px;
  resize: vertical;
}

.prompt-builder__result > div {
  display: flex;
  align-items: center;
  gap: 16px;
}

.prompt-builder__result > div > span {
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 1.4;
}

.table-scroll {
  margin-top: 42px;
  overflow-x: auto;
}

.palette-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.palette-table th,
.palette-table td {
  padding: 20px 16px;
  border-bottom: 1px solid var(--prompt-line);
  vertical-align: top;
}

.palette-table thead th {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.palette-table tbody th {
  width: 22%;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
}

.palette-table td {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.65;
}

/* Complete recipes are interaction surfaces, so they retain the homepage wells. */
.prompt-section--recipes {
  background: #0a0a0a;
}

.recipe-list {
  display: grid;
  gap: 18px;
}

.recipe-card {
  padding: 28px;
  border-radius: var(--radius-card);
  background: var(--prompt-panel);
}

.recipe-card__header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 24px;
}

.recipe-card h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
}

.recipe-card__header p:last-child {
  max-width: 680px;
  margin: 10px 0 0;
}

.copy-button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--border-button);
  border-radius: 999px;
  background: #ffffff0f;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.copy-button:hover,
.copy-button[data-copied="true"] {
  background: #ffffff1a;
  color: #a9c0ff;
}

.recipe-text {
  margin: 26px 0;
  padding: 20px 22px;
  border-left: 2px solid var(--accent);
  background: #0e0e0e;
  color: var(--prompt-copy) !important;
  font-size: 15px !important;
  line-height: 1.75 !important;
}

.recipe-settings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--prompt-line);
  border-bottom: 1px solid var(--prompt-line);
}

.recipe-settings div {
  padding: 16px 16px 16px 0;
}

.recipe-settings dt {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.recipe-settings dd {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.recipe-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.recipe-notes p {
  margin: 0;
}

.recipe-notes strong,
.failure-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.failure-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--prompt-line);
}

.failure-card {
  min-height: 210px;
  padding: 28px 28px 28px 0;
  border-bottom: 1px solid var(--prompt-line);
}

.failure-card:nth-child(even) {
  padding-left: 28px;
  border-left: 1px solid var(--prompt-line);
}

.failure-card h3 {
  margin: 0 0 10px;
  font-size: 22px;
}

.failure-card p:last-child {
  margin-bottom: 0;
}

.prompt-faq {
  margin-top: 36px;
  border-top: 1px solid var(--prompt-line);
}

.prompt-faq details {
  border-bottom: 1px solid var(--prompt-line);
}

.prompt-faq summary {
  position: relative;
  padding: 20px 42px 20px 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.45;
  cursor: pointer;
  list-style: none;
}

.prompt-faq summary::-webkit-details-marker {
  display: none;
}

.prompt-faq summary::after {
  content: "+";
  position: absolute;
  right: 8px;
  top: 18px;
  color: var(--text-tertiary);
  font-size: 20px;
  font-weight: 400;
}

.prompt-faq details[open] summary::after {
  content: "−";
}

.prompt-faq details p {
  max-width: 680px;
  margin: 0;
  padding: 0 40px 20px 0;
}

.method-card {
  padding: 24px;
  border-radius: var(--radius-card);
  background: var(--prompt-panel);
}

.method-card h3 {
  margin: 0;
  font-size: 24px;
}

.method-card ul {
  display: grid;
  gap: 9px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.related-grid {
  border-top: 1px solid var(--prompt-line);
}

.related-grid a {
  min-height: 180px;
  padding: 24px;
  border-right: 1px solid var(--prompt-line);
}

.related-grid a:last-child {
  border-right: 0;
}

.related-grid a:hover {
  padding-left: 30px;
}

.related-grid strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
}

.related-grid p {
  margin: 6px 0 0;
}

/* ==========================================================================
   FINAL CTA — same icon, scale, and restraint as the homepage
   ========================================================================== */

.prompt-guide-cta {
  padding: 148px 0 112px;
  border-top: 1px solid var(--prompt-line);
  text-align: center;
}

.prompt-guide-cta::before {
  content: "";
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 auto 2px;
  background: url("../assets/img/cta-icon.webp") center / contain no-repeat;
  filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.12));
  mask-image: radial-gradient(72% 72% at 50% 50%, #000 52%, transparent 76%);
  -webkit-mask-image: radial-gradient(72% 72% at 50% 50%, #000 52%, transparent 76%);
}

.prompt-guide-cta .prompt-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.prompt-guide-cta h2 {
  max-width: 580px;
}

.prompt-guide-cta p {
  max-width: 560px;
  margin: 16px auto 0;
  color: var(--text-tertiary);
}

.prompt-guide-cta__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
  .prompt-two-column,
  .guide-layout,
  .prompt-builder {
    grid-template-columns: 1fr;
  }

  .guide-toc {
    position: static;
  }

  .prompt-family-card {
    grid-template-columns: minmax(240px, 0.8fr) minmax(300px, 1.2fr);
  }

  .prompt-family-card .text-link {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .related-grid a {
    min-height: 0;
    border-right: 0;
  }
}

@media (max-width: 680px) {
  .prompt-hero {
    min-height: 690px;
    padding: 116px 0 64px;
  }

  .prompt-hero--guide {
    min-height: 720px;
  }

  .prompt-hero::before {
    background-position: 60% 50%;
    opacity: 0.62;
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 32%,
      rgba(0, 0, 0, 0.06) 46%,
      #000 64%,
      #000 82%,
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 32%,
      rgba(0, 0, 0, 0.06) 46%,
      #000 64%,
      #000 82%,
      transparent 100%
    );
  }

  .prompt-hero::after {
    background:
      radial-gradient(ellipse 92% 42% at 50% 38%, rgba(18, 18, 18, 0.92), rgba(18, 18, 18, 0.28) 72%, transparent 100%),
      linear-gradient(180deg, rgba(18, 18, 18, 0.08) 0%, rgba(18, 18, 18, 0.2) 52%, var(--bg) 100%);
  }

  .prompt-hero h1 {
    font-size: 36px;
  }

  .prompt-hero__lede {
    font-size: 16px;
  }

  .breadcrumbs {
    margin-bottom: 34px;
  }

  .prompt-stat-row {
    margin-top: 48px;
  }

  .prompt-stat-row div {
    padding: 0 8px;
  }

  .prompt-stat-row strong {
    font-size: 20px;
  }

  .prompt-stat-row span {
    font-size: 11px;
  }

  .prompt-section {
    padding: 80px 0;
  }

  .prompt-section h2,
  .prompt-guide-cta h2 {
    font-size: 32px;
  }

  .prompt-section__header,
  .recipe-card__header {
    align-items: stretch;
    flex-direction: column;
  }

  .prompt-search {
    width: 100%;
  }

  .prompt-family-card {
    display: block;
    min-height: 0;
    padding: 30px 0;
  }

  .prompt-family-card ul {
    margin: 22px 0;
  }

  .quality-grid,
  .failure-grid,
  .recipe-settings,
  .recipe-notes,
  .prompt-builder__controls {
    grid-template-columns: 1fr;
  }

  .quality-grid article,
  .quality-grid article:first-child {
    min-height: 0;
    padding: 28px 0;
    border-bottom: 1px solid var(--prompt-line);
  }

  .quality-grid article + article {
    border-left: 0;
  }

  .quality-grid h3 {
    margin-top: 24px;
  }

  .prompt-builder,
  .recipe-card,
  .method-card {
    padding: 20px;
  }

  .prompt-builder__result > div {
    align-items: stretch;
    flex-direction: column;
  }

  .failure-card,
  .failure-card:nth-child(even) {
    min-height: 0;
    padding: 24px 0;
    border-left: 0;
  }

  .recipe-settings div + div {
    border-top: 1px solid var(--prompt-line);
  }

  .prompt-guide-cta {
    padding: 112px 0 88px;
  }

  .prompt-guide-cta::before {
    width: 132px;
    height: 132px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .text-link,
  .next-links a,
  .related-grid a {
    transition: none;
  }
}
