/* Ensure any [hidden] element is truly hidden even if inline styles set display */
[hidden]{display:none !important}

/* Inspired by moosedept.org — friendly serif headings, roomy spacing, minimal chrome */
:root{
  /* Dark theme (default) */
  --bg:#111315;
  --surface:#171a1d;
  --surface-2:#1d2125;
  --ink:#e6e6e6;
  --muted:#a8b0b8;
  --line:#2a2f35;
  --link:#7dd3fc;
  --link-hover:#b3e7ff;
  --accent:#fbbf24;
  --shadow:0 10px 30px rgba(0,0,0,.3);

  --cover-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* Bootstrap sync */
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-primary: var(--link);
  --bs-primary-rgb: 125, 211, 252;
  --bs-secondary: var(--muted);
  --bs-warning: var(--accent);
  --bs-border-color: var(--line);
}

:root[data-theme="light"]{
  --bg:#ffffff;
  --surface:#f6f7f9;
  --surface-2:#ffffff;
  --ink:#0b1220;
  --muted:#4c5563;
  --line:#e5e7eb;
  --link:#2563eb;
  --link-hover:#1d4ed8;
  --accent:#b45309;
  --shadow:0 10px 30px rgba(0,0,0,.08);
  --cover-bg: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);

  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-primary: var(--link);
  --bs-primary-rgb: 37, 99, 235;
  --bs-secondary: var(--muted);
  --bs-warning: var(--accent);
  --bs-border-color: var(--line);
}

/* Admin editing controls - hidden by default */
.admin-controls {
  display: none;
}

/* Show admin controls when editing mode is enabled */
.editing-mode .admin-controls {
  display: block;
}

.editing-mode .admin-controls.d-inline {
  display: inline !important;
}

.editing-mode .admin-controls.d-flex {
  display: flex !important;
}

/* Admin dropdown button styling */
.dropdown-toggle.btn-ghost {
  border: none;
  background: transparent;
  color: var(--muted);
  transition: color 0.15s ease;
}

.dropdown-toggle.btn-ghost:hover,
.dropdown-toggle.btn-ghost:focus {
  color: var(--ink);
}

.dropdown-toggle.btn-ghost[aria-expanded="true"] {
  color: var(--ink);
}

/* Dropdown menu styling to match the theme */
.dropdown-menu {
  background-color: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  box-shadow: var(--shadow);
  min-width: 200px;
}

.dropdown-item {
  color: var(--ink);
  padding: 0.5rem 1rem;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--surface);
  color: var(--link);
}

.dropdown-header {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.dropdown-divider {
  border-top: 1px solid var(--line);
}

html{color-scheme:dark light}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:Roboto, Helvetica, sans-serif;
  line-height:1.6;
}

/* Bootstrap overrides */
.container-fluid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

h1,h2,h3{
  font-family:'Roboto Slab', Georgia, 'Times New Roman', Times, serif;
  line-height:1.2;
  margin:0 0 .5rem;
  color:var(--ink);
  font-weight: 600;
}

/* Site name should be white, not link color */
.brand{color:var(--ink)}
.brand:hover{color:var(--ink)}
.brand-name{font-weight:700; font-size:1.15rem}

.site-header{position:sticky; top:0; z-index:100; backdrop-filter:saturate(180%) blur(8px); background:color-mix(in oklab, var(--bg) 85%, transparent); border-bottom:1px solid var(--line)}

.site-header .tag{color:var(--muted);margin:.25rem 0 1rem}
.site-footer{
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:.9rem;
  background:var(--bg);
  margin-top: 2rem;
}

a{color:var(--link)}
a:hover{color:var(--link-hover)}

.intro{margin:2rem 0 1rem}
.lede{color:var(--muted);max-width:80ch}

.controls{margin:2rem 0}
.status{color:var(--muted);min-height:1.2em}
.login-link{margin-left:0;font-size:.9rem;color:var(--muted);text-decoration:none;opacity:.7}
.login-link:hover{opacity:1;text-decoration:underline; color:var(--link-hover)}

/* Bootstrap form overrides - need !important to override Bootstrap defaults */
.form-control, .form-control.input, .input, textarea.form-control{
  padding:.55rem .7rem;
  border:1px solid var(--line) !important;
  border-radius:.4rem;
  background:var(--bg) !important;
  color:var(--ink) !important;
}

.form-control:focus, .input:focus, textarea.form-control:focus {
  border-color: var(--link) !important;
  box-shadow: 0 0 0 0.2rem rgba(125, 211, 252, 0.25) !important;
  background:var(--bg) !important;
  color:var(--ink) !important;
}

/* Bootstrap background overrides for dark mode */
.bg-light {
  background-color: var(--surface) !important;
  border: 1px solid var(--line) !important;
}

.card {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
}

.card-body {
  color: var(--ink) !important;
}

.card-title {
  color: var(--ink) !important;
}

/* Form labels */
.form-label {
  color: var(--ink) !important;
}

/* Form text/help text */
.form-text {
  color: var(--muted) !important;
}

/* Placeholder text styling */
.form-control::placeholder,
.input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.form-control::-webkit-input-placeholder,
.input::-webkit-input-placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.form-control::-moz-placeholder,
.input::-moz-placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.form-control:-ms-input-placeholder,
.input:-ms-input-placeholder {
  color: var(--muted);
  opacity: 0.7;
}

/* Bootstrap text color overrides */
.text-muted {
  color: var(--muted) !important;
}

.text-danger {
  color: #dc3545 !important;
}

/* Bootstrap list overrides */
.list-unstyled li a {
  color: var(--link) !important;
  text-decoration: none;
}

.list-unstyled li a:hover {
  color: var(--link-hover) !important;
}

/* Small text */
.small {
  color: var(--muted) !important;
}

/* Ensure all Bootstrap containers respect our theme */
.container, .container-fluid, .container-lg {
  color: var(--ink);
}

/* Override any remaining Bootstrap defaults */
* {
  color: inherit;
}

/* Additional Bootstrap dark mode overrides */
.btn-outline-secondary {
  color: var(--muted) !important;
  border-color: var(--line) !important;
}

.btn-outline-secondary:hover {
  background-color: var(--surface) !important;
  border-color: var(--link) !important;
  color: var(--link) !important;
}

/* Ensure headings respect theme */
h1, h2, h3, h4, h5, h6 {
  color: var(--ink) !important;
}

/* Links in cards and other contexts */
a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

/* Bootstrap input groups if any */
.input-group-text {
  background-color: var(--surface) !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}

/* Ensure all forms and form elements use our theme */
form, fieldset, legend {
  color: var(--ink);
}

/* Make sure Bootstrap doesn't override our theme in any context */
.container *, .container-fluid *, .container-lg * {
  border-color: var(--line);
}

/* Final catch-all for any missed Bootstrap elements */
.bg-secondary {
  background-color: var(--surface-2) !important;
}

.text-secondary {
  color: var(--muted) !important;
}

.muted{color:var(--muted)}

/* Bootstrap button overrides */
.btn{
  border:1px solid var(--line);
  background:var(--surface);
  color:var(--ink);
  padding:.6rem .9rem;
  border-radius:.4rem;
  cursor:pointer;
  box-shadow:0 1px 0 rgba(0,0,0,.25);
}

.btn-primary {
  background-color: var(--link) !important;
  border-color: var(--link) !important;
  color: var(--bg) !important;
}

.btn-primary:hover {
  background-color: var(--link-hover) !important;
  border-color: var(--link-hover) !important;
  color: var(--bg) !important;
}

.btn-outline-primary {
  color: var(--link) !important;
  border-color: var(--link) !important;
  background-color: transparent !important;
}

.btn-outline-primary:hover {
  color: var(--bg) !important;
  background-color: var(--link) !important;
  border-color: var(--link) !important;
}

.btn-secondary {
  background-color: var(--bg) !important;
  border-color: var(--link) !important;
  color: var(--link) !important;
}

.btn:hover{border-color:var(--link)}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn-ghost{background:transparent}

/* Bootstrap alert overrides */
.alert {
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
  color: var(--ink);
}

.alert-success {
  border-color: #22c55e;
  background-color: var(--surface);
  color: var(--ink);
  border-left: 4px solid #22c55e;
}

.alert-warning {
  border-color: #f59e0b;
  background-color: var(--surface);
  color: var(--ink);
  border-left: 4px solid #f59e0b;
}

.alert-danger {
  border-color: #ef4444;
  background-color: var(--surface);
  color: var(--ink);
  border-left: 4px solid #ef4444;
}

.alert-info {
  border-color: var(--link);
  background-color: var(--surface);
  color: var(--ink);
  border-left: 4px solid var(--link);
}

.output{margin:1rem 0 2rem}
.story{
  background:transparent;
  border:none;
  border-radius:0;
  padding:0;
  min-height:auto;
  font-size:1.1rem;
  color:var(--ink);
  font-family:'Roboto Serif', Georgia, serif;
  line-height:1.8;
}

.art{margin:1rem 0;text-align:center}
.art img{max-width:100%;height:auto;border:none;border-radius:0;background:transparent}

/* two-column layout for story detail: image left, story right */
.art-left{margin:0}
.story-right{margin:0}

/* Archive tiles: make whole card clickable, no underline on text */
.story-tile{display:block;text-decoration:none;color:inherit}
.story-tile .tile-text{
  text-decoration:none;
  font-family:'Roboto Serif', Georgia, serif;
  line-height:1.8;
}
/* Remove hover effects on archive text */
.story-tile:hover .tile-text{color:inherit}

/* Mobile text truncation for archive tiles */
@media (max-width: 767px) {
  .tile-text {
    display: -webkit-box;
    font-size: 0.8rem;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5 !important;
    max-height: 6em; /* 4 lines at 1.5 line-height */
  }
}

/* Simple wait spinner when .waiting is applied (optional) */
body.waiting::after{
  content:"";position:fixed;inset:0;backdrop-filter:blur(2px);background:rgba(0,0,0,.1);pointer-events:none
}

/* homepage recent strip */
.recent-strip{margin:1rem 0 2rem}

/* Lightbox inner card look */
.lb-inner{background:#151515;border:1px solid var(--line);border-radius:.4rem}

/* recent strip link visuals */
.tile-link{display:block; width:100%; height:100%; text-decoration:none}
.tile-link:hover{outline:1px solid var(--link)}

/* Lightbox styles */
#lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.84);
  z-index: 1000;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-inner {
  position: relative;
  max-width: min(1100px, 100%);
  width: 100%;
  max-height: 95vh;
  background: #151515;
  border: 1px solid var(--line);
  border-radius: .4rem;
  padding: 0;
}

.lb-img {
  max-height: 40vh;
  width: calc(100% - 2rem);
  object-fit: contain;
  border: none;
  border-radius: 0;
  display: block;
}

.lb-text {
  max-height: 45vh;
  overflow-y: auto;
  padding: 1rem;
  box-sizing: border-box;
}

.lb-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none !important;
  border: none !important;
  color: var(--ink);
  font-size: 1.5rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  opacity: 0.8;
  box-shadow: none !important;
  outline: none !important;
}

.lb-close:hover {
  opacity: 1;
  color: var(--link-hover);
}

@media (min-width: 992px) {
  .lb-inner {
    max-height: 85vh;
  }
  
  .lb-text {
    max-height: 50vh;
    width: calc(100%);
    margin: 1rem;
    box-sizing: border-box;
  }
  
  .lb-img {
    max-height: 55vh;
    width: calc(100% - 2rem);
    margin: 1rem;
    display: block;
  }
}


/* --- Modern Homepage --- */
.hero{display:grid; grid-template-columns: 1fr; gap: 1rem; padding: 1.25rem 0 0}
.hero-inner{background:var(--surface); border:1px solid var(--line); border-radius:.8rem; padding:1.25rem}
.display-title{font-family:'Roboto Slab', Georgia, serif; font-weight:700; letter-spacing:.2px; margin:0 0 .25rem;}
.gen-form{display:flex; flex-wrap:wrap; gap:.6rem}
.gen-form .input{flex:1 1 220px}
.hero-aside{display:flex; align-items:center}
.stats{display:grid; grid-auto-flow:column; gap:1rem}
.stat{display:grid; gap:.15rem; background:var(--surface); border:1px solid var(--line); padding:.8rem .9rem; border-radius:.6rem; min-width:110px; place-items:center}
.stat strong{font-size:1.25rem}
.link-quiet{color:var(--muted); text-decoration:none}
.link-quiet:hover{color:var(--link)}

.home-section{margin:1.5rem 0}
.section-head{margin-bottom:.6rem}

/* Main Navigation */
.main-nav {
  gap: 2rem;
}

.main-nav .nav-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
  transition: all 0.3s ease;
}

.main-nav .nav-link:hover {
  color: var(--link);
  text-decoration: none;
}

.main-nav .nav-link:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--link);
  transition: width 0.3s ease;
}

.main-nav .nav-link:hover:after {
  width: 100%;
}

/* Mobile Navigation */
.mobile-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: 280px;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 1100;
  transition: left 0.3s ease;
  overflow-y: auto;
}

.mobile-menu.active {
  left: 0;
}

.mobile-menu-content {
  padding: 1rem 0;
  margin-top: 70px; /* Account for header height */
}

.mobile-nav {
  display: flex;
  flex-direction: column;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  color: var(--ink);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.mobile-nav-link:hover {
  background: var(--surface-2);
  color: var(--link);
  border-left-color: var(--link);
  text-decoration: none;
}

.mobile-nav-link i {
  font-size: 1.1rem;
  width: 20px;
  flex-shrink: 0;
}

.mobile-nav-divider {
  height: 1px;
  background: var(--line);
  margin: 0.5rem 1.25rem;
}

.mobile-nav-section {
  padding: 0.5rem 0;
}

.mobile-nav-header {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Hamburger icon animation */
#hamburger-icon {
  transition: transform 0.3s ease;
}

.mobile-menu-open #hamburger-icon {
  transform: rotate(90deg);
}

/* Authors Grid */
.authors-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1200px) {
  .authors-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 991.98px) {
  .authors-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767.98px) {
  .authors-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575.98px) {
  .authors-grid {
    grid-template-columns: 1fr;
  }
}

.author-card {
  text-align: left;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: block;
  border-radius: 8px;
  overflow: hidden;
}

.author-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

.author-card:focus {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.author-portrait {
  margin-bottom: 1rem;
  display: flex;
  justify-content: flex-start;
  position: relative;
  width: 100%;
  padding-bottom: 66.67%; /* 3:2 aspect ratio (2/3 = 0.6667) */
}

.author-photo {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--line);
  display: block;
}

.author-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: var(--surface-2);
  border: 2px solid var(--line);
  display: block;
}

.author-initials {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--muted);
}

.author-info {
  text-align: left;
}

.author-name {
  margin-bottom: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.author-card:hover .author-name {
  color: var(--link);
}

.book-count {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.author-bio {
  margin-bottom: 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.4;
}

.book-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:.9rem}
@media (max-width: 991.98px){.book-grid{grid-template-columns:repeat(2,1fr)}}
@media (max-width: 575.98px){.book-grid{grid-template-columns:1fr}}

/* Genres Grid */
.genres-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1400px) {
  .genres-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 991.98px) {
  .genres-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767.98px) {
  .genres-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 575.98px) {
  .genres-grid {
    grid-template-columns: 1fr;
  }
}

.genre-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 1.2rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.genre-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
}

.genre-content {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.genre-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

.genre-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.genre-count .badge {
  background: var(--link);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.genre-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.book-card{display:block; text-decoration:none; color:inherit; background:var(--surface); border:1px solid var(--line); border-radius:.6rem; overflow:hidden; transition:transform .15s ease, box-shadow .15s ease}
.book-card:hover{transform:translateY(-2px); box-shadow: var(--shadow)}
.book-card .cover-wrap{aspect-ratio: 2 / 3; background:var(--surface-2); display:flex; align-items:center; justify-content:center; overflow:hidden}
.cover-wrap img{width:100%; height:100%; object-fit:cover; object-position:center; display:block}
.cover-fallback{background:var(--cover-bg); color:#fff; display:grid; place-items:center; padding:.8rem; text-align:center; font-weight:600; text-shadow: 0 1px 3px rgba(0,0,0,0.5);}
.cover-fallback.xl{aspect-ratio:2/3; border-radius:.6rem}
.book-card .meta{padding:.6rem .7rem}
.book-card .title{font-weight:600; font-size:.95rem; line-height:1.2}
.book-card .author{color:var(--muted); font-size:.85rem}

/* See all books card */
.see-all-card .see-all-cover{background:var(--surface-2); border:2px dashed var(--line); color:var(--muted)}
.see-all-card:hover .see-all-cover{border-color:var(--link); color:var(--link)}
.see-all-text{font-size:.9rem; font-weight:600}

.reviews-list{display:grid; gap:.7rem}
.review-card{display:block; text-decoration:none; color:inherit; background:var(--surface); border:1px solid var(--line); border-radius:.6rem; padding:.8rem}
.review-card .review-header{display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:.4rem; gap:.8rem}
.review-card .reviewer-book{flex:1; line-height:1.3}
.review-card .reviewer-book .book-title-wrap{white-space:normal; word-break:break-word; hyphens:auto}
.review-card .review-stars{color:var(--accent); font-size:1rem; line-height: 1.3; flex-shrink:0}
.review-card .review-date{color:var(--muted); font-size:.8rem; margin-bottom:.4rem}
.review-card .review-excerpt{margin:.2rem 0; color:var(--ink); line-height:1.4}
.review-card .byline{color:var(--muted); font-size:.85rem}

/* --- Book Page --- */
/* Using Bootstrap grid but maintaining exact layout behavior */
.book-layout {
  margin-top: 1rem;
}

.book-cover {
  position: sticky; 
  top: 72px; 
  align-self: start;
}

/* On mobile, remove the fixed width to allow full width */
@media (max-width: 991.98px) {
  .book-cover {
    width: 100% !important;
    position: static !important;
  }
}

.cover-img {
  width: 100%; 
  height: auto; 
  border-radius: .6rem; 
  border: 1px solid var(--line); 
  box-shadow: var(--shadow);
}

.cover-actions {
  margin-top: .6rem;
}

.book-main {
  display: grid; 
  gap: 1rem;
}

.book-header .title {
  font-size: 2rem; 
  font-weight: 700; 
  margin-bottom: .2rem;
}

.byline {
  color: var(--muted); 
  margin-bottom: .4rem;
}

.author-link {
  text-decoration: none; 
  color: inherit;
}

.author-link:hover {
  color: var(--link);
}

.meta-line {
  display: flex; 
  gap: .6rem; 
  align-items: center;
}

.meta-separator {
  font-weight: bold;
  color: var(--muted);
}

.tag {
  background: var(--surface-2); 
  border: 1px solid var(--line); 
  color: var(--ink); 
  padding: .2rem .5rem; 
  border-radius: 999px; 
  font-size: .75rem;
}

.card{background:var(--surface); border:1px solid var(--line); border-radius:.6rem; padding:1rem}
.card h3{font-size:1.05rem; margin:0 0 .5rem}
.card .text{color:var(--ink)}

.author-row{display:grid; grid-template-columns: 100px 1fr; gap:.7rem}
.avatar{width:90px; height:90px; border-radius:50%; background:var(--surface-2); display:grid; place-items:center; font-weight:700; overflow:hidden}
.avatar img{width:100%; height:100%; object-fit:cover; border-radius:50%; display:block}

.avatar-link {
  text-decoration: none;
  display: block;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.avatar-link:hover {
  transform: scale(1.05);
  opacity: 0.8;
}

.reviews .review{border-left:3px solid var(--accent); padding-left:.8rem; margin:.7rem 0}
.review-head{display:flex; justify-content:space-between; align-items:flex-start}
.review .who{font-weight:600}
.review .stars{color:var(--accent)}

/* Theme toggle button subtle */
#theme-toggle{border-color:transparent}
#theme-toggle:hover{border-color:var(--line)}

/* --- Author Page --- */
/* Using Bootstrap grid but maintaining exact layout behavior */
.author-layout {
  margin-top: 1rem;
}

.author-aside {
  position: sticky; 
  top: 72px; 
  align-self: start;
}

/* On mobile, remove the fixed width to allow full width */
@media (max-width: 991.98px) {
  .author-aside {
    width: 100% !important;
    position: static !important;
  }
}

.author-photo {
  width: 100%; 
  aspect-ratio: 1/1; 
  border-radius: .6rem; 
  border: 1px solid var(--line); 
  background: var(--surface); 
  display: grid; 
  place-items: center; 
  font-weight: 800; 
  font-size: 2rem; 
  box-shadow: var(--shadow);
}

.author-photo-img {
  width: 100%; 
  aspect-ratio: 1/1; 
  object-fit: cover; 
  display: block; 
  border-radius: .6rem; 
  border: 1px solid var(--line); 
  box-shadow: var(--shadow);
}

.author-photo-placeholder {
  width: 100%; 
  aspect-ratio: 1/1; 
  border-radius: .6rem; 
  border: 1px solid var(--line); 
  background: var(--surface-2); 
  display: grid; 
  place-items: center; 
  font-weight: 800; 
  font-size: 2rem; 
  box-shadow: var(--shadow);
  color: var(--ink);
}

.author-main {
  display: grid; 
  gap: 1rem;
}

.author-header .title {
  font-size: 1.8rem; 
  font-weight: 800;
}


/* The grid that holds image + text */
.lb-content{
  display: grid;
  grid-template-columns: 1fr;     /* small: stack */
  grid-template-rows: auto 1fr;   /* image takes natural height, text fills and can scroll */
  gap: 0;
  height: min(85vh, 100%);        /* keep within viewport */
  min-height: 300px;
  padding-bottom: 1rem;
  padding-top: 1rem;
}

/* Make children shrink properly so overflow works */
.lb-content > div{
  min-width: 0;
  min-height: 0;
}

/* Image: fill its grid cell, keep aspect */
.lb-img{
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  margin: 0 !important;
  display: block;
}

/* Text: scroll if needed */
.lb-text{
  overflow: auto;
  margin: 0 !important;
}

/* Large screens: two equal columns with equal height */
@media (min-width: 992px){
    .lb-inner{
          padding: 0;              /* give the content breathing room */
        }
  .lb-content{
    grid-template-columns: 1fr 1fr; /* equal width */
    grid-template-rows: 1fr;        /* equal height */
    gap: 1rem; /* space between columns */
    padding: 0; /* remove padding */
  }
  .lb-text {
      padding: 1rem;
      width: calc(100% - 2rem);
  }

}

/* Lightbox styles */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 80px 40px 40px 40px;
  box-sizing: border-box;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.6rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: block;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  z-index: 1001;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-close i {
  font-size: 1.2rem;
}

/* Make images clickable with cursor pointer */
.cover-img,
.author-photo-img {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cover-img:hover,
.author-photo-img:hover {
  transform: scale(1.02);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .lightbox {
    padding: 60px 20px 20px 20px;
  }
  
  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
  }
  
  .lightbox-close i {
    font-size: 1rem;
  }
}
