/* Articles, related guides and hub guide lists. Tokens only (see tokens.css).
   Wide screens: the body plus a sticky side column (contents and the
   "pairs well with" panel). Narrow screens: the contents list sits above the
   body (folded) and the pairing panel after it. */

/* Breadcrumb */
main > .breadcrumb:first-child { margin-top: calc(var(--space-2) * -1); }
.breadcrumb { margin-bottom: var(--space-2); font-size: 0.95rem; text-align: center; }
.breadcrumb ol { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 0; margin: 0; padding: 0; list-style: none; }
.breadcrumb li + li::before { content: "\2726"; padding: 0 0.7rem; font-size: 0.7em; color: var(--plum-light); vertical-align: 0.15em; }
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--text-soft); }

/* Article header: centred, ceremonial. */
.article-header { max-width: 50rem; margin: 0 auto; text-align: center; }
.article h1 { margin: 0 0 var(--space-2); font-size: clamp(1.9rem, 1.1rem + 3.4vw, 3.4rem); }
.byline {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sage);
}
.byline span { margin: 0 0.6em; color: var(--plum-bright); }
.article-header .ornament { margin: var(--space-2) auto var(--space-3); }
/* Capped so the title and the opening paragraph sit above the fold. */
.article-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(50vh, 34rem);
  object-fit: cover;
  object-position: 50% 45%;  /* keeps the moon and the roots in the crop */
  max-width: 68rem;
  margin: 0 auto var(--space-3);
  border-radius: var(--r-img);
  border: 1px solid var(--hairline);
  box-shadow: 0 40px 90px -50px var(--glow-plum);
}

/* Two-column layout */
.article-layout { display: flex; flex-direction: column; max-width: 68rem; margin: 0 auto; }
.article-aside, .article-aside-inner { display: contents; }
.toc { order: 0; margin-bottom: var(--space-4); }
.article-body { order: 1; max-width: var(--measure); width: 100%; margin: 0 auto; }
.article-aside .pairing { order: 2; }
.toc, .article-aside .pairing { width: 100%; max-width: var(--measure); margin-left: auto; margin-right: auto; }

@media (min-width: 64rem) {
  .article-layout {
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) minmax(16rem, 19rem);
    justify-content: center;
    gap: clamp(3rem, 5vw, 5.5rem);
    align-items: start;
  }
  .article-body { grid-column: 1; grid-row: 1; margin: 0; }
  /* The side column runs the full height of the body: the pairing panel sits
     at its top beside the opening, and the contents list stays in view. */
  .article-aside {
    display: flex;
    flex-direction: column;
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
  }
  .toc, .article-aside .pairing { max-width: none; }
  .article-aside .pairing { order: 0; margin: 0 0 var(--space-4); }
  .toc {
    order: 1;
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    max-height: calc(100vh - var(--header-h) - 3rem);
    overflow-y: auto;
    scrollbar-width: thin;
    margin: 0;
  }
  .toc summary { cursor: default; }
  .toc summary::after { display: none; }
}

/* Contents list */
.toc-details {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--hairline);
  border-radius: var(--arch-soft);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--panel) 45%, transparent), transparent);
}
.toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2.75rem;
  list-style: none;
  cursor: pointer;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.2rem;
  border-right: 1px solid var(--sage);
  border-bottom: 1px solid var(--sage);
  transform: rotate(45deg) translateY(-0.15rem);
  transition: transform 0.25s ease;
}
.toc details[open] summary::after { transform: rotate(-135deg); }
.toc-title {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--sage);
}
.toc-list { margin: var(--space-1) 0 var(--space-1); padding: 0; list-style: none; counter-reset: toc; }
.toc-list li { counter-increment: toc; }
.toc-list a {
  position: relative;
  display: block;
  padding: 0.45rem 0 0.45rem 2rem;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--text-soft);
  text-decoration: none;
  border-top: 1px solid var(--hairline);
}
.toc-list li:first-child a { border-top: 0; }
.toc-list a::before {
  content: counter(toc, upper-roman);
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 1.5rem;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  color: var(--plum-bright);
}
.toc-list a:hover, .toc-list a:focus-visible { color: var(--text); }
.toc-list a:hover::before { color: var(--sage); }

/* Body text */
.article-body > p, .article-body li { color: var(--text-soft); }
.article-body > p:first-child, .lede { color: var(--text); }
.lede { font-size: var(--step-1); line-height: 1.6; }
.article-body > .lede::first-letter {
  float: left;
  margin: 0.1em 0.14em 0 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 3.4em;
  line-height: 0.8;
  color: var(--sage);
  text-shadow: 0 0 24px var(--glow-plum);
}
.article h2 {
  margin: var(--space-4) 0 var(--space-2);
  padding-top: var(--space-3);
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.85rem);
  color: var(--text);
  /* two fine rules above each section, sage over lavender */
  background:
    linear-gradient(to right, var(--line), transparent 60%) no-repeat 0 0 / 100% 1px,
    linear-gradient(to right, var(--line-lavender), transparent 45%) no-repeat 0 4px / 100% 1px;
}
.article h3 {
  margin: var(--space-3) 0 var(--space-1);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--sage);
}
.article p, .article li { hyphens: manual; }
.article-body ul, .article-body ol { padding-left: 1.5rem; }
.article-body li { margin-bottom: var(--space-1); }
.article-body ol li::marker { font-family: var(--font-heading); color: var(--plum-bright); }
.article-body ul li::marker { content: "\2726  "; font-size: 0.75em; color: var(--plum-bright); }
.article-body em { color: inherit; }
.article-body strong { color: var(--text); }
.article-body table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.article-body th, .article-body td { padding: 0.5rem; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.article-body th { font-family: var(--font-heading); font-weight: 500; color: var(--sage); }
.article-body .table-wrap, .article-body figure { max-width: 100%; overflow-x: auto; }

/* Safety line: soft and clearly visible, never hidden in a footnote */
.safety {
  position: relative;
  margin: var(--space-3) 0;
  padding: var(--space-2) var(--space-3) var(--space-2) 3.25rem;
  border: 1px solid var(--hairline-sage);
  border-radius: var(--r);
  background:
    radial-gradient(ellipse 50% 120% at 0% 50%, var(--glow-sage), transparent 70%),
    color-mix(in srgb, var(--panel) 35%, transparent);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
}
.article-body > p.safety { color: var(--text); }
.safety::before {
  content: "\2726";
  position: absolute;
  left: 1.25rem;
  top: 1.05rem;
  font-size: 1rem;
  color: var(--sage);
}
.safety strong { color: var(--sage); font-weight: 600; }

/* "Pairs well with" / "Plant of the page": a soft-topped arched panel */
.pairing {
  position: relative;
  margin: var(--space-4) 0;
  padding: var(--space-4) var(--space-3) var(--space-3);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  background:
    radial-gradient(ellipse 80% 45% at 50% 0%, var(--glow-plum), transparent 75%),
    linear-gradient(to bottom, color-mix(in srgb, var(--panel) 85%, transparent), var(--panel-soft));
  box-shadow: 0 30px 70px -40px var(--glow-plum);
  font-size: 1rem;
  line-height: 1.6;
  text-align: center;
}
.pairing::before {
  content: "";
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  margin: -0.75rem auto var(--space-2);
  border-radius: 50%;
  box-shadow: inset 0.3rem -0.12rem 0 0 var(--sage);
  transform: rotate(-20deg);
}
.pairing-title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--step-1);
  line-height: 1.25;
  color: var(--text);
}
.pairing dl { margin: var(--space-3) 0 var(--space-2); text-align: left; }
.pairing dt {
  margin-top: var(--space-1);
  padding-top: var(--space-1);
  border-top: 1px solid var(--hairline);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sage);
}
.pairing dt:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.pairing dd { margin: 0.15rem 0 0; color: var(--text); }
.pairing p { margin: 0; text-align: left; font-style: italic; color: var(--text-soft); }
.pairing p.pairing-title { text-align: center; font-style: normal; color: var(--text); }
.pairing p + p { margin-top: var(--space-1); }

/* Related guides follow the article at full width. */
.related { padding-top: var(--space-4); }
.related > h2 { margin: 0; }

/* Related guides: always five arched cards (build.py RELATED_COUNT).
   Wide (70rem+): five equal columns filling the content width, centred.
   Narrower: one row that scrolls sideways with snap points, about 1.4 cards
   showing on a phone, so there is never an orphan gap. Either way the cards
   share subgrid rows, so arches, titles and descriptions line up. */
.related .guide-list {
  grid-auto-flow: column;
  grid-auto-columns: min(15rem, 68%);
  grid-template-columns: none;
  grid-template-rows: auto auto auto;
  gap: 0 var(--space-3);
  margin-left: calc(-1 * var(--gutter));
  margin-right: calc(-1 * var(--gutter));
  padding: 10px var(--gutter) var(--space-2);   /* room for the focus ring */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: thin;
}
.related .guide-card {
  display: grid;
  grid-row: span 3;
  grid-template-rows: subgrid;
  scroll-snap-align: start;
}
.related .guide-card-body { display: contents; }
.related .guide-card h3 { margin: var(--space-3) var(--space-1) var(--space-1); text-align: center; }
.related .guide-card p { margin: 0 var(--space-1); text-align: center; }
@media (min-width: 70rem) {
  .related .guide-list {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-left: 0;
    margin-right: 0;
    padding: 10px 0 0;
    overflow: visible;
    scroll-snap-type: none;
  }
}

/* Candle colour table (candle-magic guide). Wide: a ruled table. Narrow: each
   row becomes a small card, labelled from the cells' data-label. Swatches are
   decorative (aria-hidden); the colour name is always written beside them. */
.colour-table { width: 100%; margin: var(--space-3) 0; border-collapse: collapse; font-size: 1rem; line-height: 1.45; }
.colour-table caption {
  caption-side: top;
  padding-bottom: var(--space-1);
  text-align: left;
  font-style: italic;
  color: var(--text-soft);
}
.colour-table th, .colour-table td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; color: var(--text-soft); }
.colour-table thead th {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sage);
  border-bottom-color: var(--hairline-strong);
}
.colour-table tbody th { font-family: var(--font-heading); font-weight: 500; color: var(--text); white-space: nowrap; }
.swatch {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.55rem;
  border-radius: 50%;
  vertical-align: -0.05em;
  box-shadow: 0 0 0 1px var(--hairline-strong);
}
.swatch-white { background: var(--candle-white); }
.swatch-black { background: var(--candle-black); }
.swatch-red { background: var(--candle-red); }
.swatch-pink { background: var(--candle-pink); }
.swatch-orange { background: var(--candle-orange); }
.swatch-yellow { background: var(--candle-yellow); }
.swatch-green { background: var(--candle-green); }
.swatch-blue { background: var(--candle-blue); }
.swatch-purple { background: var(--candle-purple); }
.swatch-brown { background: var(--candle-brown); }
.swatch-silver { background: var(--candle-silver); }
.swatch-gold { background: var(--candle-gold); }
@media (max-width: 40rem) {
  .colour-table, .colour-table tbody, .colour-table tr, .colour-table th, .colour-table td { display: block; }
  .colour-table caption { display: block; }
  .colour-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .colour-table tr { padding: var(--space-1) 0; border-bottom: 1px solid var(--hairline); }
  .colour-table th, .colour-table td { padding: 0.15rem 0; border: 0; }
  .colour-table tbody th { padding-bottom: 0.3rem; }
  .colour-table td[data-label]::before {
    content: attr(data-label) ": ";
    font-family: var(--font-ui);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--sage);
  }
}

/* A safety line inside a pairing panel reads plainly (never italic or muted)
   and sits more compactly than in the body. */
.pairing p.safety {
  margin: var(--space-2) 0 0;
  padding: var(--space-1) var(--space-2) var(--space-1) 2.4rem;
  font-style: normal;
  font-size: 0.95rem;
  color: var(--text);
}
.pairing p.safety::before { left: 0.9rem; top: 0.6rem; }
