/* ============================================================
   BOOK JOURNAL — DESIGN SYSTEM
   A quiet evening with tea, writing about books that changed you.

   Palette
     --paper        #FAF3EA  base page, warm unbleached page colour
     --paper-deep   #F0E6D6  recessed surfaces (sidebar, shelf strip)
     --card         #FFFDF9  card surface, slightly lifted off the page
     --ink          #463A35  primary text, warm soot rather than black
     --ink-soft     #8C7E73  secondary text, muted
     --rose         #C98DA0  primary accent — ribbon, links, spine
     --rose-deep    #AD6E83  hover state of primary accent
     --lavender     #C9BBE0  secondary accent — pills, focus rings
     --sage         #9FB08F  tertiary accent — "currently reading"
     --gold         #CFA254  favourites, quote highlight
     --border       #E7DAC4  hairline borders

   Type
     display  "Cormorant Garamond"  — titles, big numbers
     hand     "Caveat"              — journal thoughts, quotes
     body     "Quicksand"           — UI copy, buttons, labels
     mono     "Inter"               — dense data: admin tables, meta
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,500;1,600&family=Caveat:wght@500;600;700&family=Quicksand:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --paper: #FAF3EA;
  --paper-deep: #F0E6D6;
  --card: #FFFDF9;
  --ink: #463A35;
  --ink-soft: #8C7E73;
  --ink-faint: #B3A89C;
  --rose: #C98DA0;
  --rose-deep: #AD6E83;
  --lavender: #C9BBE0;
  --lavender-deep: #A892C9;
  --sage: #9FB08F;
  --sage-deep: #7E9270;
  --gold: #CFA254;
  --gold-deep: #B9853A;
  --border: #E7DAC4;
  --shadow-sm: 0 2px 10px rgba(70, 58, 53, 0.06);
  --shadow-md: 0 10px 30px rgba(70, 58, 53, 0.10);
  --shadow-lg: 0 20px 50px rgba(70, 58, 53, 0.16);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: 'Cormorant Garamond', serif;
  --font-hand: 'Caveat', cursive;
  --font-body: 'Quicksand', sans-serif;
  --font-mono: 'Inter', sans-serif;
}

/* Fixed genre accent palette — assigned deterministically per genre
   so colour quietly encodes which shelf a book belongs to. */
.accent-0 { --g: var(--rose);     --g-deep: var(--rose-deep); }
.accent-1 { --g: var(--lavender); --g-deep: var(--lavender-deep); }
.accent-2 { --g: var(--sage);     --g-deep: var(--sage-deep); }
.accent-3 { --g: var(--gold);     --g-deep: var(--gold-deep); }
.accent-4 { --g: #9FB6C4; --g-deep: #7C9CAC; }
.accent-5 { --g: #D49A85; --g-deep: #BD7B63; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 700px 500px at 8% -5%, rgba(201,141,160,0.10), transparent 60%),
    radial-gradient(ellipse 800px 600px at 100% 10%, rgba(201,187,224,0.12), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  background-attachment: fixed;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--ink); }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: var(--font-body); }

:focus-visible {
  outline: 2.5px solid var(--lavender-deep);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: #F1D7D0; color: var(--ink); }

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- buttons & small controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: var(--rose);
  color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover { background: var(--rose-deep); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--border); box-shadow: none; }
.btn.ghost:hover { background: var(--card); border-color: var(--rose); color: var(--rose-deep); }
.btn.sage { background: var(--sage); }
.btn.sage:hover { background: var(--sage-deep); }
.btn.danger { background: #fff; color: #B0566A; border-color: #EBC9D1; box-shadow: none; }
.btn.danger:hover { background: #FBEEF1; transform: translateY(-1px); }
.btn.small { padding: 7px 16px; font-size: 0.82rem; }

/* pill / filter buttons */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 17px;
  border-radius: 999px;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
  transition: all 0.18s ease;
  white-space: nowrap;
}
.pill:hover { border-color: var(--rose); color: var(--rose-deep); transform: translateY(-1px); }
.pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--g, var(--rose)); }

/* ---------- forms ---------- */

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}
.field .hint { font-size: 0.78rem; color: var(--ink-faint); margin-top: 6px; }
.input, textarea.input, select.input {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 0.96rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.input:focus, textarea.input:focus, select.input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 4px rgba(201,141,160,0.14);
  outline: none;
}
textarea.input { resize: vertical; min-height: 110px; line-height: 1.7; }
textarea.journal-area {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  line-height: 1.6;
  min-height: 180px;
  background-image: repeating-linear-gradient(var(--card), var(--card) 38px, var(--border) 39px);
  background-attachment: local;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.checkbox-field {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.9rem; font-weight: 600; color: var(--ink);
  cursor: pointer; padding: 6px 0;
}
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--rose); cursor: pointer; }

.mood-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.mood-picker input { display: none; }
.mood-picker label {
  padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); font-size: 0.86rem; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; transition: all 0.18s ease;
}
.mood-picker input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; }

/* dynamic quote rows in the admin form */
.quote-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; }
.quote-row textarea { flex: 1; }
.quote-row .remove-quote {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--card); color: var(--ink-faint);
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  transition: all 0.18s ease;
}
.quote-row .remove-quote:hover { background: #FBEEF1; color: #B0566A; border-color: #EBC9D1; }

/* ---------- flash messages ---------- */

.flash {
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  margin-bottom: 24px;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex; align-items: center; gap: 10px;
  animation: dropIn 0.4s ease;
}
.flash.success { background: #EEF3E8; color: #5E7249; border: 1.5px solid #D7E2C9; }
.flash.error { background: #FBEEF1; color: #A1495E; border: 1.5px solid #EBC9D1; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   PUBLIC SITE — header, hero, filters, shelf
   ============================================================ */

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(250, 243, 234, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .title { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.brand-text .subtitle { font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 14px; }
.search-form { position: relative; }
.search-form input {
  width: 240px; padding: 10px 16px 10px 38px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--card); font-size: 0.88rem;
}
.search-form input:focus { border-color: var(--rose); outline: none; box-shadow: 0 0 0 4px rgba(201,141,160,0.14); }
.search-form svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: 0.5; }

.hero {
  padding: 56px 0 36px;
  text-align: center;
}
.hero .eyebrow {
  font-family: var(--font-hand); font-size: 1.3rem; color: var(--rose-deep);
  display: inline-block; margin-bottom: 6px; transform: rotate(-2deg);
}
.hero h1 { font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 600; letter-spacing: -0.01em; }
.hero p.lede { max-width: 540px; margin: 14px auto 0; color: var(--ink-soft); font-size: 1.02rem; }

/* currently reading shelf — horizontal scroller */
.shelf {
  background: var(--paper-deep);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 26px 0;
  margin-bottom: 8px;
}
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.shelf-head h2 { font-size: 1.3rem; }
.shelf-head span { font-size: 0.8rem; color: var(--ink-soft); }
.shelf-row { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.shelf-card {
  flex: 0 0 auto; width: 130px; background: var(--card); border-radius: var(--radius-sm);
  padding: 10px; box-shadow: var(--shadow-sm); transition: transform 0.2s ease;
}
.shelf-card:hover { transform: translateY(-4px) rotate(-1deg); }
.shelf-card img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.shelf-card .t { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; line-height: 1.2; }
.shelf-card .a { font-size: 0.74rem; color: var(--ink-soft); margin-top: 2px; }

/* ---------- layout: sidebar + grid ---------- */

.layout { display: grid; grid-template-columns: 240px 1fr; gap: 36px; padding: 34px 0 80px; align-items: start; }
.sidebar { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 26px; }
.sidebar-block h3 {
  font-family: var(--font-body); font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-faint); margin-bottom: 12px;
}
.sidebar-block .pills { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.sidebar-block .pills .pill { width: 100%; justify-content: flex-start; }
.sidebar-block select.input { padding: 10px 14px; font-size: 0.88rem; }

/* ---------- entry cards ---------- */

.entries-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.entries-count { color: var(--ink-soft); font-size: 0.9rem; }
.sort-form select.input { padding: 9px 14px; font-size: 0.85rem; width: auto; }

.entries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 26px;
}

.entry-card {
  position: relative;
  display: flex;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  opacity: 0;
  transform: translateY(14px);
  animation: cardIn 0.6s ease forwards;
}
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }
.entry-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }

/* the signature stitched spine — encodes genre colour */
.entry-card .spine {
  width: 16px; flex-shrink: 0; background: var(--g, var(--rose));
  background-image: repeating-linear-gradient(
    to bottom, transparent 0, transparent 9px,
    rgba(255,255,255,0.55) 9px, rgba(255,255,255,0.55) 11px
  );
  position: relative;
}
.entry-card .spine::after {
  content: ''; position: absolute; inset: 0; left: 50%; width: 1px;
  border-left: 1.5px dashed rgba(255,255,255,0.65);
}

.entry-card .body { padding: 20px 22px 22px; flex: 1; min-width: 0; }
.entry-card .top-row { display: flex; gap: 14px; margin-bottom: 14px; }
.entry-card .cover { width: 64px; height: 92px; flex-shrink: 0; border-radius: 9px; overflow: hidden; box-shadow: var(--shadow-sm); }
.entry-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.entry-card .heading { min-width: 0; }
.entry-card .heading .title-link { font-family: var(--font-display); font-weight: 700; font-size: 1.32rem; line-height: 1.18; display: block; transition: color 0.18s ease; }
.entry-card:hover .heading .title-link { color: var(--g-deep, var(--rose-deep)); }
.entry-card .heading .author { font-size: 0.85rem; color: var(--ink-soft); margin-top: 3px; }
.entry-card .meta-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.entry-card .date { font-size: 0.74rem; color: var(--ink-faint); }
.entry-card .genre-tag { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--g, var(--rose)) 18%, white); color: var(--g-deep, var(--rose-deep)); }
.entry-card .mood-tag { font-size: 0.74rem; color: var(--ink-soft); }

.entry-card .thoughts-preview {
  font-family: var(--font-hand); font-size: 1.18rem; line-height: 1.5; color: var(--ink);
  margin-top: 4px;
}
.entry-card .read-more { display: inline-block; margin-top: 10px; font-size: 0.78rem; font-weight: 700; color: var(--g-deep, var(--rose-deep)); }
.entry-card .read-more::after { content: ' →'; }

/* ribbon tab — favourite / currently reading badges hanging off the corner */
.ribbon-stack { position: absolute; top: -2px; right: 22px; display: flex; gap: 6px; z-index: 2; }
.ribbon {
  width: 26px; padding: 8px 0 14px; text-align: center; font-size: 0.85rem;
  border-radius: 0 0 4px 4px; box-shadow: var(--shadow-sm);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
}
.ribbon.fav { background: var(--gold); }
.ribbon.reading { background: var(--sage); }

.empty-state {
  text-align: center; padding: 70px 20px; color: var(--ink-soft);
  background: var(--card); border-radius: var(--radius-lg); border: 1.5px dashed var(--border);
}
.empty-state .big { font-family: var(--font-hand); font-size: 1.6rem; color: var(--ink); margin-bottom: 8px; display: block; }

/* ============================================================
   PUBLIC JOURNAL — dashboard-style feed
   (sidebar nav + topbar greeting + hero + card grid)
   ============================================================ */

.journal-shell { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding: 28px 0 80px; align-items: start; }

.journal-sidebar {
  position: sticky; top: 28px;
  background: var(--paper-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  display: flex; flex-direction: column; gap: 22px;
}
.journal-sidebar .brand-block .title { font-size: 1.5rem; }
.journal-sidebar .brand-block .tagline { font-family: var(--font-hand); font-size: 1.05rem; color: var(--rose-deep); margin-top: 2px; }

.journal-nav { display: flex; flex-direction: column; gap: 3px; }
.journal-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.92rem; color: var(--ink-soft); transition: all 0.18s ease;
}
.journal-nav a:hover { background: var(--card); color: var(--ink); }
.journal-nav a.active { background: var(--rose); color: #fff; }

.sidebar-genres { display: flex; flex-direction: column; gap: 2px; }
.sidebar-genres .heading {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  color: var(--ink-faint); padding: 0 12px; margin-bottom: 8px;
}
.sidebar-genres a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600; color: var(--ink); transition: background 0.18s ease;
}
.sidebar-genres a:hover, .sidebar-genres a.active { background: var(--card); }
.sidebar-genres .swatch { width: 10px; height: 10px; border-radius: 50%; background: var(--g); flex-shrink: 0; }
.sidebar-genres .gname { flex: 1; }
.sidebar-genres .gcount { font-size: 0.76rem; color: var(--ink-faint); }

.sidebar-quote {
  background: var(--card); border: 1.5px dashed var(--border); border-radius: var(--radius-md);
  padding: 18px; text-align: center; font-family: var(--font-hand); font-size: 1.15rem; color: var(--ink-soft); line-height: 1.4;
}

/* ---------- topbar: greeting + search + avatar ---------- */

.journal-topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.journal-topbar h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
.journal-topbar .tagline-quote { font-family: var(--font-display); font-style: italic; color: var(--ink-soft); margin-top: 6px; font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.avatar-circle {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; box-shadow: var(--shadow-sm);
}

/* ---------- promo card + hero banner ---------- */

.welcome-row { display: grid; grid-template-columns: 1fr 1.6fr; gap: 20px; margin-bottom: 28px; }
.promo-card {
  background: linear-gradient(160deg, var(--blush, #F1D7D0), var(--card) 70%);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px 24px; display: flex; flex-direction: column; gap: 10px; justify-content: center;
}
.promo-card .icon { font-size: 1.8rem; }
.promo-card h3 { font-size: 1.25rem; }
.promo-card p { color: var(--ink-soft); font-size: 0.88rem; line-height: 1.5; }
.promo-card .btn { align-self: flex-start; margin-top: 6px; }

.hero-banner { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.hero-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- pills + sort + view toggle bar ---------- */

.controls-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.controls-bar .pills-row { display: flex; gap: 8px; flex-wrap: wrap; }
.controls-right { display: flex; align-items: center; gap: 10px; }
.view-toggle { display: flex; border: 1.5px solid var(--border); border-radius: 999px; overflow: hidden; }
.view-toggle button {
  border: none; background: var(--card); padding: 8px 12px; display: flex; align-items: center; color: var(--ink-soft);
  transition: all 0.18s ease;
}
.view-toggle button.active { background: var(--ink); color: #fff; }

/* ---------- book grid + cards (dashboard style) ---------- */

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.book-grid.is-list { grid-template-columns: 1fr; }

.book-card {
  position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-sm); transition: transform 0.22s ease, box-shadow 0.22s ease;
  opacity: 0; transform: translateY(12px); animation: cardIn 0.55s ease forwards;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.book-grid.is-list .book-card { display: flex; gap: 22px; align-items: flex-start; }

.book-card .status-icon {
  position: absolute; top: 16px; right: 16px; font-size: 1rem; color: var(--ink-faint);
}
.book-card .status-icon.is-fav { color: var(--gold-deep); }
.book-card .card-top { display: flex; gap: 14px; margin-bottom: 14px; }
.book-grid.is-list .book-card .card-top { margin-bottom: 0; flex-shrink: 0; width: 230px; }
.book-card .cover-thumb { width: 68px; height: 96px; flex-shrink: 0; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.book-card .cover-thumb img { width: 100%; height: 100%; object-fit: cover; }
.book-card .card-title { font-family: var(--font-display); font-weight: 700; font-size: 1.22rem; line-height: 1.2; display: block; }
.book-card:hover .card-title { color: var(--g-deep, var(--rose-deep)); }
.book-card .card-author { font-size: 0.83rem; color: var(--ink-soft); margin-top: 3px; }
.book-card .card-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.book-card .card-meta .genre-tag { font-size: 0.68rem; padding: 3px 9px; }
.book-card .card-meta .card-date { font-size: 0.72rem; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 4px; }

.book-card .thoughts-label, .book-card .quotes-label {
  font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 0.95rem;
  color: var(--g-deep, var(--rose-deep)); margin-bottom: 5px; display: block;
}
.book-card .thoughts-text {
  font-family: var(--font-display); font-style: italic; font-size: 1.02rem; line-height: 1.5; color: var(--ink);
  margin-bottom: 14px;
}
.book-card .quote-highlight {
  background: color-mix(in srgb, var(--g, var(--gold)) 14%, var(--paper));
  border-radius: var(--radius-sm); padding: 12px 16px; font-family: var(--font-display); font-style: italic;
  font-size: 0.92rem; color: var(--ink); position: relative;
}
.book-card .quote-highlight::before { content: '\201C'; color: var(--g-deep, var(--gold-deep)); font-size: 1.3rem; margin-right: 2px; }
.book-card .quote-more { font-size: 0.74rem; color: var(--ink-faint); margin-top: 6px; }

/* ---------- closing encouragement banner ---------- */

.closing-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: var(--paper-deep); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px 28px; margin-top: 36px;
}
.closing-banner p { font-family: var(--font-hand); font-size: 1.25rem; color: var(--ink); }
.closing-banner p span { display: block; font-family: var(--font-body); font-size: 0.8rem; color: var(--ink-soft); margin-top: 2px; }

@media (max-width: 980px) {
  .journal-shell { grid-template-columns: 1fr; }
  .journal-sidebar { position: static; }
  .welcome-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .book-grid.is-list .book-card { flex-direction: column; }
  .book-grid.is-list .book-card .card-top { width: auto; }
}



.entry-page { padding: 40px 0 90px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 0.86rem; font-weight: 600; margin-bottom: 26px; }
.back-link:hover { color: var(--rose-deep); }

.open-book {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: pageReveal 0.7s cubic-bezier(.2,.8,.2,1);
}
@keyframes pageReveal { from { opacity: 0; transform: translateY(18px) rotateX(4deg); } to { opacity: 1; transform: translateY(0) rotateX(0); } }

.open-book .deckle {
  height: 26px;
  background: var(--g, var(--rose));
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='26' viewBox='0 0 40 26'%3E%3Cpath d='M0 26V8 C5 18 8 0 13 8 C18 18 20 0 26 8 C31 18 34 0 40 8 V26Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='26' viewBox='0 0 40 26'%3E%3Cpath d='M0 26V8 C5 18 8 0 13 8 C18 18 20 0 26 8 C31 18 34 0 40 8 V26Z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x;
  -webkit-mask-size: 40px 26px; mask-size: 40px 26px;
}

.book-header { display: flex; gap: 30px; padding: 36px 44px 24px; flex-wrap: wrap; }
.book-header .cover-lg { width: 160px; flex-shrink: 0; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-md); }
.book-header .cover-lg img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.book-header .info { flex: 1; min-width: 220px; padding-top: 4px; }
.book-header h1 { font-size: clamp(1.9rem, 3.4vw, 2.6rem); margin-bottom: 6px; }
.book-header .author { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 14px; }
.book-header .tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.book-divider { height: 1px; background: repeating-linear-gradient(to right, var(--border) 0 8px, transparent 8px 14px); margin: 0 44px; }

.thoughts-section { padding: 30px 44px; }
.thoughts-section h3, .quotes-section h3 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); font-weight: 700; margin-bottom: 16px;
}
.thoughts-body {
  font-family: var(--font-hand); font-size: 1.5rem; line-height: 1.65; color: var(--ink);
  white-space: pre-wrap;
}

.quotes-section { padding: 6px 44px 44px; }
.quote-block {
  position: relative;
  font-family: var(--font-display); font-style: italic; font-size: 1.2rem; line-height: 1.55;
  color: var(--ink); background: linear-gradient(100deg, color-mix(in srgb, var(--g, var(--gold)) 16%, var(--paper)) 0%, transparent 70%);
  border-left: 3px solid var(--g, var(--gold));
  padding: 16px 22px; margin: 0 0 16px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: transform 0.2s ease;
}
.quote-block:nth-child(even) { transform: rotate(-0.4deg); }
.quote-block:nth-child(odd) { transform: rotate(0.4deg); }
.quote-block:hover { transform: scale(1.01); box-shadow: var(--shadow-sm); }
.quote-block::before { content: '"'; font-family: var(--font-display); font-size: 2.4rem; color: var(--g, var(--gold)); position: absolute; top: -6px; left: -2px; opacity: 0.5; }

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

.site-footer { text-align: center; padding: 36px 0 50px; color: var(--ink-faint); font-size: 0.82rem; }
.site-footer .scribble { font-family: var(--font-hand); font-size: 1.1rem; color: var(--ink-soft); display: block; margin-bottom: 6px; }

/* ============================================================
   LANDING PAGE — login/register entry point
   ============================================================ */

.landing-hero { padding-bottom: 30px; }
.cta-row { display: flex; gap: 14px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.demo-link { margin-top: 16px; font-size: 0.88rem; color: var(--ink-soft); }
.demo-link a { color: var(--rose-deep); font-weight: 700; }

.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px;
  margin: 10px 0 70px;
}
.feature-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px 26px; box-shadow: var(--shadow-sm); border-top: 4px solid var(--g, var(--rose));
}
.feature-icon { font-size: 1.8rem; display: block; margin-bottom: 14px; }
.feature-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.feature-card p { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.55; }
.feature-card code { background: var(--paper-deep); padding: 1px 7px; border-radius: 5px; font-size: 0.85rem; }

/* ---------- platform utility bar (sits above the journal header) ---------- */

.utility-bar { background: var(--ink); color: rgba(255,255,255,0.75); font-size: 0.8rem; }
.utility-bar-inner { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
.utility-bar a { color: rgba(255,255,255,0.75); transition: color 0.18s ease; }
.utility-bar a:hover { color: #fff; }
.utility-actions { display: flex; gap: 18px; }

/* ---------- register page slug field ---------- */

.login-card.wide { max-width: 520px; }
.slug-field { display: flex; align-items: stretch; border-radius: var(--radius-sm); overflow: hidden; border: 1.5px solid var(--border); }
.slug-field .slug-prefix {
  background: var(--paper-deep); color: var(--ink-soft); font-size: 0.88rem; font-weight: 600;
  display: flex; align-items: center; padding: 0 12px; white-space: nowrap; border-right: 1.5px solid var(--border);
}
.slug-field input { border: none; border-radius: 0; }
.slug-field input:focus { box-shadow: none; }
.switch-link { margin-top: 22px; font-size: 0.86rem; color: var(--ink-soft); }
.switch-link a { color: var(--rose-deep); font-weight: 700; }



body.admin { background-color: var(--paper-deep); }

.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-nav {
  background: var(--ink); color: #EFE6DB; padding: 28px 22px;
  display: flex; flex-direction: column; gap: 26px;
}
.admin-nav .brand-text .title { color: #fff; }
.admin-nav .brand-text .subtitle { color: rgba(255,255,255,0.5); }
.admin-nav .mark { background: linear-gradient(135deg, var(--rose), var(--lavender)); }
.admin-nav nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.admin-nav nav a {
  padding: 11px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.92rem;
  color: rgba(239,230,219,0.78); transition: all 0.18s ease; display: flex; align-items: center; gap: 10px;
}
.admin-nav nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.admin-nav nav a.active { background: var(--rose); color: #fff; }
.admin-nav .logout { margin-top: auto; }
.admin-nav .logout a { color: rgba(239,230,219,0.6); font-size: 0.85rem; }
.admin-nav .logout a:hover { color: #fff; }

.admin-main { padding: 36px 44px 60px; max-width: 1180px; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 14px; }
.admin-topbar h1 { font-size: 1.9rem; }
.admin-topbar p { color: var(--ink-soft); font-size: 0.92rem; margin-top: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 34px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.stat-card .num { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; }
.stat-card .label { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 26px 28px; box-shadow: var(--shadow-sm); margin-bottom: 28px;
}
.panel h2 { font-size: 1.25rem; margin-bottom: 18px; }

.admin-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 0.88rem; }
.admin-table th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-faint); padding: 0 12px 12px; border-bottom: 1.5px solid var(--border); font-weight: 600;
}
.admin-table td { padding: 14px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .row-cover { width: 42px; height: 58px; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-table .row-cover img { width: 100%; height: 100%; object-fit: cover; }
.admin-table .row-title { font-family: var(--font-body); font-weight: 700; color: var(--ink); }
.admin-table .row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.admin-table .badge { font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }

.cover-upload {
  display: flex; align-items: center; gap: 16px; padding: 16px; border: 1.5px dashed var(--border);
  border-radius: var(--radius-md); background: var(--paper);
}
.cover-upload .preview { width: 80px; height: 112px; border-radius: 10px; overflow: hidden; background: var(--card); box-shadow: var(--shadow-sm); flex-shrink: 0; }
.cover-upload .preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-upload label.upload-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--border); font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.cover-upload label.upload-btn:hover { border-color: var(--rose); color: var(--rose-deep); }
.cover-upload input[type=file] { display: none; }

.genre-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.genre-row:last-child { border-bottom: none; }
.genre-row .left { display: flex; align-items: center; gap: 12px; }
.genre-row .swatch { width: 14px; height: 14px; border-radius: 50%; background: var(--g); }
.genre-row .count { font-size: 0.78rem; color: var(--ink-faint); }

/* ---------- admin login ---------- */

.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); padding: 40px 36px;
  text-align: center;
}
.login-card .mark { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 50%; background: linear-gradient(135deg, var(--rose), var(--lavender)); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.login-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.login-card p.sub { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 26px; }
.login-card form { text-align: left; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- modal-ish confirm ---------- */

.confirm-note { font-size: 0.85rem; color: var(--ink-soft); margin-top: -8px; margin-bottom: 18px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-nav { flex-direction: row; align-items: center; padding: 16px 20px; }
  .admin-nav nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .admin-nav .logout { margin-top: 0; margin-left: auto; }
  .admin-main { padding: 26px 20px 50px; }
}
@media (max-width: 640px) {
  .container { padding: 0 18px; }
  .site-header .bar { flex-wrap: wrap; gap: 12px; }
  .search-form input { width: 100%; }
  .book-header { padding: 28px 22px 18px; }
  .thoughts-section, .quotes-section { padding: 24px 22px; }
  .book-divider { margin: 0 22px; }
  .entries-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

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