/* ============================================================
   Athanasius — The Library
   Same house as athanasius.com: near-black over deep green,
   desert-sand gold, Cinzel / Cormorant Garamond / Jost.
   Books stand as spines on a gilt shelf board.
   ============================================================ */

:root {
  --black:      #060606;
  --ink:        #0B0C0B;
  --green-deep: #05130C;
  --green-panel:#0A2416;
  --green-line: #17402A;
  --sand:       #C9AE7C;
  --sand-lt:    #E8D3A0;
  --sand-dim:   #8C7648;
  --paper:      #EDE3CE;

  --cloth-harvard-a: #0F2E1C;
  --cloth-harvard-b: #05130C;
  --cloth-loeb-la-a: #5A2019;
  --cloth-loeb-la-b: #2A0E0A;
  --cloth-loeb-gr-a: #12482B;
  --cloth-loeb-gr-b: #06200F;
  --cloth-other-a:   #C9AE7C;
  --cloth-other-b:   #8C7648;

  --display: 'Cinzel', Georgia, serif;
  --body:    'Cormorant Garamond', Georgia, serif;
  --util:    'Jost', 'Helvetica Neue', Arial, sans-serif;

  --maxw: 1120px;
  --measure: 33em;
}

* { box-sizing: border-box; }

/* .drawer and .reader set display, which would otherwise beat [hidden] */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background:
    radial-gradient(1200px 620px at 50% -8%, #0A2416 0%, rgba(10,36,22,0) 62%),
    linear-gradient(180deg, #060606 0%, #05130C 42%, #060606 100%);
  background-attachment: fixed;
  color: var(--paper);
  font-family: var(--body);
  font-size: 19px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* film grain, same as the marketing page */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='300' height='300' filter='url(%23n)'/></svg>");
}

.sprite { position: absolute; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }

.vh {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 90;
  background: var(--sand); color: var(--black);
  padding: 12px 20px; font-family: var(--util); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase; text-decoration: none;
}
.skip:focus { left: 12px; top: 12px; }

:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; }

.eyebrow {
  font-family: var(--util); font-size: .68rem; font-weight: 400;
  letter-spacing: .4em; text-transform: uppercase; color: var(--sand);
  margin: 0 0 18px;
}

/* ---------- masthead ---------------------------------------- */

.masthead { padding: 52px 0 0; text-align: center; position: relative; z-index: 1; }

.mark { width: 108px; height: auto; display: block; margin: 0 auto 20px; }

.wordmark {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(2.3rem, 7vw, 4.4rem);
  letter-spacing: .22em; margin: 0; padding-left: .22em;
  color: var(--sand-lt);
  text-shadow: 0 0 34px rgba(201,174,124,.22);
}

.slogan {
  font-family: var(--util); font-weight: 300;
  font-size: clamp(.7rem, 2vw, .9rem);
  letter-spacing: .42em; text-transform: uppercase;
  color: var(--sand); margin: 14px 0 0; padding-left: .42em;
}

.rule {
  height: 1px; margin: 34px auto 0; max-width: 720px;
  background: linear-gradient(90deg, transparent, var(--sand-dim) 18%, var(--sand) 50%, var(--sand-dim) 82%, transparent);
  opacity: .7;
}

/* ---------- tabs -------------------------------------------- */

.tabs { margin: 26px auto 0; }

.tab-list {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px;
  list-style: none; margin: 0; padding: 0 20px 2px;
}

.tab {
  font-family: var(--util); font-weight: 400; font-size: .78rem;
  letter-spacing: .24em; text-transform: uppercase;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--sand-dim); padding: 14px 22px 11px; cursor: pointer;
  transition: color .25s ease, border-color .25s ease;
}
.tab:hover { color: var(--sand-lt); }
.tab[aria-selected="true"] { color: var(--sand-lt); border-bottom-color: var(--sand); }

/* ---------- banner (the rotating epigraph) ------------------ */

.banner {
  position: relative; overflow: hidden; display: block; width: 100%;
  margin: 44px 0 58px; padding: 0; cursor: pointer; text-align: left;
  color: inherit; font: inherit;
  border: 0; border-top: 1px solid var(--green-line); border-bottom: 1px solid var(--green-line);
  background: linear-gradient(100deg, #040A07 0%, #0A2416 46%, #05130C 100%);
}
.banner::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(201,174,124,.055) 0 1px, transparent 1px 15px);
  mix-blend-mode: screen;
}

.banner-inner {
  display: block;
  max-width: var(--maxw); margin: 0 auto; padding: 58px 28px 54px;
  position: relative; z-index: 2;
}

.banner-glyph {
  position: absolute; right: -42px; top: 50%; transform: translateY(-50%);
  width: 340px; opacity: .13; z-index: 1;
}

.banner-quote {
  display: block;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2.75rem); line-height: 1.16;
  color: var(--sand-lt); max-width: 20ch;
  transition: opacity .42s ease;
}

.banner-cite {
  display: block; margin-top: 22px;
  font-family: var(--util); font-size: .68rem; font-weight: 400;
  letter-spacing: .3em; text-transform: uppercase; color: var(--sand-dim);
  transition: opacity .42s ease;
}

.banner.is-turning .banner-quote,
.banner.is-turning .banner-cite { opacity: 0; }

/* ---------- toolbar ----------------------------------------- */

.tools {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding-bottom: 16px; border-bottom: 1px solid var(--green-line);
}

.search input {
  background: transparent; border: 0; border-bottom: 1px solid var(--green-line);
  color: var(--sand-lt); font-family: var(--util); font-weight: 300;
  font-size: .78rem; letter-spacing: .14em; padding: 9px 2px; width: 230px;
}
.search input::placeholder { color: var(--sand-dim); }
.search input:focus { outline: none; border-bottom-color: var(--sand); }

.tools-count {
  margin: 0; font-family: var(--util); font-size: .68rem;
  letter-spacing: .28em; text-transform: uppercase; color: var(--sand-dim);
}

/* ---------- shelves ----------------------------------------- */

.shelves { padding: 52px 0 40px; outline: none; }

.shelf-group + .shelf-group { margin-top: 66px; }

.shelf-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 30px; }

.shelf-head h2 {
  margin: 0; font-family: var(--display); font-weight: 400;
  font-size: 1.05rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--sand-lt);
}

.shelf-head-rule { flex: 1; height: 1px; background: var(--green-line); }

.shelf-head-n {
  font-family: var(--util); font-size: .68rem; letter-spacing: .24em; color: var(--sand-dim);
}

.shelf {
  display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; row-gap: 0;
  position: relative;
  padding-bottom: 3px;
}
/* the shelf board: the same gilt rule as the masthead */
.shelf::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--sand) 0%, var(--sand-dim) 42%, rgba(140,118,72,.25) 100%);
  opacity: .8;
}

.book { position: relative; padding-bottom: 26px; margin-bottom: -26px; }

.spine {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
  border: 1px solid var(--green-line);
  padding: 15px 0; cursor: pointer; position: relative;
  writing-mode: vertical-rl; text-orientation: mixed;
  background: linear-gradient(170deg, var(--cloth-harvard-a), var(--cloth-harvard-b));
  color: var(--sand-lt);
  transition: transform .22s cubic-bezier(.2,.7,.3,1), border-color .22s ease, box-shadow .22s ease;
}

.spine::before, .spine::after {
  content: ""; position: absolute; left: 5px; right: 5px; height: 1px;
  background: var(--sand); opacity: .5;
}
.spine::before { top: 9px; }
.spine::after  { bottom: 9px; }

.spine:hover, .spine:focus-visible {
  transform: translateY(-12px);
  border-color: var(--sand-dim);
  box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 22px rgba(201,174,124,.14);
}

.spine-title {
  font-family: var(--display); font-weight: 400;
  font-size: 12px; letter-spacing: .04em; line-height: 1.24;
  flex: 1 1 auto; min-width: 0; overflow: hidden;
}

.spine-author {
  flex: 0 0 auto; overflow: hidden;
  font-family: var(--util); font-weight: 300;
  font-size: 8.5px; letter-spacing: .18em; text-transform: uppercase;
  opacity: .74;
}

/* cloth variants */
.spine.cloth-harvard { background: linear-gradient(170deg, var(--cloth-harvard-a), var(--cloth-harvard-b)); }
.spine.cloth-loeb-la { background: linear-gradient(170deg, var(--cloth-loeb-la-a), var(--cloth-loeb-la-b));
                       border-color: rgba(201,174,124,.26); color: #F0DDBE; }
.spine.cloth-loeb-gr { background: linear-gradient(170deg, var(--cloth-loeb-gr-a), var(--cloth-loeb-gr-b));
                       border-color: rgba(201,174,124,.22); }
.spine.cloth-other   { background: linear-gradient(170deg, var(--cloth-other-a), var(--cloth-other-b));
                       border-color: rgba(6,6,6,.35); color: var(--ink); }
.spine.cloth-other::before, .spine.cloth-other::after { background: var(--green-deep); opacity: .45; }

/* widths and heights, deterministic per title so the shelf keeps a silhouette */
.spine.w1 { width: 50px; } .spine.w2 { width: 58px; }
.spine.w3 { width: 66px; } .spine.w4 { width: 78px; }
.spine.h1 { height: 232px; } .spine.h2 { height: 252px; }
.spine.h3 { height: 272px; } .spine.h4 { height: 292px; }

.dl {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--util); font-size: .62rem; letter-spacing: .16em;
  text-transform: uppercase; text-decoration: none;
  color: var(--sand-dim); border: 1px solid transparent;
  opacity: 0; transition: opacity .18s ease;
}
.book:hover .dl, .dl:focus-visible { opacity: 1; }
.dl:hover { color: var(--sand-lt); border-color: var(--green-line); }

.empty { font-style: italic; color: rgba(237,227,206,.6); padding: 46px 0; }

/* an empty shelf: the board is there, nothing standing on it yet */
.building {
  margin: 0; padding: 30px 0 34px;
  border-bottom: 1px solid var(--green-line);
  font-family: var(--util); font-weight: 300;
  font-size: .74rem; letter-spacing: .34em; text-transform: uppercase;
  color: var(--sand-dim);
}

/* ---------- drawer ------------------------------------------ */

.scrim { position: fixed; inset: 0; background: rgba(3,8,5,.72); z-index: 40; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(460px, 100%);
  background: linear-gradient(170deg, rgba(10,36,22,.97), rgba(5,19,12,.99)), var(--black);
  border-left: 1px solid var(--green-line);
  z-index: 50; display: flex; overflow: hidden;
  animation: slide-in .28s cubic-bezier(.2,.7,.3,1);
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }

.drawer-band { width: 8px; flex: 0 0 8px; background: var(--sand); }
.drawer-band.cloth-harvard { background: linear-gradient(180deg, var(--cloth-harvard-a), var(--cloth-harvard-b)); }
.drawer-band.cloth-loeb-la { background: linear-gradient(180deg, var(--cloth-loeb-la-a), var(--cloth-loeb-la-b)); }
.drawer-band.cloth-loeb-gr { background: linear-gradient(180deg, var(--cloth-loeb-gr-a), var(--cloth-loeb-gr-b)); }
.drawer-band.cloth-other   { background: linear-gradient(180deg, var(--cloth-other-a), var(--cloth-other-b)); }

.drawer-body { flex: 1; padding: 36px 34px 44px; overflow-y: auto; position: relative; }

.drawer-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: 0; font-size: 28px; line-height: 1;
  color: var(--sand-dim); cursor: pointer; padding: 4px 8px;
}
.drawer-close:hover { color: var(--sand-lt); }

.drawer-title {
  margin: 0; font-family: var(--display); font-weight: 600;
  font-size: 1.55rem; line-height: 1.2; letter-spacing: .02em; color: var(--sand-lt);
}

.drawer-author {
  margin: 12px 0 0; font-style: italic; font-weight: 300;
  color: rgba(237,227,206,.72);
}

.drawer-facts {
  margin: 26px 0 0; padding: 18px 0;
  border-top: 1px solid var(--green-line); border-bottom: 1px solid var(--green-line);
  display: grid; grid-template-columns: 104px 1fr; row-gap: 10px;
  font-size: 1rem; color: rgba(237,227,206,.86);
}
.drawer-facts dt {
  font-family: var(--util); font-weight: 300; font-size: .64rem;
  letter-spacing: .22em; text-transform: uppercase; color: var(--sand-dim);
  padding-top: 6px;
}
.drawer-facts dd { margin: 0; }

.drawer-desc { margin-top: 24px; }
.drawer-desc p { margin: 0 0 16px; font-weight: 300; color: rgba(237,227,206,.85); }

.drawer-actions { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; }

.action {
  display: block; width: 100%; text-align: center;
  font-family: var(--util); font-size: .72rem; font-weight: 400;
  letter-spacing: .28em; text-transform: uppercase; text-decoration: none;
  padding: 16px 24px; border: 1px solid var(--sand);
  color: var(--sand-lt); background: transparent; cursor: pointer;
  transition: background .3s ease, color .3s ease;
}
.action:hover { background: var(--sand); color: var(--black); }
.action.primary { background: var(--sand); color: var(--ink); border-color: var(--sand); }
.action.primary:hover { background: var(--sand-lt); border-color: var(--sand-lt); }
.action.is-off {
  border-color: var(--green-line); color: var(--sand-dim);
  cursor: default; pointer-events: none; background: transparent;
}

/* ---------- reader ------------------------------------------ */

.reader {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  --r-size: 21px;
}
.reader[data-mode="night"] {
  background:
    radial-gradient(900px 480px at 50% -10%, #0A2416 0%, rgba(10,36,22,0) 60%),
    linear-gradient(180deg, #060606 0%, #05130C 50%, #060606 100%);
  color: var(--paper);
}

.reader-progress {
  height: 2px; width: 0%;
  background: linear-gradient(90deg, var(--sand-dim), var(--sand));
  transition: width .09s linear;
}

.reader-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 24px; border-bottom: 1px solid rgba(140,118,72,.35);
}
.reader[data-mode="night"] .reader-bar { border-bottom-color: var(--green-line); }

.reader-running {
  margin: 0; font-family: var(--util); font-weight: 300; font-size: .64rem;
  letter-spacing: .22em; text-transform: uppercase; opacity: .62;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.reader-controls { display: flex; gap: 6px; }

.reader-btn {
  background: none; border: 1px solid transparent; color: inherit;
  font-family: var(--util); font-weight: 400; font-size: .68rem;
  letter-spacing: .18em; text-transform: uppercase;
  padding: 8px 13px; cursor: pointer;
}
.reader-btn:hover { border-color: rgba(140,118,72,.6); }

.reader-scroll { flex: 1; overflow-y: auto; padding: 66px 24px 130px; }

.reader-page {
  max-width: var(--measure); margin: 0 auto;
  font-family: var(--body); font-weight: 400;
  font-size: var(--r-size); line-height: 1.74;
}

.reader-page h1 {
  font-family: var(--display); font-weight: 600;
  font-size: 1.05em; letter-spacing: .22em; text-transform: uppercase;
  color: var(--sand-dim);
  margin: 0 0 44px; padding-bottom: 20px;
  border-bottom: 1px solid rgba(140,118,72,.45);
}
.reader[data-mode="night"] .reader-page h1 { color: var(--sand); }

.reader-page p { margin: 0 0 1.15em; text-wrap: pretty; }
.reader-page p:first-of-type::first-letter {
  float: left; font-family: var(--display); font-weight: 600;
  font-size: 3.6em; line-height: .8; padding: .05em .1em 0 0; color: var(--sand-dim);
}
.reader[data-mode="night"] .reader-page p:first-of-type::first-letter { color: var(--sand); }

.reader-nav {
  max-width: var(--measure); margin: 70px auto 0;
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid rgba(140,118,72,.45); padding-top: 22px;
}
.reader[data-mode="night"] .reader-nav { border-top-color: var(--green-line); }

.reader-move {
  background: none; border: 0; color: inherit;
  font-family: var(--util); font-size: .68rem; letter-spacing: .2em;
  text-transform: uppercase; cursor: pointer; padding: 8px 2px;
}
.reader-move[disabled] { opacity: .26; cursor: default; }
.reader-move:not([disabled]):hover { color: var(--sand-dim); }

/* ---------- footer ------------------------------------------ */

footer {
  margin-top: 96px; border-top: 1px solid var(--green-line);
  padding: 46px 24px 62px; text-align: center; position: relative; z-index: 1;
}
footer p {
  font-family: var(--util); font-weight: 300; font-size: .68rem;
  letter-spacing: .24em; text-transform: uppercase; color: var(--sand-dim); margin: 0;
}
footer a { color: var(--sand); text-decoration: none; }
footer a:hover { color: var(--sand-lt); }

.footer-line {
  font-family: var(--body); font-size: 1.05rem;
  letter-spacing: 0; text-transform: none;
  color: rgba(237,227,206,.8);
  max-width: 52ch; margin: 0 auto 22px;
}
.footer-line em { color: var(--sand-lt); }
.footer-line strong { color: var(--sand); font-weight: 600; }

/* ---------- the living eye ---------------------------------- */

.swirl { transform-origin: 112px 66px; animation: turn 46s linear infinite; }
@keyframes turn { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- small screens ----------------------------------- */

@media (max-width: 760px) {
  body { font-size: 18px; }
  .wrap { padding: 0 22px; }
  .masthead { padding: 38px 0 0; }
  .mark { width: 84px; }
  .banner-glyph { display: none; }
  .banner-inner { padding: 42px 22px 40px; }
  .banner { margin: 32px 0 44px; }
  .tab { padding: 12px 14px 9px; font-size: .7rem; letter-spacing: .18em; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .shelves { padding: 34px 0 20px; }

  .shelf { display: block; padding-bottom: 0; }
  .shelf::after { display: none; }

  .book {
    padding-bottom: 0; margin-bottom: 0;
    display: flex; align-items: stretch;
    border-bottom: 1px solid var(--green-line);
  }
  .spine {
    writing-mode: horizontal-tb;
    width: auto !important; height: auto !important; flex: 1;
    padding: 16px 18px;
    background: transparent !important;
    color: var(--paper) !important;
    border: 0; border-left: 4px solid var(--sand);
    align-items: flex-start; justify-content: center; gap: 4px;
    text-align: left; box-shadow: none;
  }
  .spine.cloth-harvard { border-left-color: var(--cloth-loeb-gr-a); }
  .spine.cloth-loeb-la { border-left-color: var(--cloth-loeb-la-a); }
  .spine.cloth-loeb-gr { border-left-color: var(--cloth-loeb-gr-a); }
  .spine.cloth-other   { border-left-color: var(--sand); }
  .spine::before, .spine::after { display: none; }
  .spine:hover, .spine:focus-visible { transform: none; box-shadow: none; }
  .spine-title { font-size: 1.05rem; }
  .spine-author { font-size: .6rem; }

  .dl {
    position: static; opacity: 1; width: 68px; flex: 0 0 68px; height: auto;
    border: 0; border-left: 1px solid var(--green-line);
  }

  .drawer { width: 100%; border-left: 0; }
  .reader-scroll { padding: 38px 20px 100px; }
}

@media (prefers-reduced-motion: reduce) {
  .swirl { animation: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .masthead, .banner, .tools, .drawer, .scrim, .reader-bar, .reader-nav, footer { display: none !important; }
  body::before { display: none; }
}
