/* pkorunic.net — quiet "archive paper" theme. Single shared stylesheet.
   Light paper by default, dark ink variant; auto-matches the OS via
   prefers-color-scheme and can be overridden via [data-theme] on <html>.
   Olive accent is a nod to the original page's #999966 background. */

:root {
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 960px;
  --radius: 6px;

  color-scheme: light;
  --bg:        #f7f4ec;
  --surface:   #fffdf8;
  --border:    #e2dccb;
  --text:      #33332b;
  --text-dim:  #6c6a5c;
  --heading:   #1d1d17;
  --accent:    #6b6a2a;   /* olive */
  --header-bg: rgba(247, 244, 236, 0.85);
}

/* Dark palette — kept in sync between the manual override and the auto match. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #15150f;
  --surface:   #1d1d16;
  --border:    #2f2f24;
  --text:      #d3d0c2;
  --text-dim:  #9a9785;
  --heading:   #f2efe2;
  --accent:    #c4c27a;
  --header-bg: rgba(21, 21, 15, 0.85);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg:        #15150f;
    --surface:   #1d1d16;
    --border:    #2f2f24;
    --text:      #d3d0c2;
    --text-dim:  #9a9785;
    --heading:   #f2efe2;
    --accent:    #c4c27a;
    --header-bg: rgba(21, 21, 15, 0.85);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { color: var(--heading); line-height: 1.2; font-weight: 600; }
.nav, .eyebrow, .chips, .files, .site-footer, .intro, figcaption { font-family: var(--font-sans); }

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--bg); padding: .6rem 1rem; font-weight: 600;
}
.skip-link:focus { left: 0; }

img { max-width: 100%; height: auto; display: block; }

/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.75rem; }
.brand { font-weight: 600; font-size: 1.1rem; color: var(--heading); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.nav { display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; font-size: .85rem; }
.nav a { color: var(--text-dim); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.lang-switch {
  font-family: var(--font-sans); font-size: .8rem; text-decoration: none;
  padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 8px; color: var(--heading);
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--heading); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; display: none; }
.theme-toggle[data-mode="auto"] .ico-auto,
.theme-toggle[data-mode="light"] .ico-sun,
.theme-toggle[data-mode="dark"] .ico-moon { display: block; }

/* Hero -------------------------------------------------------------------- */

.hero { padding: clamp(2.5rem, 8vw, 5rem) 0 clamp(2rem, 6vw, 3.5rem); }
.hero-grid { display: grid; grid-template-columns: 1fr minmax(12rem, 18rem); gap: clamp(1.5rem, 5vw, 3.5rem); align-items: center; }
.eyebrow { margin: 0 0 .25rem; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); }
.hero h1 { font-size: clamp(2.4rem, 7vw, 3.8rem); margin: 0 0 .5rem; letter-spacing: -.01em; }
.dates { margin: 0 0 1.5rem; font-style: italic; color: var(--text-dim); }
.lead { font-size: clamp(1.05rem, 2.2vw, 1.2rem); max-width: 38rem; margin: 0 0 1.75rem; }

.portrait { margin: 0; }
.portrait img { border-radius: var(--radius); border: 1px solid var(--border); }

.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; font-size: .8rem; }
.chips a {
  display: inline-block; padding: .3rem .75rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--heading); text-decoration: none;
}
.chips a:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 40rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { order: -1; max-width: 14rem; }
  .nav { display: none; }   /* single page — sections are a short scroll away */
}

/* Sections ---------------------------------------------------------------- */

.section { padding: clamp(2rem, 6vw, 3.5rem) 0; border-top: 1px solid var(--border); }
.section h2 { font-size: clamp(1.5rem, 3.5vw, 1.9rem); margin: 0 0 1rem; }
.section h3 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
.intro { color: var(--text-dim); font-size: .95rem; margin: 0 0 1rem; max-width: 42rem; }

.prose > p, .prose > ul, .prose > blockquote { max-width: 40rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .3rem 0; }
.prose::after { content: ""; display: block; clear: both; }

.aside { float: right; width: min(14rem, 40%); margin: .4rem 0 1rem 1.75rem; }
.aside img { border-radius: var(--radius); border: 1px solid var(--border); }
@media (max-width: 34rem) { .aside { float: none; width: auto; max-width: 16rem; margin: 0 0 1.25rem; } }

blockquote {
  margin: 2rem 0 0; padding: .25rem 0 .25rem 1.25rem;
  border-left: 3px solid var(--accent);
  font-size: 1.15rem; font-style: italic; color: var(--heading);
}
blockquote p { margin: 0 0 .5rem; }
blockquote footer { font-family: var(--font-sans); font-size: .8rem; font-style: normal; color: var(--text-dim); }

.booklist { list-style: none; padding: 0 !important; }
.booklist li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.booklist span { color: var(--text-dim); font-family: var(--font-sans); font-size: .85rem; white-space: nowrap; }
.booklist small { color: var(--text-dim); font-size: .9rem; }

/* Publication list */
.files { list-style: none; padding: 0; margin: 0; font-size: .95rem; }
.files li {
  display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; align-items: baseline;
  padding: .55rem 0; border-bottom: 1px solid var(--border);
}
.files a { color: var(--heading); text-decoration: none; font-family: var(--font-serif); font-size: 1.02rem; }
.files a:hover { color: var(--accent); text-decoration: underline; }
.f-tr, .f-note { grid-column: 1; color: var(--text-dim); }
.f-tr { font-family: var(--font-serif); font-style: italic; font-size: .92rem; }
.f-note { font-size: .8rem; }
.f-size { grid-column: 2; grid-row: 1; color: var(--text-dim); font-size: .75rem; white-space: nowrap; }

/* Footer ------------------------------------------------------------------ */

.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; font-size: .8rem; color: var(--text-dim); }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }
