/*
Theme Name: PeptideInfo
Theme URI: https://peptideinfo.io
Author: PeptideInfo
Description: Evidence-first reference theme for PeptideInfo.io. Includes a peptide library with an evidence ladder, medical review fields, trust pages, cookie notice, newsletter signup and ad slots.
Version: 1.1.0
Requires at least: 6.2
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: peptideinfo
*/

:root {
  --paper: #F6F8F7;
  --surface: #FFFFFF;
  --ink: #1C2B33;
  --ink-soft: #4A5A63;
  --rule: #D5DEDB;
  --teal: #0E6B66;
  --teal-dark: #0A504C;
  --teal-wash: #E3F0EE;
  --ev-approved: #2D7A4D;
  --ev-rct: #3F7F9C;
  --ev-early: #A8701A;
  --ev-animal: #85558F;
  --ev-lab: #7B868C;
  --warn-wash: #FBF3E4;
  --warn-ink: #6E4A0E;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --measure: 68ch;
  --wrap: 1120px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
img { max-width: 100%; height: auto; }
a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-dark); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 2px; }

.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
  clip: auto; width: auto; height: auto; position: fixed; top: 8px; left: 8px;
  background: var(--surface); padding: 8px 14px; z-index: 1000;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 68px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand svg { flex: none; }
.brand .tld { color: var(--teal); font-weight: 600; }
.primary-nav { margin-left: auto; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; }
.primary-nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.primary-nav a:hover, .primary-nav .current-menu-item > a, .primary-nav .current_page_item > a { border-bottom-color: var(--teal); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 12px; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .primary-nav { display: none; width: 100%; margin: 0 0 12px; }
  .primary-nav.is-open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 4px; }
  .primary-nav a { display: block; padding: 10px 0; border-bottom: 1px solid var(--rule); }
}

/* ---------- Home ---------- */
.lookup { padding: 64px 0 40px; }
.lookup h1 {
  font-size: clamp(34px, 5vw, 54px); line-height: 1.08; letter-spacing: -0.025em;
  margin: 0 0 16px; max-width: 17ch; font-weight: 750;
}
.lookup p.lede { font-family: var(--serif); font-size: 20px; line-height: 1.6; color: var(--ink-soft); max-width: 52ch; margin: 0 0 28px; }
.search-form { display: flex; max-width: 620px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.search-form input[type=search] { flex: 1; border: 0; padding: 14px 16px; font: inherit; font-size: 18px; color: var(--ink); background: transparent; min-width: 0; }
.search-form input[type=search]:focus { outline: none; }
.search-form:focus-within { outline: 3px solid var(--teal); outline-offset: 2px; }
.search-form button { border: 0; background: var(--ink); color: #fff; font: inherit; font-weight: 600; padding: 0 22px; cursor: pointer; }
.search-form button:hover { background: var(--teal-dark); }

.az { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 4px; }
.az a, .az span { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius); font-weight: 600; font-size: 15px; text-decoration: none; }
.az a { color: var(--ink); background: var(--surface); border: 1px solid var(--rule); }
.az a:hover { border-color: var(--teal); color: var(--teal); }
.az span { color: #B4BEBB; }

.home-section { padding: 40px 0; border-top: 1px solid var(--rule); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { font-size: 26px; letter-spacing: -0.015em; margin: 0; }
.section-head a { font-weight: 600; font-size: 15px; }

/* Library index table */
.library-index { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.library-index th { text-align: left; font-size: 13px; font-weight: 600; color: var(--ink-soft); padding: 10px 16px; border-bottom: 1px solid var(--rule); background: #FAFBFB; }
.library-index td { padding: 14px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.library-index tr:last-child td { border-bottom: 0; }
.library-index td a { font-weight: 650; text-decoration: none; color: var(--ink); }
.library-index td a:hover { color: var(--teal); }
.library-index .aka { display: block; font-size: 14px; color: var(--ink-soft); font-weight: 400; }
.letter-row td { background: var(--paper); font-weight: 700; font-size: 14px; color: var(--ink-soft); padding: 6px 16px; }
@media (max-width: 640px) {
  .library-index thead { display: none; }
  .library-index tr { display: grid; grid-template-columns: 1fr; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
  .library-index td { padding: 3px 0; border: 0; }
  .library-index tr.letter-row { padding: 0; }
  .letter-row td { padding: 6px 16px; }
}

/* Status chip and evidence mini-meter */
.status { display: inline-block; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--rule); color: var(--ink); white-space: nowrap; }
.status--approved { background: #E6F2EA; border-color: #B9D9C4; color: #1F5A38; }
.status--unapproved { background: var(--warn-wash); border-color: #EBD3A6; color: var(--warn-ink); }
.status--cosmetic, .status--supplement { background: #EEF1F7; border-color: #CCD5E6; color: #2E4266; }

.ev-mini { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.ev-mini .bars { display: inline-flex; gap: 2px; }
.ev-mini .bars i { width: 10px; height: 10px; border-radius: 2px; background: #DCE3E1; display: block; }
.ev-mini[data-level="1"] .bars i:nth-child(-n+1) { background: var(--ev-lab); }
.ev-mini[data-level="2"] .bars i:nth-child(-n+2) { background: var(--ev-animal); }
.ev-mini[data-level="3"] .bars i:nth-child(-n+3) { background: var(--ev-early); }
.ev-mini[data-level="4"] .bars i:nth-child(-n+4) { background: var(--ev-rct); }
.ev-mini[data-level="5"] .bars i:nth-child(-n+5) { background: var(--ev-approved); }

/* Guides list */
.guide-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 40px; }
.guide-list li { border-top: 1px solid var(--rule); padding: 16px 0; }
.guide-list a { font-weight: 650; font-size: 18px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.guide-list a:hover { color: var(--teal); }
.guide-list p { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; }

.method { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.method h2 { font-size: 26px; margin: 0 0 12px; letter-spacing: -0.015em; }
.method p { font-family: var(--serif); font-size: 18px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 12px; }
.method ol { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.method ol li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.method ol li::before { content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--teal-wash); color: var(--teal-dark); font-weight: 700; font-size: 14px; }
@media (max-width: 760px) { .method { grid-template-columns: 1fr; gap: 16px; } }

/* ---------- Newsletter ---------- */
.newsletter { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 32px; display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; }
.newsletter h2 { margin: 0 0 6px; font-size: 24px; }
.newsletter p { margin: 0; color: #C9D4D8; }
.newsletter form { display: flex; gap: 8px; flex-wrap: wrap; }
.newsletter input[type=email] { flex: 1; min-width: 200px; padding: 12px 14px; border-radius: var(--radius); border: 0; font: inherit; }
.newsletter button { padding: 12px 20px; border: 0; border-radius: var(--radius); background: #7FD1C7; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.newsletter button:hover { background: #A6E2DA; }
.newsletter small { display: block; width: 100%; color: #9FB0B6; font-size: 13px; margin-top: 4px; }
.newsletter .admin-note { color: #F4D69A; font-size: 14px; }
@media (max-width: 760px) { .newsletter { grid-template-columns: 1fr; padding: 24px; } }

/* ---------- Article layout ---------- */
.article-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; padding-top: 40px; padding-bottom: 64px; }
@media (max-width: 960px) { .article-wrap { grid-template-columns: 1fr; gap: 32px; } }
.crumbs { font-size: 14px; color: var(--ink-soft); margin-bottom: 14px; }
.crumbs a { color: var(--ink-soft); }
.entry-title { font-size: clamp(30px, 4.2vw, 44px); line-height: 1.12; letter-spacing: -0.022em; margin: 0 0 12px; font-weight: 750; }
.aka-line { color: var(--ink-soft); margin: 0 0 18px; }
.review-line { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-soft); padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.review-line strong { color: var(--ink); font-weight: 600; }
.review-line .pending { color: var(--warn-ink); }

.disclosure { background: var(--warn-wash); color: var(--warn-ink); border-radius: var(--radius); padding: 12px 16px; font-size: 15px; margin-bottom: 24px; }
.disclosure a { color: inherit; }

.entry-content { font-family: var(--serif); font-size: 19px; line-height: 1.72; max-width: var(--measure); }
.entry-content h2, .entry-content h3 { font-family: var(--sans); letter-spacing: -0.012em; line-height: 1.25; }
.entry-content h2 { font-size: 27px; margin: 44px 0 12px; }
.entry-content h3 { font-size: 21px; margin: 32px 0 8px; }
.entry-content p, .entry-content ul, .entry-content ol { margin: 0 0 20px; }
.entry-content li { margin-bottom: 6px; }
.entry-content blockquote { margin: 24px 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--teal); color: var(--ink-soft); }
.entry-content table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 16px; margin: 0 0 24px; }
.entry-content th, .entry-content td { border-bottom: 1px solid var(--rule); padding: 10px 8px; text-align: left; vertical-align: top; }
.entry-content th { font-weight: 600; font-size: 14px; color: var(--ink-soft); }
.entry-content .sources { font-family: var(--sans); font-size: 15px; line-height: 1.55; }
body:not(.logged-in) .editor-note { display: none; }
.entry-content .editor-note { font-family: var(--sans); font-size: 15px; background: var(--warn-wash); color: var(--warn-ink); padding: 12px 16px; border-radius: var(--radius); }

/* Evidence ladder: the signature element */
.ladder { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 20px 16px; margin: 0 0 32px; max-width: var(--measure); }
.ladder-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ladder-head h2 { font-size: 17px; margin: 0; }
.ladder-head a { font-size: 14px; }
.ladder ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ladder li { position: relative; padding-top: 18px; font-size: 13.5px; line-height: 1.3; color: #9AA5A9; }
.ladder li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 8px; border-radius: 2px; background: #E2E8E6; }
.ladder li.reached { color: var(--ink-soft); }
.ladder li.reached::before { background: var(--lvl-color, var(--teal)); }
.ladder li.current { color: var(--ink); font-weight: 700; }
.ladder li.current::after { content: ""; position: absolute; top: -5px; right: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 4px solid var(--lvl-color, var(--teal)); }
.ladder[data-level="1"] { --lvl-color: var(--ev-lab); }
.ladder[data-level="2"] { --lvl-color: var(--ev-animal); }
.ladder[data-level="3"] { --lvl-color: var(--ev-early); }
.ladder[data-level="4"] { --lvl-color: var(--ev-rct); }
.ladder[data-level="5"] { --lvl-color: var(--ev-approved); }
.ladder p.ladder-note { margin: 14px 0 0; font-size: 15px; color: var(--ink-soft); }
@media (max-width: 560px) {
  .ladder ol { grid-template-columns: 1fr; gap: 0; }
  .ladder li { padding: 6px 0 6px 26px; }
  .ladder li::before { top: 9px; bottom: auto; right: auto; width: 14px; height: 14px; border-radius: 50%; }
  .ladder li.current::after { display: none; }
}

/* Sidebar */
.sidebar > * + * { margin-top: 24px; }
.glance { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; }
.glance h2 { font-size: 16px; margin: 0 0 10px; }
.glance dl { margin: 0; }
.glance dt { font-size: 13px; color: var(--ink-soft); margin-top: 10px; }
.glance dd { margin: 2px 0 0; font-weight: 600; }
.side-note { font-size: 15px; color: var(--ink-soft); border-left: 3px solid var(--teal); padding-left: 14px; }
.toc { position: sticky; top: 20px; }
.toc h2 { font-size: 15px; margin: 0 0 8px; }
.toc ol { margin: 0; padding-left: 18px; font-size: 15px; }
.toc li { margin-bottom: 6px; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--teal); }

.ad-slot { margin: 28px 0; min-height: 90px; }
.ad-slot .ad-label { display: block; font-family: var(--sans); font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }

.medical-note { margin-top: 40px; font-size: 15px; color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 16px; max-width: var(--measure); }

/* ---------- Archives ---------- */
.archive-head { padding: 44px 0 20px; }
.archive-head h1 { font-size: clamp(30px, 4vw, 42px); letter-spacing: -0.02em; margin: 0 0 8px; }
.archive-head p { font-family: var(--serif); font-size: 19px; color: var(--ink-soft); max-width: 60ch; margin: 0; }
.post-list { list-style: none; padding: 0; margin: 0 0 40px; }
.post-list li { border-top: 1px solid var(--rule); padding: 20px 0; }
.post-list h2 { font-size: 21px; margin: 0 0 6px; }
.post-list h2 a { color: var(--ink); text-decoration: none; }
.post-list h2 a:hover { color: var(--teal); }
.post-list p { margin: 0; color: var(--ink-soft); }
.post-list .meta { font-size: 14px; margin-top: 6px; }
.pagination { padding: 20px 0 48px; display: flex; gap: 8px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 6px 12px; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; background: var(--surface); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { padding: 24px 0 64px; font-family: var(--serif); font-size: 19px; color: var(--ink-soft); }

/* Glossary page */
.glossary dt { font-family: var(--sans); font-weight: 700; margin-top: 18px; }
.glossary dd { margin: 4px 0 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--rule); margin-top: 40px; padding: 40px 0 28px; font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-grid h2 { font-size: 15px; margin: 0 0 10px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: var(--ink-soft); text-decoration: none; }
.footer-grid a:hover { color: var(--teal); }
.footer-grid p { color: var(--ink-soft); margin: 0 0 10px; }
.footer-base { border-top: 1px solid var(--rule); margin-top: 28px; padding-top: 16px; color: var(--ink-soft); font-size: 14px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Cookie notice ---------- */
.cookie-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(28, 43, 51, 0.16); padding: 16px 18px; z-index: 900; font-size: 15px; }
.cookie-notice[hidden] { display: none; }
.cookie-notice p { margin: 0 0 12px; }
.cookie-notice .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 9px 16px; border-radius: var(--radius); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; border: 1px solid var(--ink); background: var(--ink); color: #fff; text-decoration: none; }
.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn--quiet { background: var(--surface); color: var(--ink); }
.btn--quiet:hover { background: var(--paper); color: var(--ink); }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* WordPress core classes */
.alignleft { float: left; margin: 0 20px 12px 0; }
.alignright { float: right; margin: 0 0 12px 20px; }
.aligncenter { display: block; margin: 0 auto; }
.wp-caption-text { font-size: 14px; color: var(--ink-soft); }
