:root{
  --paper:        #FBF6EC;
  --side-nav-width: 220px;
  --paper-dim:    #F1E9D8;
  --brown:        #8B5E3C;
  --ink:          #362F3E;
  --ink-soft:     #6B6274;
  --sage:         #93AE8F;
  --sage-dark:    #5E7D5C;
  --blush:        #E7ABA8;
  --blush-dark:   #C97873;
  --periwinkle:   #A6B2D9;
  --periwinkle-dark:#6C7BAE;
  --gold:         #C79A4E;
  --card:         #FFFDF6;
  --line:         #DDD1B8;
  --shadow:       rgba(54,47,62,0.14);
}

*{ box-sizing:border-box; }

html{ scroll-behavior:smooth; }

body{
  margin:0;
  background:
    radial-gradient(circle at 15% 8%, rgba(166,178,217,0.10), transparent 40%),
    radial-gradient(circle at 85% 92%, rgba(231,171,168,0.12), transparent 45%),
    var(--paper);
  color:var(--ink);
  font-family:'Literata', Georgia, serif;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

h1,h2,h3,h4,.display{
  font-family:'Fraunces', serif;
  font-weight:700;
  letter-spacing:-0.01em;
  color:var(--ink);
  margin:0;
}

a{ color:inherit; }

::selection{ background:var(--periwinkle); color:#fff; }

:focus-visible{
  outline:3px solid var(--periwinkle-dark);
  outline-offset:3px;
}

/* ---------- Fade-in reveal on scroll ---------- */
html.js .reveal{
  opacity:0;
  transform:translateY(22px);
  transition:opacity .7s ease, transform .7s ease;
}
html.js .reveal.is-visible{
  opacity:1;
  transform:translateY(0);
}
html.js .reveal-fade{
  opacity:0;
  transition:opacity .6s ease;
}
html.js .reveal-fade.is-visible{
  opacity:1;
}

/* ---------- shared section shell ---------- */
section{
  max-width:900px;
  margin:0 auto;
  padding:96px 32px 40px 32px;
}
.eyebrow{
  font-family:'IBM Plex Mono', monospace;
  font-size:0.72rem;
  letter-spacing:0.16em;
  text-transform:uppercase;
  color:var(--sage-dark);
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-bottom:14px;
}
.eyebrow::before{
  content:"";
  width:22px; height:1px;
  background:var(--sage-dark);
  display:inline-block;
}

/* ---------- Hero / library card ---------- */
#hero{
  padding-top:70px;
  padding-bottom:70px;
  display:grid;
  grid-template-columns:220px 1fr;
  gap:44px;
  align-items:start;
}
.hero-panel{
  position:relative;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:10px;
  padding:32px 32px 24px 44px;
  box-shadow:0 12px 24px rgba(54,47,62,0.1);
  overflow:hidden;
}
.hero-panel::before{
  content:'';
  position:absolute;
  top:0;
  right:0;
  width:44px;
  height:44px;
  background:linear-gradient(135deg, rgba(255,255,255,0.96) 46%, rgba(233,224,201,0.78) 46%);
  border-bottom-left-radius:10px;
  border-right:1px solid rgba(54,47,62,0.08);
  border-bottom:1px solid rgba(54,47,62,0.08);
  box-shadow:-4px 4px 10px rgba(54,47,62,0.08);
}
.hero-panel::after{
  content:'';
  position:absolute;
  inset:0;
  background-image:linear-gradient(rgba(54,47,62,0.18) 1px, transparent 1px);
  background-size:100% 20px;
  opacity:0.72;
  pointer-events:none;
}
.hero-panel::before,
.hero-panel::after{
  z-index:0;
}
.hero-panel > *{
  position:relative;
  z-index:1;
}
.hero-panel .eyebrow{
  margin-bottom:16px;
}
.card-pocket{
  position:relative;
  width:220px;
  max-width:100%;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:4px;
  padding:18px;
  box-shadow:0 10px 24px var(--shadow);
  transform:rotate(-3deg);
  margin:0 auto 28px;
  overflow:visible;
}
.card-pocket::after{
  content:"No. 002026";
  position:absolute;
  bottom:-11px; right:10px;
  background:var(--gold);
  color:#fff;
  font-family:'IBM Plex Mono', monospace;
  font-size:0.62rem;
  letter-spacing:0.06em;
  padding:3px 8px;
  border-radius:2px;
  box-shadow:0 3px 6px var(--shadow);
}
.card-pocket .pin{
  position:absolute;
  width:12px;
  height:12px;
  border-radius:50%;
  background:radial-gradient(circle at 40% 35%, #f8f7f4 0%, #d7d3cb 25%, #a59f96 65%, #7c756a 100%);
  border:1px solid rgba(255,255,255,0.8);
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.7), 0 2px 6px rgba(32,28,26,0.24);
  z-index:2;
}
.card-pocket .pin::after{
  content:'';
  position:absolute;
  top:3px;
  left:3px;
  width:6px;
  height:6px;
  border-radius:50%;
  background:rgba(255,255,255,0.8);
}
.card-pocket .pin-top-left{ top:10px; left:10px; }
.card-pocket .pin-top-right{ top:10px; right:10px; }
.card-pocket img{
  width:100%;
  display:block;
  height:auto;
  border-radius:4px;
  filter:sepia(8%) saturate(105%);
}
#hero h1{
  font-size:clamp(2.4rem, 5vw, 3.4rem);
  line-height:1.05;
}
#hero .role{
  font-family:'Fraunces', serif;
  font-style:italic;
  font-weight:500;
  font-size:1.15rem;
  color:var(--periwinkle-dark);
  margin-top:6px;
}
#hero p.blurb{
  margin-top:18px;
  max-width:62ch;
  color:var(--ink-soft);
}
.stamp-row{
  margin-top:22px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.stamp{
  font-family:'IBM Plex Mono', monospace;
  font-size:0.7rem;
  letter-spacing:0.04em;
  padding:5px 10px;
  border:1px dashed var(--sage-dark);
  border-radius:3px;
  color:var(--sage-dark);
}

/* ---------- Section headers ---------- */
.section-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  border-bottom:2px solid var(--ink);
  padding-bottom:14px;
  margin-bottom:36px;
}
.section-head h2{ font-size:2rem; }
.section-head .tally{
  font-family:'IBM Plex Mono', monospace;
  font-size:0.75rem;
  color:var(--ink-soft);
}

/* ---------- Bookshelf ---------- */
.shelf{
  display:flex;
  align-items:flex-end;
  gap:10px;
  padding:0 10px 18px 10px;
  border-bottom:14px solid var(--brown);
  border-radius:2px 2px 0 0;
  position:relative;
  overflow-x:auto;
  scrollbar-width:thin;
}
.shelf::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-14px;
  height:8px;
  background:linear-gradient(180deg, rgba(0,0,0,0.15), transparent);
}

.book{
  flex:0 0 auto;
  width:64px;
  min-height:230px;
  border-radius:5px 5px 2px 2px;
  cursor:pointer;
  position:relative;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:16px 0;
  box-shadow:inset -6px 0 10px rgba(0,0,0,0.08), 0 4px 8px var(--shadow);
  transition:transform .2s ease, box-shadow .2s ease;
  border:1px solid rgba(0,0,0,0.06);
}
.book:hover, .book:focus-visible{
  transform:translateY(-14px) rotate(-1deg);
  box-shadow:inset -6px 0 10px rgba(0,0,0,0.08), 0 14px 22px var(--shadow);
}
.book.open{
  transform:translateY(-18px);
}
.book span{
  writing-mode:vertical-rl;
  font-family:'Fraunces', serif;
  font-weight:700;
  font-size:0.95rem;
  color:rgba(255,255,255,0.94);
  letter-spacing:0.01em;
  text-shadow:0 1px 2px rgba(0,0,0,0.15);
}
.book-1{ background:var(--sage); height:250px; }
.book-2{ background:var(--periwinkle); height:230px; }
.book-3{ background:var(--blush); height:210px; }
.book-4{ background:var(--gold); height:240px; }

.book-detail{
  display:grid;
  grid-template-rows:0fr;
  transition:grid-template-rows .55s ease, margin-top .55s ease;
  margin-top:0;
}
.book-detail.open{
  grid-template-rows:1fr;
  margin-top:28px;
}
.flip-stage{
  overflow:hidden;
  min-height:0;
  perspective:1500px;
}
.open-book{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:6px;
  padding:28px;
  box-shadow:0 12px 26px var(--shadow);
  transform-origin:top center;
  transform:rotateX(-90deg);
  opacity:0;
  transition:transform .5s cubic-bezier(.32,1.1,.6,1), opacity .3s ease;
}
.book-detail.open .open-book{
  transform:rotateX(0deg);
  opacity:1;
  transition-delay:.12s;
}
.open-book h3{ font-size:1.4rem; }
.open-book .by-line{
  font-family:'Fraunces', serif;
  font-style:italic;
  color:var(--ink-soft);
  font-size:0.95rem;
  margin-top:2px;
}
.genre-tags{
  margin:14px 0;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.genre-tags span{
  font-family:'IBM Plex Mono', monospace;
  font-size:0.68rem;
  letter-spacing:0.03em;
  padding:4px 9px;
  border-radius:12px;
  background:var(--paper-dim);
  color:var(--ink-soft);
}
.open-book img{
  width:100%;
  border-radius:4px;
  margin:14px 0;
  border:1px solid var(--line);
}
.open-book p{ color:var(--ink-soft); }
.borrow-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:16px;
  padding:9px 16px;
  background:var(--ink);
  color:var(--paper);
  text-decoration:none;
  border-radius:3px;
  font-family:'IBM Plex Mono', monospace;
  font-size:0.78rem;
  letter-spacing:0.03em;
  transition:background .2s ease;
}
.borrow-btn:hover{ background:var(--sage-dark); }
.borrow-btn svg{ width:15px; height:15px; fill:currentColor; }

/* ---------- Currently reading (research) ---------- */
.reading-entry{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:32px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:6px;
  padding:26px;
  margin-bottom:28px;
  box-shadow:0 8px 18px var(--shadow);
  position:relative;
}
.reading-entry::before{
  content:"";
  position:absolute;
  left:50%; top:16px; bottom:16px;
  width:1px;
  background:var(--line);
}
.reading-entry .bookmark{
  position:absolute;
  top:-6px; left:26px;
  width:20px; height:34px;
  background:var(--blush);
  clip-path:polygon(0 0,100% 0,100% 100%,50% 78%,0 100%);
}
.reading-entry h3{ font-size:1.25rem; }
.reading-entry .lab{
  font-family:'IBM Plex Mono', monospace;
  font-size:0.72rem;
  color:var(--sage-dark);
  text-transform:uppercase;
  letter-spacing:0.06em;
  margin:6px 0 10px 0;
}
.reading-entry p{ color:var(--ink-soft); font-size:0.95rem; }
.reading-imgs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  align-content:start;
}
.reading-imgs img{
  width:100%;
  border-radius:4px;
  border:1px solid var(--line);
}
.reading-imgs img:first-child{ grid-column:1 / -1; }

@media (max-width:720px){
  .reading-entry{ grid-template-columns:1fr; }
  .reading-entry::before{ display:none; }
}

/* ---------- Library card / contact ---------- */
#card .library-card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:6px;
  padding:32px;
  box-shadow:0 10px 22px var(--shadow);
  position:relative;
  max-width:720px;
  margin:0 auto;
}

/* ---------- Reviews page ---------- */
.review-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:22px 0 28px;
  background:rgba(255,255,255,0.9);
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
}
.review-tab{
  appearance:none;
  border:1px solid transparent;
  background:var(--paper);
  color:var(--ink);
  padding:12px 20px;
  border-radius:999px;
  font-family:'IBM Plex Mono', monospace;
  font-size:0.95rem;
  cursor:pointer;
  min-width:180px;
  text-align:center;
  transition:background .25s ease, color .25s ease, border-color .25s ease, transform .25s ease;
}
.review-tab:hover,
.review-tab:focus-visible{
  border-color:var(--periwinkle-dark);
  transform:translateY(-1px);
}
.review-tab.active{
  background:var(--periwinkle);
  color:#fff;
  border-color:var(--periwinkle);
}
.review-detail{
  display:none;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:10px;
  padding:28px 30px;
  box-shadow:0 12px 24px rgba(54,47,62,0.08);
  margin-bottom:22px;
}
.review-detail.active{
  display:block;
}
.review-detail h3{
  margin-top:0;
}
#card .library-card::before{
  content:"";
  position:absolute;
  top:0; left:0; right:0;
  height:8px;
  background:repeating-linear-gradient(90deg, var(--sage), var(--sage) 14px, var(--blush) 14px, var(--blush) 28px, var(--periwinkle) 28px, var(--periwinkle) 42px);
  border-radius:6px 6px 0 0;
}
#card .section-head{
  justify-content:center;
  text-align:center;
  flex-direction:column;
  align-items:center;
  gap:10px;
  margin-inline:auto;
  max-width:720px;
}
#card .section-head h2{
  margin:0;
  width:auto;
  text-align:center;
}
#card .section-head .tally{
  margin:0;
}
.card-title{
  text-align:center;
  font-family:'IBM Plex Mono', monospace;
  margin-top:0;
  font-size:0.72rem;
  letter-spacing:0.14em;
  text-transform:uppercase;
  color:var(--ink-soft);
  margin-bottom:18px;
}
.checkout-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 0;
  border-bottom:1px dashed var(--line);
  font-family:'Fraunces', serif;
  font-size:1.05rem;
}
.checkout-row:last-child{ border-bottom:none; }
.checkout-row .label{
  font-family:'IBM Plex Mono', monospace;
  font-size:0.72rem;
  color:var(--ink-soft);
  text-transform:uppercase;
  letter-spacing:0.06em;
}
.checkout-row a{
  text-decoration:none;
  color:var(--periwinkle-dark);
  font-weight:600;
}
.checkout-row a:hover{ color:var(--blush-dark); }

footer{
  text-align:center;
  padding:40px 32px 60px 32px;
  font-family:'IBM Plex Mono', monospace;
  font-size:0.7rem;
  color:var(--ink-soft);
  letter-spacing:0.04em;
}

/* ---------- responsive ---------- */
@media (max-width:820px){
  #hero{ grid-template-columns:1fr; text-align:center; }
  .card-pocket{ width:180px; margin:0 auto; transform:rotate(-2deg); }
  .stamp-row, .eyebrow{ justify-content:center; }
  section{ padding-left:22px; padding-right:22px; }
  .side-nav{ display:none; }
  .content{ margin-left:0; }
}

/* ---------- Side navigation (desktop) ---------- */
.side-nav{
  position:fixed;
  left:0; top:0; bottom:0;
  width:var(--side-nav-width);
  padding:28px 16px;
  background:linear-gradient(180deg,var(--card),var(--paper-dim));
  border-right:1px solid var(--line);
  box-shadow:2px 0 12px rgba(0,0,0,0.04);
  display:flex;
  flex-direction:column;
  gap:18px;
  align-items:flex-start;
  z-index:60;
}
.side-nav .name{
  font-family:'Fraunces', serif;
  font-size:1.25rem;
  font-weight:700;
  letter-spacing:-0.01em;
  color:var(--ink);
}
.side-nav nav{
  display:flex; flex-direction:column; gap:8px; width:100%;
}
.side-nav a{
  text-decoration:none;
  font-family:'IBM Plex Mono', monospace;
  color:var(--ink-soft);
  padding:10px 12px;
  border-radius:6px;
  width:100%;
  position:relative;
}
.side-nav nav a:hover, .side-nav nav a:focus-visible{ background:var(--blush); color:var(--ink); }
.side-nav a.active{
  background:var(--periwinkle);
  color:#fff;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,0.2);
  padding-right:24px;
}
.side-nav a.active::before{
  content:'';
  position:absolute;
  right:8px;
  top:calc(50% - 10px);
  width:10px;
  height:20px;
  background:#fff;
  clip-path:polygon(0 0,100% 0,100% 100%,45% 70%,0 100%);
}

.content{ margin-left:var(--side-nav-width); }

@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; scroll-behavior:auto !important; }
}
