/* know-know.org – Pelican theme. Visual language follows the former WordPress
   "Fewer" setup: light grey paper, black type in Epilogue Light, hairlines. */

@font-face { font-family: Epilogue; font-style: normal; font-weight: 300; font-display: swap; src: url(../fonts/epilogue_300.ttf) format("truetype"); }
@font-face { font-family: Epilogue; font-style: italic; font-weight: 300; font-display: swap; src: url(../fonts/epilogue_300italic.ttf) format("truetype"); }
@font-face { font-family: Epilogue; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/epilogue_500.ttf) format("truetype"); }
@font-face { font-family: Epilogue; font-style: italic; font-weight: 500; font-display: swap; src: url(../fonts/epilogue_500italic.ttf) format("truetype"); }

:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #000000;
  --muted: #6b6b6b;
  --line: #1a1a1a;
  --hairline: #d9d9d9;
  --accent: #1f5fa8;          /* blue of the logo arrow */
  --accent-strong: #0693e3;
  --callout: #8ed1fc;
  --gutter: clamp(16px, 2vw, 24px);
  --content: 640px;
  --fs-body: clamp(1rem, 0.93rem + 0.35vw, 1.2rem);
  --fs-small: clamp(0.85rem, 0.82rem + 0.15vw, 0.95rem);
  --fs-h2: clamp(1.5rem, 1.35rem + 0.6vw, 2rem);
  --fs-title: clamp(2.2rem, 1.8rem + 1.6vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Epilogue, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img, video { max-width: 100%; height: auto; }
iframe { max-width: 100%; }
.prose iframe.newsletter { display: block; width: 100%; max-width: 540px; height: 540px; }
strong, b, th { font-weight: 500; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5em 1em; z-index: 10; }
.skip-link:focus { left: var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--content)) minmax(0, .55fr);
  column-gap: clamp(24px, 4vw, 64px);
  align-items: center;
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--line);
  /* Stays at the top while scrolling */
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
}
/* Anchor targets (e.g. /news/#entry) must not end up under the sticky header */
html { scroll-padding-top: 120px; }
.logo { display: inline-block; line-height: 0; justify-self: start; }
.logo img { width: 70px; height: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .2em 1.25em; }
.site-nav a { text-decoration: none; font-size: clamp(1rem, .95rem + .3vw, 1.2rem); }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 1px; }
.nav-toggle, .nav-toggle-label { display: none; }

/* ---------- Main layout: title left, content in the middle column ---------- */
.site-main { flex: 1; padding: clamp(40px, 7vw, 100px) var(--gutter) clamp(60px, 8vw, 120px); }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--content)) minmax(0, .55fr);
  column-gap: clamp(24px, 4vw, 64px);
  align-items: start;
}
.page-title {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: -0.01em;
  max-width: 9em;
}
.section-label { font-size: var(--fs-h2); }
.section-label a { text-decoration: none; }
.prose { min-width: 0; }
.layout-wide .prose-wide { grid-column: 2 / 4; }

/* ---------- Typography inside content ---------- */
.prose > :first-child, .prose > article:first-child > .meta:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose figure, .prose table { margin: 0 0 1.1em; }
.prose h2, .article-title { font-size: var(--fs-h2); font-weight: 300; line-height: 1.25; margin: 1.6em 0 .6em; }
.article-title { margin-top: .1em; font-size: clamp(1.7rem, 1.45rem + 1vw, 2.4rem); }
.prose h3 { font-size: 1.3em; font-weight: 300; margin: 1.5em 0 .5em; }
.prose h4 { font-size: 1.1em; font-weight: 500; margin: 1.4em 0 .4em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .15em 0; }
.prose blockquote { margin-left: 0; padding-left: 1.2em; border-left: 2px solid var(--line); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--hairline); margin: 2em 0; }
.prose img { display: block; }
.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption { font-size: var(--fs-small); color: var(--muted); margin-top: .4em; }
.prose table { border-collapse: collapse; width: 100%; }
.prose iframe { border: 0; }
.prose video { width: 100%; }
.meta, .small, p.small { font-size: var(--fs-small); }
.meta { margin: 0 0 .3em; color: var(--muted); }
.callout { background: var(--callout); padding: 1em 1.25em; }
.callout a { font-weight: 500; }
.large { font-size: 1.3em; line-height: 1.4; }
.accent { color: var(--accent-strong); }
.back { margin-top: 2.5em; font-size: var(--fs-small); }

/* WordPress "media & text" block, kept for team / news */
.media-text { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5em; align-items: center; margin: 0 0 1.5em; }
.media-text > figure { margin: 0; }
.media-text > div > :last-child { margin-bottom: 0; }
.media-text.media-right > figure { order: 2; }
.media-text.media-right { grid-template-columns: 2.6fr 1fr; }

/* Gallery (parents page) */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 1.5em 0; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 900 / 490; object-fit: cover; transition: transform .15s ease; }
.gallery a:hover img { transform: scale(1.02); }

/* File block (home page downloads) */
.file-download { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6em 1em; padding: .8em 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); margin: 0 !important; }
.file-download + .file-download { border-top: 0; }
.button, .file-btn {
  display: inline-flex; align-items: baseline; gap: .45em;
  padding: .45em .9em; border: 1px solid var(--line); background: transparent;
  text-decoration: none; font-size: var(--fs-small); font-weight: 500; line-height: 1.2; white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.button:hover, .file-btn:hover { background: var(--text); color: var(--bg); }
.file-btn small { font-weight: 300; opacity: .7; font-size: .85em; }

/* ---------- News / blog ---------- */
.news-item { padding-bottom: 1.6em; margin-bottom: 1.6em; border-bottom: 1px solid var(--hairline); }
.news-item:last-of-type { border-bottom: 0; }
.news-item h2 { margin-top: .1em; }
.news-item h2 a, .post-list h2 a { text-decoration: none; }
.news-item h2 a:hover, .post-list h2 a:hover { text-decoration: underline; }
.post-list { list-style: none; padding: 0 !important; margin: 0; }
.post-list > li { display: grid; grid-template-columns: 140px 1fr; gap: 1.4em; padding: 0 0 1.8em; margin: 0 0 1.8em !important; border-bottom: 1px solid var(--hairline); }
.post-list > li:last-child { border-bottom: 0; }
.post-list > li:not(:has(.post-thumb)) { grid-template-columns: 1fr; }
.post-thumb img { width: 140px; aspect-ratio: 1; object-fit: cover; filter: grayscale(.2); }
.post-list h2 { margin: 0 0 .4em; font-size: 1.5em; }
.excerpt { margin-bottom: .5em !important; }
.more { font-size: var(--fs-small); }
.hero { margin: 0 0 1.5em; }
.latest { margin-top: 3em; padding-top: 1.5em; border-top: 1px solid var(--line); }
.latest h2 { margin-top: 0; }
.latest ul { list-style: none; padding: 0; }
.latest li { display: grid; grid-template-columns: 6.5em 1fr; gap: .8em; padding: .35em 0; }
.latest time { color: var(--muted); font-size: var(--fs-small); padding-top: .2em; }
.feed-link { font-size: var(--fs-small); color: var(--muted); }

/* ---------- Document library ---------- */
.doclib { margin-top: 2.5em; }
.doclib h2 { margin-top: 0; }
.doclib-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; margin-bottom: 1.2em; }
.doclib-tools[hidden] { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: var(--fs-small); font-weight: 300; color: var(--text);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: .35em .95em; cursor: pointer; transition: background .12s ease, color .12s ease;
}
.chip .count { opacity: .55; margin-left: .2em; }
.chip:hover { background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.search input {
  font: inherit; font-size: var(--fs-small); width: min(280px, 100%);
  padding: .45em .8em; border: 1px solid var(--line); border-radius: 0; background: var(--surface); color: var(--text);
}
.doclib-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.doclib-table thead th {
  text-align: left; font-weight: 500; padding: .6em .8em; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.doclib-table th button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35em;
}
.doclib-table th button::after { content: "↕"; opacity: .3; font-size: .9em; }
.doclib-table th[aria-sort="ascending"] button::after { content: "↑"; opacity: .9; }
.doclib-table th[aria-sort="descending"] button::after { content: "↓"; opacity: .9; }
.doclib-table td { padding: 1em .8em; vertical-align: top; border-bottom: 1px solid var(--hairline); }
.doclib-table tbody tr { transition: background .12s ease; }
.doclib-table tbody tr:hover { background: rgba(255,255,255,.7); }
.doclib-table tr[hidden] { display: none; }
.col-thumb { width: 88px; padding-left: 0 !important; }
.col-thumb img { display: block; width: 72px; height: 72px; object-fit: cover; border: 1px solid var(--hairline); background: var(--surface); }
.col-date { white-space: nowrap; color: var(--muted); }
.doc-title { font-size: 1.15em; font-weight: 500; text-decoration: none; line-height: 1.3; }
.doc-title:hover { text-decoration: underline; }
.doc-summary { margin: .35em 0 0 !important; line-height: 1.5; }
.tag { display: inline-block; font-size: .9em; padding: .1em .65em; border: 1px solid var(--hairline); border-radius: 999px; text-decoration: none; white-space: nowrap; background: var(--surface); }
.tag:hover { border-color: var(--line); color: var(--text); }
.doclib-table .col-date, .doclib-table .col-cat { width: 1%; }
.doclib-table td.col-files { width: 1%; white-space: nowrap; }
.col-files .file-btn { display: flex; justify-content: space-between; margin: 0 0 .4em; }
.doc-files .file-btn { margin: 0 .3em .4em 0; }
.doclib-status { font-size: var(--fs-small); color: var(--muted); margin-top: 1em; min-height: 1.6em; }
.doclib-footnote { margin-top: 2em; }

/* Document detail page */
.doc-head { display: grid; grid-template-columns: 200px 1fr; gap: 1.6em; align-items: start; margin: 1.2em 0 2em; }
.doc-cover img { width: 200px; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--hairline); background: var(--surface); }
.doc-cover:hover img { border-color: var(--line); }
.doc-meta { display: grid; grid-template-columns: max-content 1fr; gap: .5em 1.2em; margin: 0; font-size: var(--fs-small); }
.doc-meta dt { font-weight: 500; }
.doc-meta dd { margin: 0; }
.pdf-preview { margin: 2em 0; border-top: 1px solid var(--hairline); padding-top: 1em; }
.pdf-preview summary { cursor: pointer; font-size: var(--fs-small); font-weight: 500; }
.pdf-frame iframe { width: 100%; height: 75vh; border: 1px solid var(--hairline); margin-top: 1em; background: var(--surface); }

/* ---------- Footer ---------- */
.site-footer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1em var(--gutter);
  padding: 32px var(--gutter) 48px; border-top: 1px solid var(--line); font-size: var(--fs-small);
}
.site-footer p { margin: 0 0 .9em; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout-wide { grid-template-columns: 1fr; row-gap: 1.2em; }
  .layout-wide .prose-wide { grid-column: auto; }
}
@media (max-width: 860px) {
  .site-header { grid-template-columns: auto 1fr; }
  .nav-toggle-label {
    display: block; justify-self: end; width: 44px; height: 44px; cursor: pointer; position: relative;
  }
  .nav-toggle-label span, .nav-toggle-label span::before, .nav-toggle-label span::after {
    position: absolute; left: 10px; right: 10px; height: 1px; background: var(--text); content: ""; transition: transform .2s ease, opacity .2s ease;
  }
  .nav-toggle-label span { top: 22px; }
  .nav-toggle-label span::before { left: 0; right: 0; top: -7px; }
  .nav-toggle-label span::after { left: 0; right: 0; top: 7px; }
  .nav-toggle:checked + .nav-toggle-label span { background: transparent; }
  .nav-toggle:checked + .nav-toggle-label span::before { transform: translateY(7px) rotate(45deg); }
  .nav-toggle:checked + .nav-toggle-label span::after { transform: translateY(-7px) rotate(-45deg); }
  .site-nav { grid-column: 1 / -1; display: none; padding-top: 12px; max-height: calc(100vh - 90px); overflow-y: auto; }
  html { scroll-padding-top: 100px; }
  .nav-toggle:checked ~ .site-nav { display: block; }
  .site-nav ul { flex-direction: column; gap: .2em; }
  .site-nav a { display: block; padding: .35em 0; font-size: 1.2rem; }
  .logo img { width: 54px; }
  .prose iframe.newsletter { height: 620px; }

  .layout { grid-template-columns: 1fr; row-gap: 1.2em; }
  .page-title { max-width: none; }
  .site-footer { grid-template-columns: 1fr; }

  .media-text, .media-text.media-right { grid-template-columns: 1fr; }
  .media-text.media-right > figure { order: 0; max-width: 220px; }

  /* Document table becomes a list of cards */
  .doclib-table thead { display: none; }
  .doclib-table, .doclib-table tbody { display: block; }
  .doclib-table tbody tr {
    display: grid; grid-template-columns: 64px 1fr; column-gap: 14px; row-gap: .45em;
    padding: 1.1em 0; border-bottom: 1px solid var(--hairline);
  }
  .doclib-table tbody tr[hidden] { display: none; }
  .doclib-table td { display: block; padding: 0; border: 0; }
  .doclib-table .col-thumb { grid-row: 1 / span 4; width: auto; }
  .col-thumb img { width: 64px; height: 64px; }
  .doclib-table .col-date { order: -1; }
  .doclib-table td.col-files, .doclib-table .col-date, .doclib-table .col-cat { width: auto; }
  .doclib-table td.col-files { white-space: normal; display: flex; flex-wrap: wrap; gap: 6px; }
  .col-files .file-btn { display: inline-flex; margin: 0; }
  .doc-head { grid-template-columns: 1fr; }
  .doc-cover img { width: 160px; }
  .post-list > li { grid-template-columns: 1fr; gap: .8em; }
  .post-thumb img { width: 100%; aspect-ratio: 16 / 9; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .site-header, .site-footer, .doclib-tools, .pdf-preview { display: none; }
  body { background: #fff; }
}
