:root {
  --paper: #f8f4e9;
  --ink: #183a34;
  --muted: #4b6258;
  --line: #c5d2c6;
  --wash: #e7ece1;
  --pine: #163c34;
  --pine-deep: #102f29;
  --amber: #f3bf73;
  --pale: #fffaf0;
  --sage: #e0ece3;
  --lift: 0 12px 28px #213d2d19, 0 2px 5px #263b2f12;
}
body {
  background: radial-gradient(ellipse at 100% 10%, #dcebe3 0%, transparent 49rem),
    radial-gradient(ellipse at 0 35rem, #f6e6c7 0%, transparent 42rem), var(--paper);
}
header#site-header {
  background: linear-gradient(112deg, var(--pine-deep), #245849);
  color: #fffaf0;
  border-bottom: 2px solid #cb954f;
  box-shadow: 0 4px 17px #142e2850;
}
#site-header .brand { color: #fff7df; }
#site-header .brand small { color: #dbe9db; }
#site-header .top .help-entry {
  background: #234741;
  border-color: #a9bb9e;
  color: #fff7df;
}
#site-header .help-entry:hover { background: #315f52; border-color: #f3bf73; }
.language-control select { background: var(--pale); border-color: #b7c6ab; color: var(--pine-deep); }

.featured-layout {
  border: 1px solid #536f5b;
  border-radius: 18px;
  box-shadow: 0 22px 42px #243a302f, 0 6px 14px #44362325;
}
.featured-caption {
  background: linear-gradient(120deg, #143c33, #28584b);
  border-top: 2px solid #b98145;
}
.featured-cta {
  background: var(--amber);
  border-color: #ffdaa2;
  color: #2d2a1e;
  box-shadow: inset 0 1px #ffe3b1, 0 3px 9px #102b2360;
}
.featured-cta:hover { background: #ffcf85; color: #2d2a1e; }
.home-hero .buttons .button {
  background: #e0ece3;
  border-color: #a8bdae;
  color: #194539;
  box-shadow: 0 2px 5px #244a3618;
}
.home-hero .buttons #youth-button {
  background: #f6e5c8;
  border-color: #cdb185;
  color: #5c3c21;
}
.home-hero .buttons #youth-button:hover { background: #efd5a9; }
.intro {
  background: #fff9ebcc;
  border: 1px solid #dbcfb5;
  border-left: 4px solid #b97d40;
  border-radius: 4px 13px 13px 4px;
  margin-top: 30px;
  padding: 20px clamp(15px, 4vw, 34px);
}
.intro .eyebrow { color: #764923; }
.filters {
  margin-top: 22px;
  padding: clamp(15px, 3vw, 26px);
  border: 1px solid #aabbad;
  border-radius: 14px;
  background: linear-gradient(120deg, #e2eee5, #f7fbf5);
  box-shadow: var(--lift);
}
.filters-head h2,
.card-title-button, .result h2 {
  font-family: "Latin Modern Display", Georgia, serif;
  color: var(--pine);
}
.filters :is(input,select) {
  border-color: #a4b8a9;
  background-color: #fffdf5;
  color: var(--pine-deep);
}
.search-box button, .primary, #reader-view .primary {
  background: #245548;
  color: white;
  border-color: #245548;
}
.search-box button:hover, .primary:hover, #reader-view .primary:hover { background: #163c34; color: white; }

.book-card, .result {
  --topic-color: #477863;
  --topic-wash: #e4eee5;
  border: 1px solid #c2d1c3;
  border-top: 3px solid var(--topic-color);
  border-radius: 13px;
  background: #fffdf7;
  box-shadow: var(--lift);
  overflow: hidden;
}
[data-topic="ai"], [data-topic="loops"] { --topic-color: #316f79; --topic-wash: #e0eef0; }
[data-topic="youth"], [data-topic="time"] { --topic-color: #a06630; --topic-wash: #f7ead4; }
[data-topic="body"], [data-topic="data"] { --topic-color: #94594f; --topic-wash: #f6e5de; }
[data-topic="public"], [data-topic="governance"] { --topic-color: #4a667b; --topic-wash: #e6edf2; }
button.card-image, button.card-image:hover {
  background: radial-gradient(ellipse at 50% 5%, #ffffffbf 0%, transparent 83%), var(--topic-wash);
  padding: 15px 22px 17px;
  border-bottom: 1px solid #314a3d25;
}
.card-image img {
  width: auto;
  max-width: 100%;
  box-shadow: 5px 8px 14px #29383044;
}
.book-card:hover, .book-card:focus-within { box-shadow: 0 12px 27px #213c3032; }
.card-body { background: linear-gradient(180deg, #fffef9, #fffaf0); }
.card-angle, .result .page { color: #3a6253; }
.actions :is(.pdf-download,.pdf-preview) { background: #e7f0e7; color: #184237; border-color: #b4c8ba; }
.badge-audience .book-badge { background: #e7f0e7; color: #244d40; }
.badge-level .book-badge { background: #f8ead1; color: #5d411f; }
.footer { color: #37564b; border-color: #b4c8b9; }

.reading #site-header .reading-bar { color: #fffaf1; }
.reading #site-header #fullscreen { color: #f4f9f1; border-color: #aabfab; }
.reading #site-header #fullscreen:hover { background: #fff8df; color: var(--pine-deep); }
.reading #site-header .reading-bar p { color: #dfebe1; }
.reading .reading-bar #back-results.return-main { background: #255b4d; border-color: #a9bb9e; }
.reading #chapter-paths { background: #f3e2c1; color: #46341f; border-color: #d4ad71; }
#workspace.has-side { gap: 4px; background: #648374; }
#left-host, #right-host { background: #e1e8df; }
.pdf-toolbar {
  background: linear-gradient(125deg, #fcfaf1, #e4efe6);
  border-bottom: 1px solid #98b09e;
  color: var(--pine-deep);
  box-shadow: 0 3px 7px #284c3727;
}
.pdf-controls :is(button,select,input), .pdf-toolbar .chapter-select {
  background: #fffdf7;
  border-color: #acbeae;
  color: #173c33;
  border-radius: 4px;
}
.pdf-stage {
  background: linear-gradient(150deg, #dde8df, #eee7d9);
}
.pdf-sheet { box-shadow: 0 4px 15px #2d463340; }
.reading-paths, .side-panel {
  background: linear-gradient(155deg, #e0eee6, #f8f7ed 70%);
  color: #203d35;
}
.paths-guide {
  background: #fffaf0;
  border-color: #b6cabb;
  border-top: 3px solid #6d9b88;
  box-shadow: 0 5px 13px #2c4f3821;
}
.paths-list li, .compare-result {
  background: #fffdf5;
  border-color: #bacdc0;
}
.paths-list li { border-left: 3px solid #669482; box-shadow: 0 2px 6px #213b2b10; }
.paths-address { background: #f5e9d2; color: #543d23; }
#right-host .source-card-toolbar {
  background: linear-gradient(125deg, #fcfaf1, #e4efe6);
  border-color: #acbeae;
}
.source-card-toolbar > span {
  border: 1px solid #d4ad71;
  border-radius: 4px;
  padding: 2px 8px;
  background: #f5e9d2;
  color: #543d23;
  font-weight: 650;
}
.source-card-body {
  background: #fffaf0;
  border: 1px solid #b6cabb;
  border-top: 3px solid #6d9b88;
  border-radius: 10px;
  box-shadow: var(--lift);
  margin: clamp(12px, 2vw, 26px);
}
.source-card-body h2 { color: var(--pine-deep); }
.contacts-panel { border: 1px solid #759485; border-radius: 14px; color: var(--ink); background: var(--pale); }
.contacts-panel::backdrop { background: #14332c99; }
.contacts-panel .modal-head { background: linear-gradient(120deg, #173c34, #2c6454); color: #fff8e7; }
.contacts-panel .modal-head .button { background: var(--pale); color: var(--pine-deep); border-color: #afc1b0; }
.contacts-panel :is(.hs-header,.hs-card) { background-color: #f7fbf5; border-color: #bccfc0; }
:where(button,a,input,select,summary):focus-visible { outline: 2px solid #8b502b; outline-offset: 3px; }
#site-header :focus-visible { outline-color: #ffe0a3; }
@media print {
  body, .book-card, .card-body, .result, .filters { background: white; box-shadow: none; }
}

/* Keep the reading and comparison panes in their established positions for RTL editions. */
[dir="rtl"] #reader-view { direction: ltr; }
[dir="rtl"] .reading-paths,
[dir="rtl"] .pdf-toolbar,
[dir="rtl"] .reading-bar { direction: rtl; }
.featured-art { cursor: pointer; }

@media (min-width: 781px) {
  :lang(fi) #featured-title {
    width: 43%;
    font-size: clamp(2.4rem, 5.1vw, 4.85rem);
  }
}

#right-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#right-host { flex: 1; }
#reading-history {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 5px;
  padding: 4px 8px;
  background: #e4efe6;
  border-bottom: 1px solid #98b09e;
}
#reading-history :is(button,select) {
  min-width: 0;
  height: 30px;
  padding: 2px 8px;
  font-size: .84rem;
  color: var(--pine-deep);
  background: var(--pale);
  border: 1px solid #acbeae;
  border-radius: 4px;
}
