/* ==========================================================================
   RekoGen: reading pages (Privacy, Terms, Community Guidelines, FAQ, Support,
   What's New). Loaded after styles.css and app.css. Dark first, light supported.
   ========================================================================== */

:root {
  --doc-text: #383842;
  --doc-link: #7A1FD0;
  --doc-tint: rgba(142, 45, 226, 0.06);
  --doc-tint-border: rgba(142, 45, 226, 0.20);
  --doc-kicker: #8447EE;
  --doc-warn: #C25E00;
  --doc-warn-bg: rgba(255, 159, 10, 0.10);
  --doc-ok: #1E8E3E;
  --doc-no: #D93025;
}
[data-theme="dark"] {
  --doc-text: #CFCFD6;
  --doc-link: #C9A2FF;
  --doc-tint: rgba(142, 45, 226, 0.10);
  --doc-tint-border: rgba(142, 45, 226, 0.32);
  --doc-kicker: #FF6FD8;
  --doc-warn: #FFB547;
  --doc-warn-bg: rgba(255, 159, 10, 0.10);
  --doc-ok: #4ADE80;
  --doc-no: #FF6B6B;
}

/* ---------- Hero ---------- */
.doc-hero {
  position: relative;
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--rk-border);
  background:
    radial-gradient(ellipse 70% 130% at 0% 0%, rgba(142, 45, 226, 0.16), transparent 60%),
    radial-gradient(ellipse 45% 100% at 100% 0%, rgba(255, 111, 216, 0.08), transparent 60%);
}
[data-theme="dark"] .doc-hero {
  background:
    radial-gradient(ellipse 70% 130% at 0% 0%, rgba(142, 45, 226, 0.28), transparent 60%),
    radial-gradient(ellipse 45% 100% at 100% 0%, rgba(255, 111, 216, 0.12), transparent 60%);
}
.doc-kicker {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--doc-kicker);
  margin: 0 0 14px;
  max-width: none;
}
.doc-hero h1 {
  font-size: clamp(36px, 7vw, 58px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0 0 14px;
}
.doc-hero h1 .grad,
.doc-grad {
  background: var(--rk-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.doc-hero-sub {
  font-size: clamp(17px, 2.4vw, 20px);
  line-height: 1.5;
  color: var(--rk-muted);
  max-width: 54ch;
  margin: 0 0 22px;
}
.doc-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.doc-meta li {
  font-size: 0.875rem;
  line-height: 1.3;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
  color: var(--rk-muted);
}
.doc-meta li strong { color: var(--rk-fg); font-weight: 600; }
.doc-meta a { color: var(--doc-link); text-decoration: none; }
.doc-meta a:hover { text-decoration: underline; }

/* ---------- Layout: table of contents + article ---------- */
.doc-main { padding: 36px 0 72px; }
.doc-layout { display: grid; gap: 28px; }
@media (min-width: 992px) {
  .doc-main { padding-top: 48px; }
  .doc-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 64px; }
}

/* Table of contents. Mobile: a collapsible card. Desktop: a sticky sidebar. */
.doc-toc details {
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
  border-radius: 16px;
}
.doc-toc summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}
.doc-toc summary::-webkit-details-marker { display: none; }
.doc-toc summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--rk-muted);
  border-bottom: 2px solid var(--rk-muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}
.doc-toc details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.doc-toc ol {
  list-style: none;
  margin: 0;
  padding: 0 10px 12px;
}
.doc-toc a {
  display: block;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--rk-muted);
  font-size: 0.9rem;
  line-height: 1.35;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.doc-toc a:hover { color: var(--rk-fg); background: var(--doc-tint); }
.doc-toc a.is-active { color: var(--rk-fg); background: var(--doc-tint); font-weight: 600; box-shadow: inset 2px 0 0 var(--rk-primary); }
@media (min-width: 992px) {
  .doc-toc {
    position: sticky;
    top: 92px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }
  .doc-toc details { background: none; border: 0; border-radius: 0; }
  .doc-toc summary {
    pointer-events: none;
    padding: 0 10px 10px;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rk-muted);
  }
  .doc-toc summary::after { display: none; }
  .doc-toc ol { padding: 0; }
}

/* ---------- Article typography ---------- */
.doc-body { max-width: 720px; min-width: 0; }
.doc-body p,
.doc-body li {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--doc-text);
  max-width: none;
}
.doc-body p { margin: 0 0 1rem; }
.doc-body strong { color: var(--rk-fg); font-weight: 650; }
.doc-body em { color: var(--rk-fg); }
.doc-body a { color: var(--doc-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.doc-body a:hover { text-decoration-thickness: 2px; }
.doc-intro { font-size: 1.15rem !important; line-height: 1.7 !important; color: var(--rk-fg) !important; }

.doc-section {
  padding: 36px 0 0;
  margin: 36px 0 0;
  border-top: 1px solid var(--rk-border);
  scroll-margin-top: 84px;
}
.doc-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.doc-summary + .doc-section { border-top: 0; margin-top: 32px; padding-top: 0; }
.doc-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(22px, 3.2vw, 27px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 16px;
}
.doc-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--rk-gradient);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0;
}
.doc-num-emoji {
  background: var(--rk-card);
  border: 1px solid var(--doc-tint-border);
  font-size: 1.05rem;
}
.doc-section h3 {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 24px 0 8px;
}

/* Lists */
.doc-body ul,
.doc-body ol { list-style: none; padding: 0; margin: 0 0 1.1rem; }
.doc-body ul > li { position: relative; padding-left: 24px; margin-bottom: 0.55rem; }
.doc-body ul > li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.68em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rk-gradient);
}
.doc-body ol { counter-reset: doc-step; }
.doc-body ol > li { position: relative; padding-left: 40px; margin-bottom: 0.85rem; counter-increment: doc-step; }
.doc-body ol > li::before {
  content: counter(doc-step);
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--rk-fg);
  background: var(--doc-tint);
  border: 1px solid var(--doc-tint-border);
}

/* "The short version" summary */
.doc-summary {
  margin: 28px 0 12px;
  padding: 22px;
  border-radius: 20px;
  background: var(--doc-tint);
  border: 1px solid var(--doc-tint-border);
}
.doc-summary-title {
  font-family: var(--font-display);
  font-size: 0.75rem !important;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--doc-kicker) !important;
  margin: 0 0 16px !important;
}
.doc-summary-grid { display: grid; gap: 18px; }
@media (min-width: 640px) { .doc-summary-grid { grid-template-columns: repeat(3, 1fr); } }
.doc-summary-item h3 { font-size: 1rem; font-weight: 700; margin: 10px 0 4px; }
.doc-summary-item p { font-size: 0.95rem !important; line-height: 1.55 !important; margin: 0 !important; }
.doc-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.2rem;
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
}

/* Callouts */
.doc-callout {
  margin: 18px 0;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--doc-tint);
  border: 1px solid var(--doc-tint-border);
  border-left: 4px solid var(--rk-primary);
}
.doc-callout > :last-child { margin-bottom: 0 !important; }
.doc-callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--rk-fg);
  margin: 0 0 6px !important;
}
.doc-callout-warn { background: var(--doc-warn-bg); border-color: rgba(255, 159, 10, 0.30); border-left-color: #FF9F0A; }
.doc-callout-warn .doc-callout-title { color: var(--doc-warn); }

/* Rule cards (Community Guidelines) */
.doc-rules { display: grid; gap: 12px; margin: 0 0 1rem; }
@media (min-width: 640px) { .doc-rules { grid-template-columns: repeat(2, 1fr); } }
.doc-rule {
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
}
.doc-rule h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px !important; font-size: 1rem !important; }
.doc-rule p { font-size: 0.96rem !important; line-height: 1.6 !important; margin: 0 !important; }

/* Do / don't example pair */
.doc-example { display: grid; gap: 10px; margin: 6px 0 18px; }
@media (min-width: 640px) { .doc-example { grid-template-columns: 1fr 1fr; } }
.doc-example div { padding: 12px 14px; border-radius: 12px; background: var(--rk-card); border: 1px solid var(--rk-border); font-size: 0.97rem; line-height: 1.5; color: var(--doc-text); }
.doc-example .ok { box-shadow: inset 3px 0 0 var(--doc-ok); }
.doc-example .no { box-shadow: inset 3px 0 0 var(--doc-no); }
.doc-example b { display: block; font-family: var(--font-display); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.doc-example .ok b { color: var(--doc-ok); }
.doc-example .no b { color: var(--doc-no); }

/* Chips list (e.g. "where these guidelines apply") */
.doc-body ul.doc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-body ul.doc-chips > li {
  padding: 6px 13px;
  margin: 0;
  border-radius: 999px;
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
  font-size: 0.92rem;
  line-height: 1.4;
}
.doc-body ul.doc-chips > li::before { display: none; }

.doc-updated { font-size: 0.9rem !important; color: var(--rk-muted) !important; margin-top: 28px !important; }

/* ---------- End-of-page: help card + related pages ---------- */
.doc-help {
  margin-top: 48px;
  padding: 24px;
  border-radius: 20px;
  background:
    radial-gradient(ellipse 80% 120% at 0% 0%, rgba(142, 45, 226, 0.22), transparent 70%),
    var(--rk-card);
  border: 1px solid var(--doc-tint-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.doc-help h2 { font-size: 1.3rem; font-weight: 800; margin: 0 0 4px; }
.doc-help p { margin: 0 !important; font-size: 1rem !important; color: var(--rk-muted) !important; }
.doc-help-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.doc-help .btn { padding: 0.65rem 1.1rem; border-radius: 12px; text-decoration: none !important; }
.doc-help .btn-brand { color: #fff !important; }
.doc-help .btn-brand-outline { color: var(--rk-fg) !important; }
.doc-help .btn-brand-outline:hover { color: #fff !important; }

.doc-related { margin-top: 20px; display: grid; gap: 12px; }
@media (min-width: 640px) { .doc-related { grid-template-columns: repeat(3, 1fr); } }
.doc-related a {
  display: block;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
  text-decoration: none !important;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.doc-related a:hover { border-color: var(--rk-primary); transform: translateY(-2px); }
.doc-related strong { display: block; font-family: var(--font-display); color: var(--rk-fg); font-size: 1rem; margin-bottom: 2px; }
.doc-related span { color: var(--rk-muted); font-size: 0.9rem; line-height: 1.45; display: block; }
.doc-related strong::after { content: " →"; color: var(--rk-accent); }

/* ---------- FAQ ---------- */
.faq-group { scroll-margin-top: 84px; margin-bottom: 40px; }
.faq-group h2 { font-size: clamp(20px, 3vw, 24px); font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; }
.faq-list {
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
  border-radius: 18px;
  overflow: hidden;
}
.faq-item + .faq-item { border-top: 1px solid var(--rk-border); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.04rem;
  line-height: 1.4;
  color: var(--rk-fg);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: var(--doc-tint); }
.faq-item summary:focus-visible { outline: 2px solid var(--rk-accent); outline-offset: -2px; }
.faq-item summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--doc-tint);
  border: 1px solid var(--doc-tint-border);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--rk-fg);
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-answer { padding: 0 20px 18px; }
.faq-answer p { margin: 0 0 0.75rem !important; font-size: 1rem !important; line-height: 1.7 !important; }
.faq-answer > :last-child { margin-bottom: 0 !important; }

/* ---------- Support ---------- */
.support-contact { display: grid; gap: 14px; margin: 0 0 8px; }
@media (min-width: 640px) { .support-contact { grid-template-columns: 1fr 1fr; } }
.support-card {
  display: block;
  padding: 22px;
  border-radius: 20px;
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
  text-decoration: none !important;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
a.support-card:hover { border-color: var(--rk-primary); transform: translateY(-2px); }
.support-card h3 { font-size: 1.15rem; font-weight: 800; margin: 14px 0 4px; color: var(--rk-fg); }
.support-card p { font-size: 0.98rem !important; line-height: 1.6 !important; margin: 0 0 12px !important; }
.support-card .support-action { font-family: var(--font-display); font-weight: 700; color: var(--doc-link); font-size: 0.98rem; word-break: break-word; }
.support-card-primary { background: radial-gradient(ellipse 90% 120% at 0% 0%, rgba(142, 45, 226, 0.22), transparent 70%), var(--rk-card); border-color: var(--doc-tint-border); }

.support-topics { display: grid; gap: 12px; }
@media (min-width: 640px) { .support-topics { grid-template-columns: 1fr 1fr; } }
.support-topic {
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
}
.support-topic h3 { display: flex; align-items: center; gap: 10px; font-size: 1.02rem !important; margin: 0 0 8px !important; }
.support-topic p { font-size: 0.97rem !important; line-height: 1.6 !important; margin: 0 0 8px !important; }
.support-topic a { font-weight: 600; font-size: 0.95rem; }

/* ---------- What's New ---------- */
.release-feed { max-width: 760px; margin: 0 auto; }
.release-feed .release-card {
  background: var(--rk-card);
  border: 1px solid var(--rk-border);
  border-radius: 20px;
  box-shadow: none;
}
.release-feed .release-card h2 { font-weight: 800; letter-spacing: -0.02em; }
.release-feed .release-tagline { font-family: var(--font-display); font-size: 1.1rem; }
.release-feed .release-list li { font-size: 1rem; line-height: 1.65; }
.release-feed p { max-width: none; font-size: 1rem; }

/* ---------- Light-mode tune-ups ---------- */
:root:not([data-theme="dark"]) .doc-meta li,
:root:not([data-theme="dark"]) .doc-rule,
:root:not([data-theme="dark"]) .faq-list,
:root:not([data-theme="dark"]) .support-card,
:root:not([data-theme="dark"]) .support-topic,
:root:not([data-theme="dark"]) .doc-related a { box-shadow: 0 1px 2px rgba(20, 20, 24, 0.04), 0 6px 16px rgba(20, 20, 24, 0.04); }

@media (prefers-reduced-motion: reduce) {
  .doc-related a, .support-card, .doc-toc summary::after, .faq-item summary::after { transition: none; }
  .doc-related a:hover, a.support-card:hover { transform: none; }
}

/* ---------- Resets for older global rules in styles.css ---------- */
.faq-group, .doc-section { padding-bottom: 0; }
.faq-group { padding-top: 0; }
.faq-item,
.doc-toc details { padding: 0; box-shadow: none; }
.faq-item { border: 0; border-radius: 0; background: none; }
.faq-item[open] summary,
.doc-toc details[open] summary { margin-bottom: 0; }
.faq-item > *:not(summary),
.doc-toc details > *:not(summary) { margin-top: 0; }
.faq-item summary:hover,
.doc-toc summary:hover { color: var(--rk-fg); }
.faq-item summary:focus,
.doc-toc summary:focus { outline: none; }
.doc-toc summary:focus-visible { outline: 2px solid var(--rk-accent); outline-offset: 2px; }
