/* Kostrubala.com — public site styles
   Palette carried over from the original theme: deep violet, teal menu, the "whorl" artwork. */

:root {
  --violet: #412b59;
  --violet-deep: #2a1b3b;
  --violet-ink: #1d1229;
  --teal: #3c6d87;
  --teal-dark: #2e586f;
  --teal-light: #aac5d4;
  --gold: #e7b45a;
  --paper: #fbfaf8;
  --surface: #ffffff;
  --ink: #24202b;
  --muted: #625b6d;
  --rule: #e4dfe9;
  --link: #2e586f;
  --link-hover: #412b59;
  --focus: #e7b45a;

  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui: "Questrial", "Century Gothic", "Avenir Next", "Segoe UI", Arial, sans-serif;

  --measure: 42rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

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

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

h1, h2, h3, h4 { font-family: var(--font-ui); font-weight: 400; line-height: 1.2; color: var(--violet); }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 1.2rem + .7vw, 1.65rem); margin: 1.6em 0 .5em; }
h3 { font-size: 1.25rem; margin: 1.4em 0 .4em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--gold); color: var(--violet-ink); padding: .5rem 1rem; border-radius: 0 0 6px 6px;
  font-family: var(--font-ui);
}
.skip-link:focus { top: 0; }

/* ---------------------------------------------------------------- header */
.site-header {
  position: relative;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(29, 18, 41, .55) 0%, rgba(42, 27, 59, .92) 100%),
    url("../img/whorl-top.jpg") center 30% / cover no-repeat,
    var(--violet-deep);
}
.site-header__inner {
  max-width: 72rem; margin: 0 auto;
  padding: 1.6rem var(--gutter) 1.2rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { color: #fff; text-decoration: none; display: inline-block; }
.brand:hover { color: #fff; }
.brand__name {
  font-family: var(--font-ui);
  font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2.15rem);
  letter-spacing: .01em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .55);
}

.site-nav { background: rgba(29, 18, 41, .55); border-top: 1px solid rgba(255, 255, 255, .12); }
.site-nav ul {
  max-width: 72rem; margin: 0 auto; padding: 0 calc(var(--gutter) - .6rem);
  list-style: none; display: flex; flex-wrap: wrap;
}
.site-nav a {
  display: block; padding: .8rem .55rem;
  color: #fff; text-decoration: none;
  font-family: var(--font-ui); font-size: .95rem; letter-spacing: .01em; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: #fff; border-bottom-color: rgba(231, 180, 90, .6); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--gold); }

.nav-toggle {
  display: none;
  align-items: center; gap: .55rem;
  background: rgba(255, 255, 255, .1); color: #fff;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
  padding: .5rem .95rem; font: inherit; font-family: var(--font-ui); font-size: .95rem; cursor: pointer;
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 68rem) {
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav { display: none; }
  .js .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; padding: .4rem 0 .8rem; }
  .site-nav a { padding: .7rem var(--gutter); border-bottom: 0; border-left: 3px solid transparent; }
  .site-nav a[aria-current="page"] { border-left-color: var(--gold); background: rgba(255, 255, 255, .06); }
}

/* ------------------------------------------------------------- page body */
.site-main { display: block; }

.page {
  max-width: 72rem; margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) 3.5rem;
}
.page--with-aside {
  display: grid; gap: clamp(2rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr) 16rem;
  align-items: start;
}
.page__main { max-width: var(--measure); min-width: 0; }
.page:not(.page--with-aside) .page__main { margin: 0 auto; }
.page__header { margin-bottom: 1.5rem; }

.breadcrumb { font-family: var(--font-ui); font-size: .95rem; margin-bottom: .4rem; }
.breadcrumb a { color: var(--teal); text-decoration: none; }
.breadcrumb a::before { content: "\2190\00a0"; }
.breadcrumb a:hover { text-decoration: underline; }

@media (max-width: 52rem) {
  .page--with-aside { grid-template-columns: minmax(0, 1fr); }
}

/* Prose (CMS HTML) */
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose blockquote {
  margin: 1.5em 0; padding: .2em 0 .2em 1.2em;
  border-left: 3px solid var(--gold); color: var(--muted); font-style: italic;
}
.prose table { border-collapse: collapse; margin: 1em 0; max-width: 100%; }
.prose td, .prose th { padding: .4em .6em; vertical-align: top; }
.prose .centered, .prose [style*="text-align: center"] { text-align: center; }
.prose a.button, .button {
  display: inline-block;
  padding: .7rem 1.4rem;
  background: var(--violet); color: #fff; text-decoration: none;
  border: 1px solid var(--violet); border-radius: 999px;
  font-family: var(--font-ui); font-size: 1rem; line-height: 1.3;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.prose a.button:hover, .button:hover { background: var(--violet-deep); color: #fff; transform: translateY(-1px); }

/* Content blocks */
.page__main { display: flow-root; }
.block { margin: 0 0 1.6rem; }
.block--media-before, .block--media-after, .gallery, .section-index, .pager, .contact-form { clear: both; }
.block__title { margin-top: 1.4em; }
.block:first-child .block__title { margin-top: .2em; }

.block__media { margin: 0; }
.block__media img { display: block; border-radius: 4px; }
.block__media figcaption, .gallery__item figcaption {
  font-family: var(--font-ui); font-size: .88rem; line-height: 1.4; color: var(--muted);
  margin-top: .5rem;
}
.block__media--left, .block__media--right { max-width: 45%; margin-bottom: 1rem; }
.block__media--left { float: left; margin-right: 1.5rem; }
.block__media--right { float: right; margin-left: 1.5rem; }
.block__media--before { margin-bottom: 1.2rem; }
.block__media--after { margin-top: 1.2rem; }
.block__media--before, .block__media--after { text-align: center; }
.block__media--before img, .block__media--after img { margin: 0 auto; }
.block__media--before figcaption, .block__media--after figcaption { text-align: center; }

.block__media.size-medium { width: 240px; }
.block__media.size-med_large { width: 360px; }
.block__media.size-large.block__media--left, .block__media.size-large.block__media--right { width: 300px; }
.block__media--before.size-large, .block__media--after.size-large { max-width: 480px; margin-inline: auto; }

@media (max-width: 36rem) {
  .block__media--left, .block__media--right {
    float: none; max-width: 100%; width: auto !important; margin: 0 0 1rem;
  }
  .block__media--left img, .block__media--right img { margin: 0 auto; }
  .block__media--left figcaption, .block__media--right figcaption { text-align: center; }
}

.is-framed .block__media img { border: 1px solid var(--rule); box-shadow: 0 6px 18px rgba(42, 27, 59, .14); }

a.zoom { display: block; position: relative; cursor: zoom-in; }

.block__embed { margin-top: 1rem; overflow-x: auto; }
.block__embed table { width: 100%; table-layout: fixed; }
.block__embed input[type="text"] { width: 100%; max-width: 100%; padding: .45rem .6rem; font: inherit; border: 1px solid #b9b2c2; border-radius: 6px; }

/* Document download card */
.file-card {
  display: inline-flex; align-items: center; gap: 1rem;
  max-width: 100%; padding: .9rem 1.2rem .9rem .9rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  box-shadow: 0 2px 8px rgba(42, 27, 59, .06);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.file-card:hover { border-color: var(--teal); box-shadow: 0 6px 18px rgba(42, 27, 59, .12); color: var(--ink); }
.file-card__icon {
  flex: none; display: grid; place-items: center;
  width: 3rem; height: 3.6rem; border-radius: 4px;
  background: var(--violet); color: #fff;
  font-family: var(--font-ui); font-size: .8rem; letter-spacing: .05em;
}
.file-card__text { display: flex; flex-direction: column; text-align: left; min-width: 0; }
.file-card__name { font-family: var(--font-ui); font-size: 1.05rem; color: var(--violet); overflow-wrap: anywhere; }
.file-card__meta { font-family: var(--font-ui); font-size: .85rem; color: var(--muted); }

/* PDF: picture of the first page + text link */
.doc-thumb { display: inline-block; line-height: 0; border-radius: 4px; }
.doc-thumb img {
  display: block; background: #fff; border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 8px 22px rgba(42, 27, 59, .16);
  transition: transform .15s ease, box-shadow .15s ease;
}
.doc-thumb:hover img { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(42, 27, 59, .24); }
.doc-link {
  display: flex; flex-direction: column; align-items: inherit; gap: .1rem;
  margin-top: .7rem; font-family: var(--font-ui); line-height: 1.3; text-decoration: none;
}
.block__media--before .doc-link, .block__media--after .doc-link, .gallery__item .doc-link { align-items: center; text-align: center; }
.doc-link__name { font-size: 1.05rem; text-decoration: underline; text-underline-offset: .18em; }
.doc-link:hover .doc-link__name { text-decoration-thickness: 2px; }
.doc-link__meta { font-size: .82rem; color: var(--muted); }
.doc-link__name::before {
  content: "PDF"; display: inline-block; margin-right: .45rem; padding: .05rem .35rem; border-radius: 3px;
  background: var(--violet); color: #fff; font-size: .68rem; letter-spacing: .06em; vertical-align: .15em; text-decoration: none;
}
.theme-dark .doc-link__meta { color: #b6abc2; }

/* Galleries */
.gallery {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(46%, 12.5rem), 1fr));
  margin: 0 0 2rem;
}
.page__main:has(.gallery) { max-width: 56rem; }
.gallery__item { margin: 0; }
.gallery__item a, .gallery__item > img {
  display: block; width: 100%;
  aspect-ratio: 1; padding: .6rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.gallery__item a:hover { border-color: var(--teal); box-shadow: 0 8px 22px rgba(42, 27, 59, .14); transform: translateY(-2px); }
.gallery__item a img { display: block; width: 100%; height: 100%; object-fit: contain; }
.gallery__item figcaption { text-align: center; }

/* Section index, side navigation, pager */
.section-index {
  margin-top: 2.5rem; padding: 1.4rem 1.6rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.section-index__title, .side-nav__title {
  margin: 0 0 .7rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
}
.section-index ul, .side-nav ul { list-style: none; margin: 0; padding: 0; }
.section-index li + li { border-top: 1px solid var(--rule); }
.section-index a {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .7rem 0; text-decoration: none; font-family: var(--font-ui); font-size: 1.05rem;
}
.section-index a::after { content: "\2192"; color: var(--teal); transition: transform .15s ease; }
.section-index a:hover::after { transform: translateX(3px); }

.page__aside { position: sticky; top: 1.5rem; }
.side-nav {
  padding: 1.2rem 1.3rem; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
  font-family: var(--font-ui); font-size: .95rem; line-height: 1.35;
}
.side-nav__title a { color: inherit; text-decoration: none; }
.side-nav li a { display: block; padding: .45rem .6rem; margin: 0 -.6rem; border-radius: 6px; text-decoration: none; color: var(--ink); }
.side-nav li a:hover { background: #f2eef6; color: var(--violet); }
.side-nav li a[aria-current="page"] { background: var(--violet); color: #fff; }
@media (max-width: 52rem) { .page__aside { position: static; } }

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
  font-family: var(--font-ui);
}
.pager a { text-decoration: none; display: flex; flex-direction: column; gap: .15rem; line-height: 1.35; }
.pager span { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.pager__prev span::before { content: "\2190\00a0"; }
.pager__next { grid-column: 2; text-align: right; }
.pager__next span::after { content: "\00a0\2192"; }

/* ----------------------------------------------------------- contact form */
.contact-form { margin-top: 1.5rem; }
.contact-form fieldset {
  margin: 0; padding: clamp(1.2rem, 3vw, 2rem);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
  display: grid; gap: 1.1rem; grid-template-columns: 1fr 1fr;
}
.contact-form legend {
  float: left; width: 100%; grid-column: 1 / -1; padding: 0; margin-bottom: .2rem;
  font-family: var(--font-ui); font-size: 1.35rem; color: var(--violet);
}
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field--name, .field--message, .form-alert, .form-note, .contact-form .button { grid-column: 1 / -1; }
.field label { font-family: var(--font-ui); font-size: .95rem; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: .7rem .8rem; background: #fff;
  border: 1px solid #b9b2c2; border-radius: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(60, 109, 135, .2);
}
.field textarea { resize: vertical; min-height: 9rem; }
.has-error input, .has-error textarea { border-color: #b3261e; }
.field__error { margin: 0; color: #b3261e; font-family: var(--font-ui); font-size: .9rem; }
.req { color: #b3261e; }
.form-note { margin: 0; font-family: var(--font-ui); font-size: .85rem; color: var(--muted); }
.form-alert {
  padding: .8rem 1rem; border-radius: 8px;
  background: #fdecea; border: 1px solid #f3b8b3; color: #7a1c15; font-family: var(--font-ui); font-size: .95rem;
}
.form-alert p { margin: 0; }
.form-alert p + p { margin-top: .3rem; }
.contact-form .button { justify-self: start; font-size: 1.05rem; padding: .8rem 1.8rem; }
.field--hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 36rem) {
  .contact-form fieldset { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ home */
/* Full-screen splash, recreating the original composition: whorl artwork, logo in the
   dark circle, a book cover either side. Everything is positioned in percentages of a
   990 x 680 stage, which grows to fill the screen (height-limited) and shrinks on phones. */
.tpl-home { background: var(--violet); }
.tpl-home .site-main { background: var(--violet); }

.splash { display: flex; justify-content: center; }
.splash__stage {
  position: relative;
  width: min(100%, calc(100svh * 990 / 680));
  aspect-ratio: 990 / 680;
  background: url("../img/whorl-top.jpg") center top / 101.82% auto no-repeat;
  box-shadow: 0 2px 6px #1c1523, 0 0 60px rgba(0, 0, 0, .35);
  overflow: hidden;
}
.splash__stage::after {
  content: ""; position: absolute; inset: 58.82% 0 0; z-index: 0; pointer-events: none;
  background: url("../img/whorl-bottom.jpg") center bottom / 101.82% auto no-repeat;
}
.splash__logo, .splash__book { position: absolute; z-index: 2; display: block; line-height: 0; }
.splash__logo { width: 21.31%; top: 39.41%; left: 31.62%; }
.splash__book { width: 28.89%; top: 22.06%; }
.splash__book--left { left: 0; }
.splash__book--right { left: 63.33%; }
.splash__logo img, .splash__book img { display: block; width: 100%; height: auto; }
.splash__book img { transition: transform .25s ease, filter .25s ease; }
.splash__book:hover img, .splash__book:focus-visible img { transform: scale(1.025); filter: brightness(1.06); }
.splash__logo:focus-visible, .splash__book:focus-visible { outline-offset: -4px; }

.home-content { max-width: var(--measure); margin: 2rem auto 0; padding: 1.5rem var(--gutter); background: var(--paper); border-radius: var(--radius); }

.site-footer.site-footer--home { background: var(--violet); color: #c9bdd6; }
.site-footer--home .site-footer__inner { padding-top: 2rem; }
.site-footer--home .site-footer__name { display: none; }
.footer-nav ul {
  list-style: none; margin: 0 0 1.2rem; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; row-gap: .35rem;
}
.footer-nav li + li::before { content: "|"; margin: 0 .7rem; opacity: .55; }
.footer-nav a { color: #e6ddef; text-decoration: none; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.site-footer--home a { color: #e6ddef; }
@media (max-width: 36rem) {
  .footer-nav ul { column-gap: 1.1rem; row-gap: .55rem; }
  .footer-nav li + li::before { content: none; }
}

/* ------------------------------------------------- dark theme (book pages) */
.theme-dark { background: #0d0910; color: #ece8f1; }
.theme-dark .site-main h1, .theme-dark .site-main h2, .theme-dark .site-main h3 { color: #fff; }
.theme-dark .site-main a { color: #f0c979; }
.theme-dark .site-main a:hover { color: #fff; }
.theme-dark .breadcrumb a { color: var(--teal-light); }
.theme-dark .section-index, .theme-dark .side-nav, .theme-dark .file-card {
  background: #1a1220; border-color: #34283f; color: #ece8f1;
}
.theme-dark .section-index__title, .theme-dark .side-nav__title, .theme-dark .pager span { color: #b6abc2; }
.theme-dark .pager { border-color: #34283f; }
.theme-dark .prose table { margin-inline: auto; }
.theme-dark .site-main .prose a.button {
  background: #590e6f; border-color: #ffd54a; color: #fff; min-width: 13rem; text-align: center;
}
.theme-dark .site-main .prose a.button:hover { background: #6d1689; }
.theme-dark .block__media img { border-radius: 0; }
.theme-dark .page__main { max-width: 46rem; }
@media (max-width: 36rem) {
  .theme-dark .prose table, .theme-dark .prose tbody, .theme-dark .prose tr, .theme-dark .prose td { display: block; text-align: center; }
}

/* ---------------------------------------------------------------- footer */
.site-footer {
  color: var(--teal-light);
  background:
    linear-gradient(0deg, rgba(29, 18, 41, .92), rgba(29, 18, 41, .97)),
    url("../img/whorl-bottom.jpg") center bottom / cover no-repeat,
    var(--violet-ink);
  font-family: var(--font-ui); font-size: .95rem; text-align: center;
}
.site-footer__inner { max-width: 72rem; margin: 0 auto; padding: 2.5rem var(--gutter); }
.site-footer p { margin: .3rem 0; }
.site-footer a { color: #fff; }
.site-footer__name { font-size: 1.15rem; color: #fff; }
.site-footer__copy { margin-top: 1rem !important; font-size: .85rem; opacity: .85; }
@media (max-width: 36rem) {
  .brand__name { font-size: 1.3rem; }
  .site-header__inner { padding-block: 1rem; }
  .gallery { gap: .75rem; }
  .gallery__item a { padding: .35rem; }
}

/* -------------------------------------------------------------- lightbox */
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: rgba(13, 9, 16, .94); color: #fff;
}
.lightbox[open] { display: grid; grid-template-columns: 4rem 1fr 4rem; align-items: center; }
.lightbox::backdrop { background: rgba(13, 9, 16, .6); }
.lightbox__figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 3.5rem 0 1.5rem; height: 100vh; justify-content: center; }
.lightbox__figure img { max-width: 100%; max-height: calc(100vh - 7rem); width: auto; height: auto; object-fit: contain; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.lightbox__figure figcaption { font-family: var(--font-ui); text-align: center; color: #ddd; padding: 0 1rem; }
.lightbox button {
  background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px; cursor: pointer; font-size: 2rem; line-height: 1; width: 3rem; height: 3rem;
}
.lightbox button:hover { background: rgba(255, 255, 255, .2); }
.lightbox__close { position: fixed; top: 1rem; right: 1rem; }
.lightbox__nav { justify-self: center; }
.lightbox__nav[hidden] { visibility: hidden; display: block; }
@media (max-width: 36rem) {
  .lightbox[open] { grid-template-columns: 0 1fr 0; }
  .lightbox__nav { position: fixed; bottom: 1rem; }
  .lightbox__prev { left: 1rem; }
  .lightbox__next { right: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media print {
  .site-header, .site-nav, .site-footer, .page__aside, .pager, .lightbox { display: none !important; }
  body { background: #fff; color: #000; }
}
