/* ============================================================
   BEACHSIDE FITNESS — RESEARCH GUIDE SYSTEM (guide.css)
   WARM ZEN edition — matches Reader / news.css palette
   ============================================================ */

:root {
  --g-paper:        #FBF8F2;
  --g-paper-2:      #F4EEE2;
  --g-paper-3:      #EBE2D2;
  --g-surface:      #FFFFFF;
  --g-ink:          #2A241D;
  --g-ink-soft:     #4A4239;
  --g-ink-mute:     #7A7166;
  --g-rule:         #E8DFCD;
  --g-coral:        #E8784C;
  --g-coral-deep:   #C95A2D;
  --g-gold:         #F2B632;
  --g-gold-deep:    #C68F1F;
  --g-sage:         #6B8E7F;
  --g-sky:          #4A8FB5;
  --g-link:         #1E5FA0;
  --g-link-hover:   #0F3F70;
  --g-shadow-card:  0 2px 8px rgba(42, 36, 29, .06), 0 1px 2px rgba(42, 36, 29, .04);
  --g-shadow-soft:  0 1px 3px rgba(42, 36, 29, .05);
  --g-shadow-hover: 0 12px 28px -8px rgba(42, 36, 29, .18);
  --g-r-sm:  6px;
  --g-r-md:  12px;
  --g-r-lg:  20px;
}

body:has(.guide-hero), body:has(.guide-body) {
  background: var(--g-paper);
  color: var(--g-ink);
}

body:has(.guide-hero) .navbar, body:has(.guide-body) .navbar {
  background: var(--g-surface) !important;
  border-bottom: 1px solid var(--g-rule);
  position: sticky; top: 0; z-index: 200;
  box-shadow: var(--g-shadow-soft);
  padding: 0.85em 0;
}
body:has(.guide-hero) .nav-container, body:has(.guide-body) .nav-container {
  max-width: 1240px; margin: 0 auto; padding: 0 1.5em;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5em;
}
body:has(.guide-hero) .navbar .logo, body:has(.guide-body) .navbar .logo {
  font-family: "Playfair Display", "Georgia", serif !important;
  font-weight: 800; font-size: 1.4rem; letter-spacing: 0.02em;
  color: var(--g-ink) !important; text-decoration: none !important;
}
body:has(.guide-hero) .navbar .logo span, body:has(.guide-body) .navbar .logo span {
  color: var(--g-coral); margin-left: 4px;
}
body:has(.guide-hero) .nav-links a, body:has(.guide-body) .nav-links a {
  color: var(--g-ink-soft) !important; font-family: "Inter", sans-serif;
  font-weight: 600; font-size: 0.92rem; padding: 0.5em 1em;
  text-decoration: none !important; border-radius: var(--g-r-sm);
  transition: all 0.18s;
}
body:has(.guide-hero) .nav-links a:hover, body:has(.guide-body) .nav-links a:hover {
  color: var(--g-coral) !important;
}
body:has(.guide-hero) .nav-links .nav-btn, body:has(.guide-body) .nav-links .nav-btn {
  background: var(--g-gold) !important; color: var(--g-ink) !important;
  border: 1px solid var(--g-gold-deep) !important; font-weight: 700;
  box-shadow: 0 2px 0 var(--g-gold-deep);
}
body:has(.guide-hero) .nav-links .nav-btn:hover, body:has(.guide-body) .nav-links .nav-btn:hover {
  background: var(--g-gold-deep) !important; color: #fff !important;
  transform: translateY(1px);
}

.guide-hero {
  padding: 5rem 1rem 3rem; text-align: center; position: relative;
  overflow: hidden; isolation: isolate; background: var(--g-paper); color: var(--g-ink);
}
.guide-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background: radial-gradient(circle at 30% 30%, rgba(232, 120, 76, 0.08), transparent 55%),
              radial-gradient(circle at 70% 70%, rgba(242, 182, 50, 0.10), transparent 60%),
              linear-gradient(180deg, var(--g-paper-2) 0%, var(--g-paper) 100%);
}
.guide-hero h1 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2.2rem, 5vw, 3.8rem); max-width: 920px; margin: 0 auto 1.5rem;
  line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; color: var(--g-ink) !important;
}
.guide-hero .text-gradient {
  background: linear-gradient(120deg, var(--g-coral) 0%, var(--g-gold) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.guide-hero .lede {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  color: var(--g-ink-soft); max-width: 760px; margin: 0 auto 2.5rem;
  font-size: 1.18rem; line-height: 1.6;
}
.updated-tag {
  display: inline-block; font-size: 0.78rem; color: var(--g-coral-deep);
  font-family: "Inter", sans-serif; background: rgba(232, 120, 76, 0.10);
  border: 1px solid rgba(232, 120, 76, 0.25); padding: 0.4rem 1rem;
  border-radius: 999px; margin-bottom: 1.5rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.hero-visual { max-width: 980px; margin: 0 auto 2rem; padding: 0 1rem; }
.hero-img-main {
  width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover;
  border-radius: var(--g-r-md); border: 1px solid var(--g-rule);
  box-shadow: var(--g-shadow-card); display: block; background: var(--g-paper-2);
}
.guide-hero-img-wrap { max-width: 980px; margin: 1.5rem auto 0; padding: 0 1rem; }
.guide-hero-img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: var(--g-r-md); box-shadow: var(--g-shadow-card); display: block;
}
.guide-toc {
  max-width: 760px; margin: 0 auto; background: var(--g-surface);
  border: 1px solid var(--g-rule); border-radius: var(--g-r-md);
  padding: 2rem; text-align: left; box-shadow: var(--g-shadow-card);
}
.guide-toc h4 {
  font-size: 0.78rem; font-family: "Inter", sans-serif; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--g-coral); margin: 0 0 1rem; font-weight: 700;
}
.guide-toc ul {
  list-style: none; padding: 0; margin: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem;
}
.guide-toc a {
  display: block; padding: 0.55em 0.75em; color: var(--g-ink) !important;
  text-decoration: none !important; font-family: "Inter", sans-serif;
  font-size: 0.92rem; font-weight: 500; border-radius: var(--g-r-sm);
  border: 1px solid transparent; transition: all 0.18s;
}
.guide-toc a:hover {
  background: var(--g-paper-2); border-color: var(--g-rule); color: var(--g-coral) !important;
}

.guide-body {
  max-width: 760px; margin: 0 auto; padding: 3rem 1.5rem 5rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.08rem; line-height: 1.78; color: var(--g-ink);
}
.guide-body section { margin-bottom: 3rem; }
.guide-body h2 {
  font-family: "Playfair Display", Georgia, serif; font-size: 1.85rem;
  margin: 2.5rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--g-rule);
  color: var(--g-ink); font-weight: 800; line-height: 1.2;
}
.guide-body h3 {
  font-family: "Inter", sans-serif; font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--g-coral); font-weight: 700; margin: 2rem 0 0.6rem;
}
.guide-body p { margin: 0 0 1.2em; color: var(--g-ink); }
.guide-body strong { color: var(--g-ink); font-weight: 700; }
.guide-body em { color: var(--g-ink-soft); font-style: italic; }
.guide-body a {
  color: var(--g-link); text-decoration: underline;
  text-decoration-color: rgba(30, 95, 160, 0.3);
  text-underline-offset: 3px; transition: color 0.18s;
}
.guide-body a:hover { color: var(--g-link-hover); text-decoration-color: currentColor; }
.guide-body ul, .guide-body ol { padding-left: 1.5em; margin: 0 0 1.2em; }
.guide-body li { margin-bottom: 0.5em; }
.guide-body li::marker { color: var(--g-coral); }

.citation {
  font-size: 0.85em; color: var(--g-link) !important; text-decoration: none !important;
  border-bottom: 1px dotted var(--g-link); white-space: nowrap;
}
.citation:hover { border-bottom-style: solid; }

.data-table {
  width: 100%; margin: 1.5rem 0; border-collapse: collapse;
  font-family: "Inter", sans-serif; font-size: 0.92rem;
  background: var(--g-surface); border-radius: var(--g-r-md);
  overflow: hidden; box-shadow: var(--g-shadow-card);
}
.data-table thead { background: var(--g-coral); color: #fff; }
.data-table th {
  padding: 0.85em 1em; text-align: left; font-weight: 700;
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.data-table td { padding: 0.85em 1em; border-bottom: 1px solid var(--g-rule); color: var(--g-ink); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--g-paper-2); }

.refs, .references {
  margin-top: 4rem; padding-top: 2rem; border-top: 2px solid var(--g-ink);
  font-family: "Inter", sans-serif; font-size: 0.88rem;
  line-height: 1.55; color: var(--g-ink-soft);
}
.refs h2, .references h2 {
  font-family: "Inter", sans-serif; font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--g-ink-mute); border: 0; padding: 0;
  margin: 0 0 1em; font-weight: 700;
}
.refs ol, .references ol { padding-left: 1.4em; }
.refs li, .references li { margin-bottom: 0.85em; }
.refs li em, .references li em { color: var(--g-ink); font-style: italic; }

.guide-body blockquote, .pull-quote {
  margin: 2.5em 0; padding: 2em 1.5em; background: var(--g-paper-2);
  border-left: 4px solid var(--g-gold); border-radius: 0 var(--g-r-md) var(--g-r-md) 0;
  font-family: "Playfair Display", Georgia, serif; font-size: 1.3rem;
  font-style: italic; color: var(--g-ink); line-height: 1.4;
}

.stat-block {
  margin: 2rem 0; padding: 1.5em 1.7em; background: var(--g-surface);
  border: 1px solid var(--g-rule); border-radius: var(--g-r-md); box-shadow: var(--g-shadow-card);
}
.stat-block h4 {
  font-family: "Inter", sans-serif; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.15em; margin: 0 0 1em; color: var(--g-ink-mute);
}

.next-up { max-width: 1100px; margin: 0 auto; padding: 4rem 1.5rem; border-top: 1px solid var(--g-rule); }
.next-up h3 {
  font-family: "Inter", sans-serif; font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--g-ink-mute); margin: 0 0 1.5rem;
}
.next-up-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem;
}
.next-up-card {
  display: block; padding: 1.5rem; background: var(--g-surface);
  border: 1px solid var(--g-rule); border-radius: var(--g-r-md);
  text-decoration: none !important; color: var(--g-ink) !important;
  box-shadow: var(--g-shadow-card); transition: all 0.2s;
}
.next-up-card:hover {
  transform: translateY(-2px); box-shadow: var(--g-shadow-hover); border-color: var(--g-coral);
}
.next-up-card h4 {
  font-family: "Playfair Display", Georgia, serif; font-size: 1.2rem;
  margin: 0 0 0.5rem; color: var(--g-ink);
}

@media (max-width: 768px) {
  .guide-hero { padding: 3rem 1rem 2rem; }
  .guide-toc ul { grid-template-columns: 1fr; }
  .guide-body { padding: 2rem 1.25rem 3rem; }
  .data-table { font-size: 0.85rem; }
  .data-table th, .data-table td { padding: 0.6em 0.7em; }
}

/* ============================================================
   Citation links + target highlight (jump-to-reference UX)
   ============================================================ */
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

a.citation {
  font-size: 0.85em;
  color: var(--g-link, #1E5FA0) !important;
  text-decoration: none !important;
  border-bottom: 1px dotted var(--g-link, #1E5FA0);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s;
}
a.citation:hover {
  border-bottom-style: solid;
  background: rgba(30, 95, 160, 0.06);
  border-radius: 3px;
  padding: 0 3px;
  margin: 0 -3px;
}

/* Reference item — when targeted via #ref-X, flash highlight */
.ref-item {
  display: block;
  padding: 0.85em 1em;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 0.35em;
}
.ref-item code {
  display: inline-block;
  background: rgba(232, 120, 76, 0.12);
  color: var(--g-coral-deep, #C95A2D);
  padding: 0.15em 0.55em;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78em;
  font-weight: 700;
  margin-right: 0.6em;
  white-space: nowrap;
}
.ref-item:target {
  background: linear-gradient(90deg, rgba(242, 182, 50, 0.20), rgba(242, 182, 50, 0.08));
  border-color: var(--g-gold, #F2B632);
  box-shadow: 0 0 0 4px rgba(242, 182, 50, 0.15);
  animation: refTargetFlash 1.6s ease-out;
}
@keyframes refTargetFlash {
  0% { background: rgba(242, 182, 50, 0.45); }
  100% { background: linear-gradient(90deg, rgba(242, 182, 50, 0.20), rgba(242, 182, 50, 0.08)); }
}

.ref-grid { display: block; }
.references-inner { max-width: 760px; margin: 0 auto; padding: 0 1.5em; }
.references-inner h2 {
  font-family: "Inter", sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--g-ink-mute, #7A7166);
  border-top: 2px solid var(--g-ink, #2A241D);
  padding-top: 1.5em;
  margin: 4em 0 1.5em;
  font-weight: 700;
}
