/* ==========================================================================
   Ivory Journal — editorial magazine theme for Sage Puppies
   Ivory paper, black ink, a single burgundy accent. System fonts only.
   ========================================================================== */

:root {
  --paper: #f6f1e7;
  --paper-deep: #ede5d4;
  --ink: #151412;
  --ink-soft: #3f3a33;
  --ink-mute: #6a6257;
  --rule: #151412;
  --rule-soft: #cfc4ae;
  --accent: #7a1f2b;
  --accent-ink: #5e1520;
  --night: #0f0e0d;
  --night-text: #ede6d6;
  --night-mute: #b9b0a0;
  --night-accent: #e8b9c0;

  --display: Didot, "Bodoni 72", "Bodoni MT", "Bodoni 72 Oldstyle", "Big Caslon", Georgia, "Times New Roman", serif;
  --text: Georgia, "Iowan Old Style", Charter, "Palatino Linotype", "Book Antiqua", Cambria, serif;
  --label: "Gill Sans", "Gill Sans MT", Optima, "Trebuchet MS", "Segoe UI", sans-serif;

  --measure: 66ch;
  --gutter: clamp(1.1rem, 4vw, 3rem);
  --wide: 78rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.03rem, 0.98rem + 0.25vw, 1.15rem);
  line-height: 1.68;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  counter-reset: chapter;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Masthead — black bar, gold logo left, small-caps nav with hairline dividers
   -------------------------------------------------------------------------- */
.masthead {
  background: var(--night);
  color: var(--night-text);
  border-bottom: 4px double var(--paper-deep);
}

.masthead-bar {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0.85rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 2rem;
}

.masthead-logo { display: inline-block; line-height: 0; flex: 0 0 auto; }
.masthead-logo img { height: 36px; width: auto; }
.masthead-logo:focus-visible { outline: 2px solid var(--night-accent); outline-offset: 4px; }

.masthead-nav { flex: 1 1 auto; min-width: 0; }
.masthead-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.masthead-nav li { flex: 0 0 auto; }
.masthead-nav li + li { border-left: 1px solid #4a453d; }
.masthead-nav a {
  display: block;
  padding: 0.35rem 0.95rem;
  color: var(--night-text);
  font-family: var(--label);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.masthead-nav li:last-child a { padding-right: 0; }
.masthead-nav a:hover { color: #fff; text-decoration: underline; text-underline-offset: 0.4em; }
.masthead-nav a[aria-current="page"] {
  color: var(--night-accent);
  text-decoration: underline;
  text-decoration-color: var(--night-accent);
  text-underline-offset: 0.4em;
}
.masthead-nav a:focus-visible { outline: 2px solid var(--night-accent); outline-offset: -2px; }

/* --------------------------------------------------------------------------
   Cover — kicker, towering Didone headline, double rule, image + standfirst
   -------------------------------------------------------------------------- */
.cover {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.5rem) var(--gutter) clamp(2rem, 4vw, 3.5rem);
}

.cover-kicker {
  margin: 0 0 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--label);
  font-size: 0.74rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.cover-kicker-sep { color: var(--accent); font-size: 1rem; letter-spacing: 0; }

.cover-title {
  margin: 0;
  padding-bottom: clamp(1rem, 2.5vw, 1.75rem);
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 1.4rem + 5.2vw, 6.4rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  color: var(--ink);
  border-bottom: 5px double var(--rule);
  text-wrap: balance;
}
.page-support .cover-title { font-size: clamp(2.2rem, 1.3rem + 3.8vw, 4.9rem); line-height: 1.04; }

.cover-grid {
  display: grid;
  gap: 1.75rem;
  padding-top: clamp(1.5rem, 3vw, 2.5rem);
}

.cover-media .hero-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--rule);
  padding: 6px;
  background: var(--paper);
}

/* standfirst: first intro paragraph as deck with drop cap, the rest as lede */
.standfirst p { margin: 0 0 1.1em; max-width: var(--measure); color: var(--ink-soft); }
.standfirst p:first-child {
  font-size: 1.14em;
  line-height: 1.6;
  color: var(--ink);
}
.standfirst p:first-child::first-letter {
  float: left;
  margin: 0.06em 0.1em 0 0;
  font-family: var(--display);
  font-size: 4.6em;
  line-height: 0.8;
  color: var(--accent);
}
.standfirst p:last-child { margin-bottom: 0; }

@media (min-width: 60em) {
  .cover-grid { grid-template-columns: minmax(0, 8fr) minmax(0, 4.2fr); gap: 0 2.5rem; align-items: start; }
  .standfirst {
    border-left: 1px solid var(--rule);
    padding-left: 2.25rem;
    font-size: 0.95rem;
  }
  .page-support .cover-grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}

/* --------------------------------------------------------------------------
   Folio — body sections
   -------------------------------------------------------------------------- */
.folio { padding-bottom: 1rem; }

.sec {
  counter-increment: chapter;
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(2.25rem, 5vw, 4rem) var(--gutter);
}

.sec-title {
  margin: 0 0 1.4rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.9rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.sec-title::before {
  content: counter(chapter, upper-roman);
  display: block;
  margin-bottom: 0.6rem;
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.sec-body p { margin: 0 0 1.05em; }
.sec-body p:last-child { margin-bottom: 0; }
.sec-body strong { font-weight: 700; color: var(--ink); }
.sec-body em { font-style: italic; }

.sec-body ul {
  list-style: none;
  margin: 0 0 1.2em;
  padding: 0.35em 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  break-inside: avoid;
}
.sec-body li {
  position: relative;
  padding: 0.6em 0 0.6em 1.6em;
  border-bottom: 1px solid var(--rule-soft);
}
.sec-body li:last-child { border-bottom: 0; }
.sec-body li::before {
  content: "\2767";
  position: absolute;
  left: 0;
  top: 0.62em;
  color: var(--accent);
  font-size: 0.85em;
}

/* stacked sections (index, fullbleed): headline row over rule-lined columns */
.sec--stack .sec-title {
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  max-width: 22ch;
}
.sec--stack .sec-body { max-width: var(--measure); }
.sec--stack .sec-body > p:first-child::first-letter {
  font-family: var(--display);
  font-size: 1.9em;
  line-height: 1;
  color: var(--accent);
}

@media (min-width: 48em) {
  .sec--stack {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: 0 3rem;
  }
  .sec--stack .sec-title { position: sticky; top: 1.5rem; align-self: start; }
}

@media (min-width: 80em) {
  .sec--stack { display: block; }
  .sec--stack .sec-title { position: static; max-width: none; font-size: clamp(2.4rem, 1.5rem + 1.6vw, 3.3rem); }
  .sec--stack .sec-body {
    max-width: none;
    column-count: 2;
    column-gap: 3.5rem;
    column-rule: 1px solid var(--rule-soft);
  }
  .sec--stack .sec-body p { orphans: 3; widows: 3; }
}

/* full-bleed photographs between chapters */
.bleed {
  margin: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 8px 0;
  background: var(--paper-deep);
}
.bleed .sec-img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
@media (min-width: 48em) {
  .bleed .sec-img { aspect-ratio: auto; height: clamp(22rem, 52vw, 44rem); }
}

/* support pages: a single reading column with centred chapter heads */
.sec--plain {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  padding-top: clamp(2rem, 4vw, 3rem);
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
}
.sec--plain .sec-title { text-align: center; }
.sec--plain .sec-title::after {
  content: "";
  display: block;
  width: 3.5rem;
  margin: 1.2rem auto 0;
  border-top: 3px double var(--rule);
}
.sec--plain + .sec--plain { border-top: 1px solid var(--rule-soft); }
.page-support .folio {
  border-top: 1px solid var(--rule);
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
}

.endmark {
  margin: 1.5rem auto 3.5rem;
  text-align: center;
  color: var(--accent);
  font-size: 1.4rem;
}

/* --------------------------------------------------------------------------
   Colophon — the only place contact details appear
   -------------------------------------------------------------------------- */
.colophon {
  background: var(--night);
  color: var(--night-text);
  border-top: 4px double var(--paper-deep);
  font-size: 0.98rem;
}
.colophon-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) 2rem;
  display: grid;
  gap: 2rem;
}
.colophon-name {
  margin: 0 0 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #3a3631;
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1.1;
}
.colophon address { font-style: normal; line-height: 1.7; color: var(--night-mute); }
.colophon-phone { margin: 1rem 0 0; font-family: var(--label); letter-spacing: 0.08em; }
.colophon-phone a { color: var(--night-accent); }
.colophon-phone a:hover { color: #fff; }
.colophon-phone a:focus-visible { outline-color: var(--night-accent); }
.colophon-map { border: 1px solid #3a3631; padding: 6px; }
.colophon-map iframe { display: block; filter: grayscale(0.35); }
.colophon-copy {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 1.1rem var(--gutter) 1.6rem;
  border-top: 1px solid #2a2724;
  font-family: var(--label);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--night-mute);
}

@media (min-width: 48em) {
  .colophon-inner { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 3rem; align-items: start; }
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */
@media (max-width: 40em) {
  .masthead-bar { justify-content: flex-start; }
  .masthead-logo img { height: 34px; }
  .masthead-nav { flex-basis: 100%; border-top: 1px solid #3a3631; padding-top: 0.45rem; }
  .masthead-nav ul { justify-content: flex-start; }
  .masthead-nav li:first-child a { padding-left: 0; }
  .masthead-nav a { padding: 0.35rem 0.8rem; font-size: 0.72rem; letter-spacing: 0.12em; }
  .cover-media .hero-img { padding: 4px; }
  .standfirst p:first-child::first-letter { font-size: 3.8em; }
}

@media (min-width: 100em) {
  :root { --wide: 86rem; }
  body { font-size: 1.18rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .masthead, .colophon-map { display: none; }
  body { background: #fff; }
}
