/*
  Nikali Repository: styles only the reading room needs.
  Everything else (header, footer, buttons, shelf, page turn) comes from the main site's site.css.
*/

/* ---------- WordPress chrome ---------- */

.admin-bar .site-head { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-head { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-head { top: 0; } }

/* On ivory-topped pages the header keeps its dark bar so the menu is always readable. */
.single .site-head::before, .page-template-default .site-head::before { opacity: 1; }
main > .repo-bar:first-child { margin-top: var(--head-h); }

/* ---------- The vault: front door of the Repository ---------- */

.vault {
  --arch-w: min(62rem, 100vw - 1.5rem);
  position: relative; overflow: hidden; text-align: center;
  padding: calc(var(--head-h) + clamp(2.5rem, 7vw, 5rem)) 0 clamp(3rem, 7vw, 5rem);
  background-color: var(--forest-deep);
  background-image:
    url("../img/grain-light.png"),
    radial-gradient(70% 60% at 50% 12%, rgba(47, 102, 88, 0.55), rgba(14, 34, 29, 0) 72%),
    radial-gradient(55% 40% at 50% 100%, rgba(180, 154, 99, 0.14), rgba(14, 34, 29, 0) 75%);
}
.vault__arch {
  position: absolute; left: 50%; top: calc(var(--head-h) + 1.25rem); bottom: -1px;
  width: var(--arch-w); transform: translateX(-50%); pointer-events: none;
  border: 1px solid rgba(180, 154, 99, 0.45); border-bottom: 0;
  border-radius: calc(var(--arch-w) / 2) calc(var(--arch-w) / 2) 0 0;
}
.vault__arch::before {
  content: ""; position: absolute; inset: clamp(7px, 1.2vw, 14px); bottom: 0;
  border: 1px solid rgba(180, 154, 99, 0.22); border-bottom: 0;
  border-radius: calc(var(--arch-w) / 2) calc(var(--arch-w) / 2) 0 0;
}
.vault__inner { position: relative; display: grid; justify-items: center; }
.vault .crumbs { margin-bottom: 1.5rem; }
.vault .crumbs ol { justify-content: center; }
.vault__kicker { margin-top: clamp(1rem, 4vw, 3rem); }
.vault__title { margin-top: 1rem; font-size: clamp(3rem, 1.8rem + 5.6vw, 6.5rem); line-height: 0.95; }
.vault__sub { margin-top: 0.875rem; font: italic 500 var(--t-lede)/1.3 var(--serif); color: var(--brass-light); }
.vault .search { margin-top: clamp(1.75rem, 4vw, 2.5rem); border-color: rgba(220, 198, 149, 0.6); }
.vault__counts { display: flex; justify-content: center; gap: clamp(1.75rem, 6vw, 4rem); margin: clamp(2rem, 4vw, 2.75rem) 0 0; }
.vault__counts div { display: grid; gap: 0.25rem; }
.vault__counts dt { order: 2; font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-dark-soft); }
.vault__counts dd { margin: 0; font: 500 clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem)/1 var(--serif); color: var(--brass-light); font-variant-numeric: lining-nums tabular-nums; }

[data-motion="on"] .vault__arch { animation: nk-arch 1.6s var(--ease-inout) 0.1s both; }
[data-motion="on"] .vault .hall__keystone { animation: nk-fade 0.8s ease 1.3s both; }
[data-motion="on"] .vault__kicker { animation: nk-rise 0.9s var(--ease) 0.35s both; }
[data-motion="on"] .vault__title { animation: nk-rise 1s var(--ease) 0.5s both; }
[data-motion="on"] .vault__sub { animation: nk-rise 1s var(--ease) 0.65s both; }
[data-motion="on"] .vault .search { animation: nk-rise 1s var(--ease) 0.8s both; }
[data-motion="on"] .vault__counts { animation: nk-fade 1s ease 1s both; }

/* ---------- Repository sub-navigation ---------- */

.repo-bar { position: relative; z-index: 2; background-color: var(--ivory-shade); border-bottom: 1px solid var(--rule); }
.repo-bar__inner { display: flex; align-items: stretch; justify-content: space-between; gap: 1rem; }
.repo-bar__tabs { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(1.25rem, 4vw, 2.75rem); overflow-x: auto; scrollbar-width: none; }
.repo-bar__tabs::-webkit-scrollbar { display: none; }
.repo-bar a {
  position: relative; display: flex; align-items: center; gap: 0.6rem; min-height: 3.5rem; white-space: nowrap;
  font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; text-decoration: none; color: var(--text-soft);
}
.repo-bar a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--forest); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.45s var(--ease); }
.repo-bar a:hover { color: var(--charcoal); }
.repo-bar a:hover::after { transform: scaleX(0.35); }
.repo-bar a[aria-current]::after { transform: scaleX(1); }
.repo-bar a[aria-current] { color: var(--forest); }
.repo-bar__hint { font: italic 500 1rem/1 var(--serif); letter-spacing: 0; text-transform: none; color: var(--brass-ink); }
.repo-bar__search { flex: none; }
@media (max-width: 39.99em) {
  .repo-bar__hint, .repo-bar__search span { display: none; }
}

/* ---------- Featured record ---------- */

.feature { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.feature__frame {
  position: relative; display: block; width: min(100%, 26rem); justify-self: center; aspect-ratio: 4 / 5;
  border-radius: 999px 999px 0 0; overflow: hidden; background-color: var(--forest);
}
.feature__frame::after { content: ""; position: absolute; inset: 0.625rem 0.625rem 0; border: 1px solid rgba(220, 198, 149, 0.7); border-bottom: 0; border-radius: 999px 999px 0 0; pointer-events: none; }
.feature__frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.feature__frame:hover img { transform: scale(1.03); }
.feature__frame--plain {
  display: grid; place-content: center; justify-items: center; gap: 1.25rem;
  background-image: url("../img/grain-light.png"), radial-gradient(80% 60% at 50% 20%, rgba(47, 102, 88, 0.7), rgba(23, 58, 50, 0) 75%);
  color: var(--brass-light);
}
.feature__numeral { font: 500 clamp(4.5rem, 3rem + 7vw, 8rem)/1 var(--serif); letter-spacing: 0.06em; }
.feature__frame--plain .star { width: 1.5rem; height: 1.5rem; }
.feature__body { display: grid; gap: 1.125rem; justify-items: start; }
.feature__title { font-size: var(--t-h2); max-width: 18ch; }
.feature__title a { text-decoration: none; background: linear-gradient(var(--brass), var(--brass)) 0 100% / 0 1px no-repeat; transition: background-size 0.6s var(--ease); }
.feature__title a:hover { background-size: 100% 1px; }
.feature__dek { max-width: 38ch; font: italic 500 var(--t-lede)/1.3 var(--serif); color: var(--text-soft); }
.feature__body .btn { margin-top: 0.75rem; }
@media (min-width: 56em) { .feature { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }

/* ---------- Shelf additions ---------- */

.volume__count { margin-left: 0.75rem; color: var(--on-dark-soft); }
.volume__latest { list-style: none; padding: 0; margin-top: 1.25rem; border-top: 1px solid var(--rule-dark); }
.volume__latest li { border-bottom: 1px solid var(--rule-dark); }
.volume__latest a { display: block; padding: 0.75rem 0 0.75rem 1.5rem; position: relative; font: 500 1.25rem/1.25 var(--serif); text-decoration: none; color: var(--ivory); }
.volume__latest a::before { content: ""; position: absolute; left: 0.125rem; top: 1.2rem; width: 0.4375rem; height: 0.4375rem; background: var(--brass); transform: rotate(45deg); transition: transform 0.4s var(--ease); }
.volume__latest a:hover { color: var(--brass-light); }
.volume__latest a:hover::before { transform: rotate(225deg); }

/* ---------- Two streams: the archive and Dispatches ---------- */

.streams { display: grid; gap: clamp(3rem, 6vw, 5rem); }
.streams > * { min-width: 0; }
@media (min-width: 64em) { .streams { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); align-items: start; } }

.entry__by { font-size: var(--t-small); color: var(--text-soft); }

.board {
  position: relative; padding: clamp(1.75rem, 4vw, 2.5rem); background-color: var(--forest);
  border-radius: 2px; color: var(--on-dark);
}
.board::before { content: ""; position: absolute; inset: 0.5rem; border: 1px solid rgba(180, 154, 99, 0.45); pointer-events: none; }
.board > * { position: relative; }
.board__title { margin-top: 0.5rem; font-size: var(--t-h3); }
.board__intro { margin-top: 0.75rem; color: var(--on-dark-soft); font-size: var(--t-small); }
.board__empty { margin-top: 1.5rem; font: italic 500 1.25rem/1.3 var(--serif); color: var(--brass-light); }
.board .link { margin-top: 1.5rem; }

.register { list-style: none; padding: 0; margin-top: 1.5rem; border-top: 1px solid var(--rule-dark); }
.register li { border-bottom: 1px solid var(--rule-dark); }
.register a { display: grid; grid-template-columns: 4.25rem minmax(0, 1fr); gap: 1rem; align-items: center; padding: 1rem 0; text-decoration: none; }
.register__date { display: grid; justify-items: start; font: 600 0.6875rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-dark-soft); }
.register__date span { font: 500 2.125rem/1 var(--serif); letter-spacing: 0; color: var(--brass-light); font-variant-numeric: lining-nums; }
.register__title { font: 500 1.3125rem/1.2 var(--serif); transition: color 0.3s; }
.register a:hover .register__title { color: var(--brass-light); }

.register--page { margin-top: 0; border-top-color: var(--charcoal); }
.register--page li { border-bottom-color: var(--rule); }
.register--page a { grid-template-columns: 5rem minmax(0, 1fr); padding: clamp(1.5rem, 3vw, 2.25rem) 0; align-items: start; }
.register--page .register__date { color: var(--text-soft); }
.register--page .register__date span { font-size: 2.75rem; color: var(--brass-ink); }
.register--page .register__body { display: grid; gap: 0.5rem; }
.register--page .register__title { font-size: var(--t-h3); color: var(--charcoal); }
.register--page a:hover .register__title { color: var(--forest); }
.register__text { color: var(--text-soft); max-width: 52ch; }
.register--page .entry__read { grid-column: 2; }
@media (min-width: 48em) {
  .register--page a { grid-template-columns: 6rem minmax(0, 1fr) auto; }
  .register--page .entry__read { grid-column: 3; align-self: center; }
}
.register--page a:hover .arr { transform: translateX(6px); }

.empty { display: grid; gap: 0.75rem; justify-items: start; padding: clamp(1.5rem, 4vw, 2.5rem) 0; }

/* ---------- Volume page ---------- */

.volume-head__inner { display: grid; gap: 2rem; align-items: end; }
.volume-head__topics { margin-top: 1rem; max-width: 46ch; color: var(--on-dark-soft); }
.volume-head__book { display: none; }
@media (min-width: 48em) {
  .volume-head__inner { grid-template-columns: minmax(0, 1fr) auto; }
  .volume-head__book { display: block; padding-right: clamp(0rem, 4vw, 4rem); margin-bottom: calc(clamp(2.75rem, 7vw, 5.5rem) * -1 - 1px); }
}
.spine--hero {
  max-width: none;
  display: flex; width: clamp(5.5rem, 7vw, 7rem); height: clamp(17rem, 30vw, 22rem);
  transform: rotate(-3deg); transform-origin: 50% 100%; cursor: default;
  box-shadow: inset 7px 0 9px -7px rgba(255, 255, 255, 0.2), inset -9px 0 12px -8px rgba(0, 0, 0, 0.55), 18px 14px 30px -12px rgba(0, 0, 0, 0.6);
}
.spine--hero:hover { transform: rotate(-3deg); }
.spine--hero .spine__title { font-size: clamp(1.25rem, 1.8vw, 1.625rem); }
@keyframes nk-pull { from { transform: translateY(55%) rotate(0deg); } to { transform: rotate(-3deg); } }
[data-motion="on"] .spine--hero { animation: nk-pull 1.3s var(--ease) 0.2s both; }
.volume-head--dispatch .page-head__title { letter-spacing: 0.02em; }

.switch-band { background-color: var(--ivory-shade); border-bottom: 1px solid var(--rule); }
.switch__list { list-style: none; margin: 0 calc(var(--gutter) * -1); padding: 1rem var(--gutter); display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); }
.switch__list::-webkit-scrollbar { display: none; }
.switch__list li { flex: none; scroll-snap-align: start; }
:where(.switch__spine) { --spine: #24584c; --foil: var(--brass-light); }
.switch__spine {
  display: flex; align-items: center; gap: 0.625rem; min-height: 2.75rem; padding: 0.5rem 1rem;
  background: var(--spine); color: var(--foil); border-radius: 2px; text-decoration: none; white-space: nowrap;
  font: 500 1.0625rem/1 var(--serif);
  box-shadow: inset 0 5px 8px -6px rgba(255, 255, 255, 0.22), inset 0 -6px 9px -7px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s var(--ease);
}
.switch__num { font: 600 0.8125rem/1 var(--serif); letter-spacing: 0.1em; padding-right: 0.625rem; border-right: 1px solid currentColor; opacity: 0.85; }
.switch__spine:hover { transform: translateY(-2px); }
.switch__spine[aria-current] { box-shadow: 0 0 0 2px var(--ivory-shade), 0 0 0 3px var(--brass-ink); }
@media (min-width: 76em) { .switch__list { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; overflow: visible; } }

/* ---------- Reading an entry ---------- */

.reading { background-color: var(--ivory); padding-bottom: clamp(3rem, 7vw, 5.5rem); }
.reading__col { width: min(100% - 2 * var(--gutter), 46rem); margin-inline: auto; }
.reading__head { padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.reading .crumbs ol { color: var(--text-soft); }
.reading .crumbs a:hover { color: var(--forest); }
.reading .crumbs [aria-current] { color: var(--brass-ink); }
.reading .crumbs [aria-current] { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reading__kicker a { text-decoration: none; }
.reading__kicker a:hover { text-decoration: underline; }
.reading__title { margin-top: 1rem; font-size: clamp(2.5rem, 1.5rem + 4.4vw, 5rem); line-height: 1; max-width: 17ch; }
.reading__dek { margin-top: 1.25rem; max-width: 34ch; font: italic 500 var(--t-lede)/1.3 var(--serif); color: var(--text-soft); }
.reading__meta { display: flex; flex-wrap: wrap; gap: 1rem clamp(1.5rem, 5vw, 3.5rem); margin: clamp(1.75rem, 4vw, 2.5rem) 0 0; padding: 1.25rem 0; border-top: 1px solid var(--charcoal); border-bottom: 1px solid var(--rule); }
.reading__meta div { display: grid; gap: 0.375rem; }
.reading__meta dt { font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); }
.reading__meta dd { margin: 0; font: 500 1.25rem/1.2 var(--serif); }
.reading__note { display: block; margin-top: 0.25rem; font: italic 500 1.0625rem/1.3 var(--serif); color: var(--text-soft); }

[data-motion="on"] .reading__kicker { animation: nk-rise 0.8s var(--ease) 0.15s both; }
[data-motion="on"] .reading__title { animation: nk-rise 1s var(--ease) 0.25s both; }
[data-motion="on"] .reading__dek { animation: nk-rise 1s var(--ease) 0.4s both; }
[data-motion="on"] .reading__meta { animation: nk-fade 1.1s ease 0.6s both; }
[data-motion="on"] .reading__figure, [data-motion="on"] .reading__body { animation: nk-rise 1.1s var(--ease) 0.75s both; }

.reading__figure { width: min(100% - 2 * var(--gutter), 64rem); margin: clamp(2rem, 5vw, 3.5rem) auto 0; }
.reading__image { width: 100%; max-height: 80vh; object-fit: cover; border-radius: 50% 50% 0 0 / 14% 14% 0 0; }
.reading__figure figcaption, .reading__body figcaption { margin-top: 0.75rem; font-size: var(--t-small); color: var(--text-soft); text-align: center; }

.reading__body {
  width: min(100% - 2 * var(--gutter), 42rem); margin: clamp(2.25rem, 5vw, 3.5rem) auto 0;
  font: 500 clamp(1.25rem, 1.15rem + 0.4vw, 1.375rem)/1.62 var(--serif); color: var(--charcoal);
  font-variant-numeric: oldstyle-nums;
}
.reading__body > * + * { margin-top: 1.1em; }
.reading__body h2 { margin-top: 2.2em; font-size: 1.75em; line-height: 1.1; font-weight: 600; }
.reading__body h3 { margin-top: 1.9em; font-size: 1.35em; line-height: 1.15; font-weight: 600; }
.reading__body h4 { margin-top: 1.6em; font: 600 var(--t-meta)/1.3 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); }
.reading__body a { color: var(--forest); text-decoration-color: var(--brass); text-decoration-thickness: 1px; }
.reading__body a:hover { text-decoration-thickness: 2px; }
.reading__body ul, .reading__body ol { padding-left: 1.3em; }
.reading__body li + li { margin-top: 0.4em; }
.reading__body li::marker { color: var(--brass-ink); }
.reading__body strong { font-weight: 700; }
.reading__body blockquote {
  margin-inline: 0; padding: 0.25em 0 0.25em 1.25em; border-left: 2px solid var(--brass);
  font-style: italic; font-size: 1.15em; line-height: 1.45; color: var(--forest);
}
.reading__body blockquote cite { display: block; margin-top: 0.75em; font: 600 var(--t-meta)/1.3 var(--sans); font-style: normal; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); }
.reading__body .wp-block-pullquote { margin-block: 2em; padding: 1.5em 0; border-top: 1px solid var(--brass); border-bottom: 1px solid var(--brass); text-align: center; }
.reading__body .wp-block-pullquote blockquote { border: 0; padding: 0; font-size: 1.5em; line-height: 1.25; }
.reading__body hr, .reading__body .wp-block-separator { width: 5rem; height: 1px; margin: 2.5em auto; border: 0; background: var(--brass); opacity: 1; }
.reading__body img { border-radius: 2px; }
.reading__body figure { margin-inline: 0; }
.reading__body .wp-block-image, .reading__body .wp-block-embed, .reading__body .wp-block-video { margin-block: 2em; }
.reading__body .alignwide { width: min(100vw - 2 * var(--gutter), 64rem); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.reading__body .alignfull { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.reading__body .wp-block-table { overflow-x: auto; }
.reading__body table { width: 100%; border-collapse: collapse; font: 400 var(--t-small)/1.5 var(--sans); }
.reading__body th, .reading__body td { padding: 0.625rem 0.75rem; border-bottom: 1px solid var(--rule); text-align: left; }
.reading__body th { font-weight: 600; border-bottom-color: var(--charcoal); }
.reading__body code { font-size: 0.8em; background: var(--ivory-shade); padding: 0.1em 0.35em; border-radius: 2px; }

/* A drop capital opens every entry, as in a bound volume. */
.reading__body--drop > p:first-child::first-letter,
.reading__body--drop > p:first-of-type::first-letter {
  float: left; margin: 0.06em 0.1em 0 0; padding: 0;
  font: 600 4.3em/0.78 var(--serif); color: var(--forest);
}

.reading__foot { margin-top: clamp(3rem, 7vw, 4.5rem); }
.reading__foot .reading__col { display: grid; gap: 2.25rem; padding-top: 2rem; border-top: 1px solid var(--charcoal); }
.subjects ul { list-style: none; padding: 0; margin-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.subjects a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0.3rem 1rem; border: 1px solid rgba(32, 33, 30, 0.34); border-radius: 999px; font: 500 1.125rem/1.1 var(--serif); text-decoration: none; }
.subjects a:hover { background: var(--forest); border-color: var(--forest); color: var(--ivory); }
.share__buttons { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 0.75rem; }
.share__status { min-height: 1.5em; margin-top: 0.5rem; font-size: var(--t-small); color: var(--forest); }

.filed { display: flex; align-items: center; gap: 1.25rem; padding: 1.25rem; background-color: var(--ivory-shade); text-decoration: none; border-left: 3px solid var(--brass); }
.filed__text { display: grid; gap: 0.375rem; }
.filed__title { font: 500 var(--t-h3)/1.05 var(--serif); }
.filed__more { display: inline-flex; align-items: center; gap: 0.75em; font: 600 var(--t-meta)/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--forest); }
.filed:hover .arr { transform: translateX(6px); }
.spine--mini { max-width: none; display: flex; flex: none; width: 2.5rem; height: 5.75rem; padding: 0.625rem 0; cursor: default; }
.spine--mini::before { top: 2rem; }
.spine--mini::after { bottom: 1rem; }
.spine--mini:hover { transform: none; }
.spine--mini .spine__num { font-size: 0.75rem; }

/* ---------- Page numbers ---------- */

.pager ul { list-style: none; padding: 0; margin: 2.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pager a, .pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.875rem; border: 1px solid var(--rule); font: 600 var(--t-small)/1 var(--sans); text-decoration: none; }
.pager .current { background: var(--forest); border-color: var(--forest); color: var(--ivory); }
.pager a:hover { border-color: var(--forest); color: var(--forest); }
