/* ===================================================================
   guides.css — Expedient AI Free Guides library
   Layered on top of style.css. Uses site tokens (--ink, --paper, etc.)
   =================================================================== */

/* --- COLLECTION PAGE HERO --- */
.guides-hero {
  padding: clamp(5rem, 10vw, 8rem) 0 clamp(3rem, 6vw, 5rem);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}
.guides-hero::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  animation: guides-pulse 8s ease-in-out infinite alternate;
}
@keyframes guides-pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}
.guides-hero h1 {
  max-width: 18ch;
  margin-top: 1rem;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.guides-hero .lead {
  max-width: 58ch;
  margin-top: 1.5rem;
}
.guides-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.guides-hero-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.guides-hero-stat .stat-num {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.guides-hero-stat .stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

/* --- GUIDE CARDS (collection grid) --- */
.guides-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 3rem;
}
@media (min-width: 700px) {
  .guides-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .guides-grid { grid-template-columns: repeat(3, 1fr); }
}

.guide-card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  text-decoration: none;
  color: inherit;
}
.guide-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}
.guide-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
  border-color: var(--accent);
}
.guide-card:hover::before {
  transform: scaleY(1);
}
.guide-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Flagship card spans full width on larger screens */
.guide-card--flagship {
  grid-column: 1 / -1;
  display: grid;
  gap: 1.5rem;
  padding: 2.5rem;
}
@media (min-width: 700px) {
  .guide-card--flagship {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.guide-card-edition {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.guide-card-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  color: var(--ink);
}
.guide-card--flagship .guide-card-title {
  font-size: 1.8rem;
}
.guide-card-desc {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 1rem;
  flex: 1;
}
.guide-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.guide-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.guide-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  transition: gap 0.2s ease;
}
.guide-card:hover .guide-card-cta {
  gap: 0.7rem;
}
.guide-card-cta svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}
.guide-card:hover .guide-card-cta svg {
  transform: translateX(2px);
}

/* --- INDIVIDUAL GUIDE PAGE --- */
.guide-page-hero {
  padding: clamp(4rem, 8vw, 6.5rem) 0 clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.guide-page-hero .guide-edition-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.guide-page-hero h1 {
  max-width: 20ch;
  margin-top: 1.25rem;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.guide-page-hero .lead {
  max-width: 56ch;
  margin-top: 1.25rem;
}
.guide-page-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}
.guide-page-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--ink-3);
}
.guide-page-hero-meta span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* --- GUIDE DOWNLOAD BLOCK --- */
.guide-download {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: clamp(2rem, 4vw, 3rem);
  display: grid;
  gap: 1.5rem;
  align-items: center;
  position: relative;
  overflow: hidden;
}
@media (min-width: 700px) {
  .guide-download { grid-template-columns: 1fr auto; }
}
.guide-download::after {
  content: '';
  position: absolute;
  bottom: -50%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.guide-download h2 {
  color: var(--paper);
  font-size: 1.5rem;
  margin: 0;
}
.guide-download p {
  color: color-mix(in srgb, var(--paper) 70%, transparent);
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
}
.guide-download .btn {
  position: relative;
  z-index: 1;
}

/* --- GUIDE FAQ ACCORDION --- */
.guide-faq {
  margin-top: 3rem;
}
.guide-faq h2 {
  margin-bottom: 1.5rem;
}
.guide-faq details {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.guide-faq details[open] {
  border-color: var(--accent);
}
.guide-faq summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  list-style: none;
  transition: background 0.15s ease;
}
.guide-faq summary::-webkit-details-marker { display: none; }
.guide-faq summary::after {
  content: '';
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235A5A57' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  transition: transform 0.25s ease;
}
.guide-faq details[open] summary::after {
  transform: rotate(180deg);
}
.guide-faq summary:hover {
  background: var(--paper-2);
}
.guide-faq .faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-2);
  animation: faq-open 0.2s ease;
}
@keyframes faq-open {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* --- GUIDE CHAPTERS / WHAT'S INSIDE --- */
.guide-chapters {
  margin-top: 3rem;
}
.guide-chapters h2 {
  margin-bottom: 1.5rem;
}
.guide-chapters-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: chapter;
}
.guide-chapters-list li {
  counter-increment: chapter;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.95rem;
  color: var(--ink-2);
  transition: color 0.15s ease, padding-left 0.2s ease;
}
.guide-chapters-list li:hover {
  color: var(--ink);
  padding-left: 0.5rem;
}
.guide-chapters-list li::before {
  content: counter(chapter, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 2ch;
}
.guide-chapters-list li:last-child { border-bottom: none; }

/* --- GUIDE CROSS-LINKS --- */
.guide-crosslinks {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.guide-crosslinks h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}
.guide-crosslinks-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.guide-crosslink {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink-2);
  font-size: 0.85rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.guide-crosslink:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
.guide-crosslink .xlink-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.guide-crosslink--current {
  opacity: 0.5;
  pointer-events: none;
  border-style: dashed;
}

/* --- RESPONSIVE --- */
@media (max-width: 699px) {
  .guide-card--flagship { padding: 1.5rem; }
  .guide-download { padding: 1.5rem; }
  .guides-hero-stats { gap: 1.25rem; }
}

/* ─── EMAIL GATE ─────────────────────────────────────────────────── */
.guide-email-gate {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 280px;
}
.guide-gate-form {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.guide-gate-form input[type="email"] {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.guide-gate-form input[type="email"]:focus {
  outline: none;
  border-color: var(--accent, #FF5A1F);
}
.guide-gate-form input[type="email"]::placeholder {
  color: var(--ink-3);
}
.gate-note {
  font-size: 0.8rem;
  color: var(--mid);
  margin: 0;
  line-height: 1.4;
}
.gate-success {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: gateFadeIn 0.4s ease;
}
/* display:flex above overrides the UA [hidden]{display:none} rule,
   so the download block would show before any email is given.
   Re-assert hidden explicitly. */
.gate-success[hidden] { display: none; }
.gate-success-msg {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent, #FF5A1F);
  margin: 0;
}
@keyframes gateFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ─── CHAPTER TEASERS ────────────────────────────────────────────── */
.guide-chapters-list li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}
.guide-chapters-list li:last-child { border-bottom: none; }
.ch-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}
.ch-teaser {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-3);
  max-width: 60ch;
}
/* NOTE: no [data-theme="light"] override block here. The base rules above use
   the real theme tokens (--ink / --paper-2 / --rule / --ink-3), which already
   flip across explicit-light, explicit-dark AND system-preference light/dark
   (see style.css @media prefers-color-scheme). A [data-theme="light"]-only
   override misses the system-light case and was the cause of the white-on-cream
   email input. */

/* Mobile: stack the form */
@media (max-width: 699px) {
  .guide-gate-form {
    flex-direction: column;
  }
  .guide-email-gate {
    min-width: unset;
    width: 100%;
  }
}
