/* =========================================================================
   PDF Booklet Maker — "Apothecary Journal" stylesheet
   Warm print-journal aesthetic: cream paper, ink text, oxide red + ink blue
   ========================================================================= */

:root {
  --paper: #FBF6EC;
  --paper-shade: #F3EBDA;
  --ink: #2B2118;
  --ink-soft: #4A3C2C;
  --oxide: #B4432F;
  --oxide-dark: #8F3324;
  --blue: #234E6D;
  --blue-dark: #17364C;
  --rule: #D8CBAE;
  --rule-strong: #B9A97F;
  --cream-card: #FFFDF7;

  --serif: Iowan Old Style, Georgia, "Palatino Linotype", Palatino, "Book Antiqua", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --radius: 3px;
  --shadow-card: 0 1px 0 rgba(43, 33, 24, 0.06), 0 6px 18px -12px rgba(43, 33, 24, 0.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    radial-gradient(rgba(43, 33, 24, 0.035) 1px, transparent 1px);
  background-size: 3px 3px;
}

img, svg { max-width: 100%; }

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--oxide); }

:focus-visible {
  outline: 2px solid var(--oxide);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2rem, 4.2vw, 3rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.1em; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ---------- Double-rule divider ---------- */
.rule {
  border: 0;
  height: 5px;
  margin: 3.2rem 0;
  background-image:
    linear-gradient(var(--rule-strong), var(--rule-strong)),
    linear-gradient(var(--rule-strong), var(--rule-strong));
  background-size: 100% 1px;
  background-position: top, bottom;
  background-repeat: no-repeat;
}
.rule--tight { margin: 1.6rem 0; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mark { flex: 0 0 auto; }
.brand-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.01em;
}
.brand-name em {
  font-style: italic;
  color: var(--oxide);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}
.main-nav a:not(.btn) {
  color: var(--ink-soft);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.main-nav a:not(.btn):hover { color: var(--oxide); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  font-family: var(--sans);
  cursor: pointer;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  padding: 12px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
.btn-primary {
  background: var(--oxide);
  color: var(--paper);
  border-color: var(--oxide-dark);
}
.btn-primary:hover { background: var(--oxide-dark); color: var(--paper); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-block { width: 100%; justify-content: center; }
.btn-small { padding: 8px 14px; font-size: 0.85rem; }

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 48px;
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 14px;
  display: block;
}
.hero p.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 46ch;
}
.hero-ctas {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 22px 0 14px;
}
.trust-line {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.trust-line::before { content: "\2726  "; color: var(--oxide); }

.hero-art {
  background: var(--cream-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-head { max-width: 62ch; margin-bottom: 36px; }
.section-head .kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: var(--oxide);
  font-weight: 700;
}

/* ---------- How it works ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.step {
  background: var(--cream-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
}
.step-num {
  font-family: var(--serif);
  font-style: italic;
  color: var(--oxide);
  font-size: 1.6rem;
  display: block;
  margin-bottom: 8px;
}
.step svg { margin-bottom: 12px; }

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.feature {
  padding: 22px 4px;
  border-top: 2px solid var(--ink);
}
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--ink-soft); margin-bottom: 0; font-size: 0.98rem; }

/* ---------- Calculator ---------- */
.calc {
  background: var(--cream-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px;
}
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

.calc-result {
  border-left: 3px solid var(--oxide);
  padding: 14px 18px;
  background: var(--paper-shade);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.calc-result p { margin: 0; font-family: var(--sans); font-size: 1.02rem; }
.calc-result strong { color: var(--oxide-dark); }
.calc-table { margin-top: 18px; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.94rem;
  margin: 1.4em 0;
}
caption {
  text-align: left;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-size: 0.92rem;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}
thead th {
  border-bottom: 2px solid var(--ink);
  font-weight: 700;
  color: var(--ink);
}
tbody tr:hover { background: var(--paper-shade); }

/* ---------- FAQ ---------- */
.faq-list { max-width: 78ch; }
.faq-item {
  border-bottom: 1px solid var(--rule);
  padding: 6px 0;
}
.faq-item summary {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  padding: 14px 30px 14px 0;
  position: relative;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 12px;
  font-size: 1.3rem;
  color: var(--oxide);
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { padding-bottom: 14px; color: var(--ink-soft); }

/* ---------- Blog cards ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.blog-card {
  background: var(--cream-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-card);
}
.blog-card:hover { color: var(--ink); border-color: var(--oxide); }
.blog-card .tag {
  font-family: var(--sans);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--blue);
  font-weight: 700;
  margin-bottom: 10px;
}
.blog-card h3 { margin-bottom: 8px; }
.blog-card p { color: var(--ink-soft); font-size: 0.96rem; margin-bottom: 0; }
.blog-card .read-more {
  margin-top: 16px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--oxide);
}

/* ---------- Article ---------- */
.article-header { padding: 48px 0 12px; }
.article-header .kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  color: var(--blue);
  font-weight: 700;
}
.byline {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 10px 0 0;
}
.article-body { max-width: 74ch; margin: 0 auto; padding-bottom: 40px; }
.article-body h2 { margin-top: 2.2em; }
.article-body h2:first-of-type { margin-top: 1.2em; }

.answer-block {
  border: 1px solid var(--rule-strong);
  border-left: 4px solid var(--oxide);
  background: var(--cream-card);
  padding: 20px 22px;
  margin: 1.6em 0 2em;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.answer-block p { margin: 0; font-size: 1.05rem; }
.answer-block .answer-label {
  display: block;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  color: var(--oxide);
  font-weight: 700;
  margin-bottom: 8px;
}

/* Drop caps on article openers */
.article-body > p.lede-para::first-letter {
  font-family: var(--serif);
  font-size: 3.4em;
  float: left;
  line-height: 0.82;
  padding: 0.05em 0.08em 0 0;
  color: var(--oxide);
  font-weight: 700;
}

figure {
  margin: 2em 0;
  padding: 18px;
  background: var(--cream-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
figure svg { display: block; width: 100%; height: auto; }
figcaption {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--ink-soft);
  margin-top: 10px;
  border-top: 1px dashed var(--rule-strong);
  padding-top: 8px;
}

.article-cta {
  margin: 2.6em 0;
  padding: 26px;
  background: var(--paper-shade);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  text-align: center;
}
.article-cta p { color: var(--ink-soft); margin-bottom: 16px; }

.ext-link-note {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding: 44px 0 32px;
  background: var(--paper-shade);
  font-family: var(--sans);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr;
  gap: 28px;
  margin-bottom: 28px;
}
.footer-col h4 {
  font-family: var(--sans);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
}
.footer-col a:hover { color: var(--oxide); }
.footer-bottom {
  border-top: 1px solid var(--rule);
  padding-top: 20px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer-bottom a { color: var(--ink-soft); }

/* ---------- 404 ---------- */
.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
}
.error-page .fold { max-width: 420px; margin: 0 auto 24px; }

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .calc-grid { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 24px 24px;
    gap: 16px;
  }
  .main-nav.open { display: flex; }
  .nav-toggle { display: inline-flex; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 32px; }
  .section { padding: 40px 0; }
}
