/* ============================================================
   The Good Board — print stylesheet
   A book-register layout for printing and PDF export.
   Designed as its own artifact; does not mirror the site CSS.
   ============================================================ */

/* --------------------------------------------------------------
   Page setup
   -------------------------------------------------------------- */
@page {
  size: A4;
  margin: 25mm 25mm 30mm 28mm;  /* top outer bottom inner (gutter) */

  @top-center {
    content: string(running-title);
    font-family: "Bradford LL", "Iowan Old Style", "Palatino", serif;
    font-size: 9pt;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    letter-spacing: 0.1em;
    color: #6B6762;
    padding-bottom: 6mm;
  }

  @bottom-center {
    content: counter(page);
    font-family: "Bradford LL", "Iowan Old Style", "Palatino", serif;
    font-size: 9.5pt;
    font-variant-numeric: oldstyle-nums;
    color: #14110F;
    padding-top: 6mm;
  }
}

/* Title page convention: no running head, no page number on p. 1 */
@page :first {
  @top-center    { content: ""; }
  @bottom-center { content: ""; }
}

/* --------------------------------------------------------------
   Print media rules
   -------------------------------------------------------------- */
@media print {

  html, body {
    background: #FFFFFF;
    color: #14110F;
    font-family: "Bradford LL", "Iowan Old Style", "Palatino Linotype",
                 Palatino, "Baskerville", "Hoefler Text", Garamond, serif;
    font-size: 11pt;
    line-height: 1.38;
    font-feature-settings: "kern" 1, "liga" 1, "clig" 1, "dlig" 0;
    font-variant-numeric: oldstyle-nums proportional-nums;
    hyphens: auto;
    -webkit-hyphens: auto;
    hyphenate-limit-chars: 7 3 3;
    text-align: justify;
    text-align-last: left;
    word-spacing: 0.015em;
    hanging-punctuation: first last;
  }

  /* Hide web-only affordances */
  .site-header,
  .site-footer,
  .lang-switcher,
  .breadcrumb,
  .feed-url,
  .reader-grid,
  .reader-card,
  .copy-label {
    display: none !important;
  }

  main { max-width: none; padding: 0; margin: 0; }

  /* --------------------------------------------------------------
     Article opening — display treatment
     -------------------------------------------------------------- */
  .article-header {
    margin-bottom: 18pt;
    page-break-after: avoid;
    break-after: avoid;
  }

  .eyebrow {
    display: block;
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 9.5pt;
    letter-spacing: 0.12em;
    color: #6B6762;
    text-transform: none;       /* reset the site's uppercase */
    font-weight: 400;
    margin-bottom: 10pt;
  }

  h1 {
    string-set: running-title content();
    font-family: inherit;
    font-size: 26pt;
    line-height: 1.08;
    font-weight: 400;
    letter-spacing: -0.016em;
    margin: 0 0 12pt 0;
    text-wrap: balance;
    orphans: 3; widows: 3;
    page-break-after: avoid;
    break-after: avoid;
    color: #14110F;
    text-align: left;
  }

  .scope-line {
    font-style: italic;
    font-size: 13pt;
    line-height: 1.32;
    color: #14110F;
    max-width: none;
    margin: 0 0 16pt 0;
    text-align: left;
    text-wrap: balance;
  }

  /* Meta row — small caps, ruled above and below */
  .article-meta {
    border-top: 0.5pt solid #14110F;
    border-bottom: 0.5pt solid #D6D2CA;
    padding: 5pt 0 5pt 0;
    font-family: inherit;
    font-size: 9.5pt;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-variant-numeric: tabular-nums lining-nums;
    letter-spacing: 0.05em;
    color: #14110F;
    text-transform: none;
    margin-bottom: 20pt;
    display: flex;
    flex-wrap: wrap;
    gap: 4pt 18pt;
    text-align: left;
  }
  .article-meta dt { color: #6B6762; font-weight: 400; }
  .article-meta dd { margin-left: 0.4em; color: #14110F; }
  .article-meta .meta-item { display: flex; gap: 0.5ch; align-items: baseline; }

  /* --------------------------------------------------------------
     Body headings
     -------------------------------------------------------------- */
  h2 {
    font-family: inherit;
    font-size: 14pt;
    line-height: 1.24;
    font-weight: 400;
    margin: 22pt 0 6pt 0;
    letter-spacing: -0.006em;
    page-break-after: avoid;
    break-after: avoid;
    orphans: 3; widows: 3;
    text-wrap: balance;
  }

  h3 {
    font-family: inherit;
    font-size: 11.5pt;
    line-height: 1.25;
    font-weight: 400;
    font-style: italic;
    margin: 14pt 0 4pt 0;
    page-break-after: avoid;
    break-after: avoid;
    text-align: left;
  }

  /* --------------------------------------------------------------
     Paragraphs — first-line-indented book style, no space between
     -------------------------------------------------------------- */
  p {
    margin: 0;
    text-indent: 1.2em;
    orphans: 2; widows: 2;
  }

  /* First paragraph flush-left after structural elements */
  :is(h1, h2, h3) + p,
  .article-meta + p,
  .caveat + p,
  blockquote + p,
  .prompt-body + p,
  ol + p,
  ul + p,
  dl + p,
  .lede,
  section.prose > p:first-of-type,
  p:first-child {
    text-indent: 0;
  }

  /* Lede — first line in small caps (book tradition) */
  .lede::first-line {
    font-variant-caps: small-caps;
    letter-spacing: 0.04em;
  }

  /* --------------------------------------------------------------
     Inline
     -------------------------------------------------------------- */
  em, i, cite { font-style: italic; }
  strong, b { font-weight: inherit; font-style: italic; }
  small { font-size: 9.5pt; color: #6B6762; }

  .cite {
    font-variant-caps: small-caps;
    font-variant-numeric: tabular-nums lining-nums;
    letter-spacing: 0.02em;
  }

  /* --------------------------------------------------------------
     Links — subtle rule; external URL appended quietly
     -------------------------------------------------------------- */
  a {
    color: #14110F;
    text-decoration: none;
    border-bottom: 0.4pt solid #8A8680;
  }

  /* Append URL after external links only */
  a[href^="http"]::after,
  a[href^="https"]::after {
    content: "\00A0\27E8" attr(href) "\27E9";     /* nbsp ⟨URL⟩ */
    font-size: 8.5pt;
    color: #6B6762;
    border-bottom: none;
    word-break: break-all;
    font-variant-numeric: lining-nums tabular-nums;
    font-style: normal;
    letter-spacing: 0;
  }
  a[href^="#"]::after,
  a[href^="mailto:"]::after,
  a[href^="tel:"]::after {
    content: "";
  }
  /* Suppress URL leakage in navigation contexts */
  .toc a::after,
  .article-header a::after,
  .article-meta a::after,
  h1 a::after, h2 a::after, h3 a::after,
  .end-ornament a::after,
  .frontispiece .attribution a::after {
    content: "" !important;
  }

  /* --------------------------------------------------------------
     Blockquote — hanging rule and italic
     -------------------------------------------------------------- */
  blockquote {
    font-style: italic;
    margin: 12pt 1em 12pt 1em;
    padding-left: 12pt;
    border-left: 0.5pt solid #14110F;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  blockquote p {
    text-indent: 0;
    margin: 0 0 4pt 0;
  }
  blockquote p:last-child { margin-bottom: 0; }

  /* --------------------------------------------------------------
     Lists
     -------------------------------------------------------------- */
  ul, ol {
    margin: 6pt 0 10pt 1.3em;
    padding: 0;
  }
  li {
    margin-bottom: 3pt;
    page-break-inside: avoid;
    break-inside: avoid;
    orphans: 2; widows: 2;
  }

  /* --------------------------------------------------------------
     TOC (landing, reference, commentary indexes)
     -------------------------------------------------------------- */
  .toc {
    margin: 16pt 0;
    padding: 10pt 0 0 0;
    border-top: 0.5pt solid #14110F;
  }
  .toc h2 {
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 10pt;
    letter-spacing: 0.12em;
    color: #6B6762;
    text-transform: none;
    margin: 0 0 10pt 0;
    font-weight: 400;
    border: none;
  }
  .toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: toc-item;
  }
  .toc li {
    display: block;
    padding: 7pt 0;
    border-bottom: 0.25pt solid #D6D2CA;
    counter-increment: toc-item;
    break-inside: avoid;
  }
  .toc li:last-child { border-bottom: none; }
  .toc .num {
    font-family: inherit;
    font-variant-numeric: tabular-nums lining-nums;
    font-size: 9pt;
    color: #6B6762;
    margin-right: 0.6em;
    letter-spacing: 0.02em;
    min-width: auto;
  }
  .toc .title {
    flex: none;
    font-size: 11pt;
    line-height: 1.3;
    display: inline;
  }
  .toc .title a {
    border-bottom: none;
    color: #14110F;
  }
  .toc .scope {
    display: block;
    font-style: italic;
    font-size: 9.5pt;
    color: #6B6762;
    margin-top: 3pt;
    max-width: none;
    line-height: 1.3;
  }
  .toc .status {
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 8.5pt;
    letter-spacing: 0.08em;
    color: #6B6762;
    float: right;
    text-transform: none;
    font-weight: 400;
  }

  /* --------------------------------------------------------------
     Glossary (entries as definitions)
     -------------------------------------------------------------- */
  dl.glossary {
    margin: 12pt 0;
  }
  dl.glossary .entry {
    padding: 8pt 0;
    border-bottom: 0.25pt solid #D6D2CA;
    page-break-inside: avoid;
    break-inside: avoid;
    margin: 0;
  }
  dl.glossary .entry:last-child { border-bottom: none; }
  dl.glossary .term {
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 12pt;
    letter-spacing: 0.04em;
    margin-bottom: 2pt;
    font-weight: 400;
    color: #14110F;
  }
  dl.glossary .gloss {
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 9.5pt;
    letter-spacing: 0.08em;
    margin-left: 0.5em;
    color: #6B6762;
    text-transform: none;
    font-weight: 400;
  }
  dl.glossary .definition {
    font-size: 11pt;
    line-height: 1.4;
    margin: 0;
    text-indent: 0;
  }
  dl.glossary .see-also {
    font-size: 9.5pt;
    color: #6B6762;
    font-style: italic;
    margin-top: 3pt;
    text-indent: 0;
  }

  /* --------------------------------------------------------------
     Prompts
     -------------------------------------------------------------- */
  .prompt-meta {
    display: block;
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 9.5pt;
    letter-spacing: 0.06em;
    color: #6B6762;
    text-transform: none;
    margin-bottom: 12pt;
  }
  .prompt-meta span + span::before {
    content: "   ·   ";
    color: #D6D2CA;
  }

  /* Prompt body: framed by thin rules above and below, no background */
  .prompt-body {
    font-family: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 9pt;
    line-height: 1.48;
    margin: 14pt 0;
    padding: 9pt 0;
    border-top: 0.5pt solid #14110F;
    border-bottom: 0.5pt solid #14110F;
    border-left: none;
    background: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    page-break-inside: avoid;
    break-inside: avoid;
    text-align: left;
    text-indent: 0;
    hyphens: none;
    font-variant-ligatures: none;
  }
  .prompt-body * { text-indent: 0; }

  /* --------------------------------------------------------------
     Caveat — italic label, hanging rule
     -------------------------------------------------------------- */
  .caveat {
    margin: 14pt 0;
    padding: 0 0 0 12pt;
    border: none;
    border-left: 0.5pt solid #6B6762;
    background: none;
    font-size: 10pt;
    line-height: 1.35;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .caveat .label {
    display: block;
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 9.5pt;
    letter-spacing: 0.08em;
    color: #14110F;
    text-transform: none;
    font-weight: 400;
    font-style: normal;
    margin-bottom: 3pt;
  }
  .caveat p { text-indent: 0; margin-bottom: 3pt; }
  .caveat p:last-child { margin-bottom: 0; }

  /* --------------------------------------------------------------
     Frontispiece (landing) — for PDF of landing page
     -------------------------------------------------------------- */
  .frontispiece {
    padding: 0;
    margin: 0 0 20pt 0;
    page-break-after: avoid;
    break-after: avoid;
    text-align: left;
  }
  .frontispiece .work-title {
    font-family: inherit;
    font-size: 40pt;
    line-height: 1.02;
    letter-spacing: -0.028em;
    font-weight: 400;
    margin: 0 0 10pt 0;
    color: #14110F;
    string-set: running-title content();
  }
  .frontispiece .work-subtitle {
    font-style: italic;
    font-size: 14pt;
    line-height: 1.3;
    color: #14110F;
    margin: 0 0 14pt 0;
    max-width: none;
  }
  .frontispiece .work-framing {
    font-size: 10.5pt;
    line-height: 1.42;
    max-width: none;
    margin: 0 0 16pt 0;
    text-indent: 0;
  }
  .frontispiece .attribution {
    font-family: inherit;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    font-size: 9.5pt;
    letter-spacing: 0.1em;
    color: #6B6762;
    text-transform: none;
  }

  /* --------------------------------------------------------------
     End-ornament and colophon
     -------------------------------------------------------------- */
  .end-ornament {
    text-align: center;
    margin: 20pt 0 12pt 0;
    color: #14110F;
    font-size: 11pt;
    letter-spacing: 1em;
    padding-left: 1em;
  }

  /* Colophon at the end of the document — small caps attribution */
  main::after {
    content: "Jonas Hertner  ·  thegoodboard.ch";
    display: block;
    text-align: center;
    margin: 24pt auto 0;
    padding-top: 8pt;
    width: 28%;
    border-top: 0.4pt solid #8A8680;
    font-family: "Bradford LL", "Iowan Old Style", serif;
    font-size: 8.5pt;
    font-variant-caps: small-caps;
    font-variant-ligatures: none;
    letter-spacing: 0.08em;
    color: #6B6762;
  }

  /* --------------------------------------------------------------
     Miscellaneous
     -------------------------------------------------------------- */
  img, figure {
    page-break-inside: avoid;
    break-inside: avoid;
    max-width: 100%;
  }

  hr, .divider {
    border: none;
    border-top: 0.25pt solid #6B6762;
    width: 25%;
    margin: 16pt auto;
    padding: 0;
    color: transparent;
    letter-spacing: 0;
  }

  .empty-state {
    font-style: italic;
    color: #6B6762;
    padding: 14pt 0;
    border: none;
    border-top: 0.25pt solid #D6D2CA;
    border-bottom: 0.25pt solid #D6D2CA;
    text-align: center;
    text-indent: 0;
  }

  /* Kill any remaining web-y visual residue */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }
}
