/* ============================================================
   SELMERPEDIA - REFACTORED STYLESHEET
   ============================================================ */

/* -------------------------
   DESIGN TOKENS (easy theme changes)
   ------------------------- */
:root{
  /* Colors */
  --bg-page: #f2f3f4;
  --nav-bg: #333333;
  --nav-ink: #ffffff;
  --glass-bg: rgba(20,20,20,0.75); /* darker glass for good contrast */
  --glass-weak: rgba(20,20,20,0.55);
  --muted: #9aa0a6;
  --accent: #ff8a50; /* warm accent for Selmerpedia tab */
  --white: #ffffff;
  --shadow: rgba(0,0,0,0.25);

  /* Spacing scale */
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 40px;
  --space-xl: 60px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Typography scale */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  --type-xl: 3.2rem;
  --type-lg: 1.6rem;
  --type-md: 1.15rem;
  --type-sm: 0.95rem;
  --line-height: 1.5;
}

/* -------------------------
   GLOBAL RESET & LAYOUT
   ------------------------- */
* { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html,body { height: 100%; }
body{
  margin: 0;
  background: var(--bg-page);
  font-family: var(--font-sans);
  color: #111;
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
}

/* Page wrapper — use this around top-level content to contain width.
   This is preferred over constraining body so background gradients can
   still span full viewport when needed (e.g. Selmerpedia tab). */
.page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

/* Utility: small visually-hidden text for accessibility */
.sr-only {
  position: absolute !important;
  clip: rect(1px,1px,1px,1px);
  width: 1px;height: 1px;overflow: hidden;
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* -------------------------
   NAVIGATION
   ------------------------- */
.navbar {
  background: var(--nav-bg);
  padding: var(--space-sm);
  display:flex;
  justify-content:center;
  gap: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px var(--shadow);
}

.navbar a {
  color: var(--nav-ink);
  text-decoration: none;
  padding: 8px 14px;
  font-weight:600;
  border-radius: var(--radius-sm);
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition: background 0.18s ease, transform 0.12s ease;
}

.navbar a:hover,
.navbar a.active { background: #555; transform: translateY(-1px); }


/* -------------------------
   TYPOGRAPHY HELPERS
   ------------------------- */
.h1 { font-size: var(--type-xl); margin: 0 0 var(--space-md) 0; }
.h2 { font-size: calc(var(--type-xl) / 1.6); margin: 0 0 var(--space-sm) 0; }
.p { font-size: var(--type-md); margin: 0 0 var(--space-md) 0; color: #eaeef0; }

/* -------------------------
   GLASS COMPONENT (reusable)
   ------------------------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 25px var(--shadow);
  color: var(--white);
}

/* Semantic variants */
.glass-weak { background: var(--glass-weak); color: var(--white); }

/* Content container used across pages. Replace existing uses of .content-container */
.content-container {
  padding: var(--space-lg);
  margin: var(--space-md) 0;
  border-radius: var(--radius-md);
}

/* -------------------------
   CHARACTER / SERIES TABS
   ------------------------- */
.tabs-row { display:flex; gap:12px; margin-bottom:16px; }
.tab-button {
  padding:8px 14px; border-radius:8px; background:transparent; color:var(--white);
  border: none; cursor:pointer; font-weight:600;
}
.tab-button:hover { background: rgba(255,255,255,0.05); }


/* -------------------------
   BOOK GRID & ITEMS
   LEFT-TO-RIGHT STYLING
   ------------------------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 18px;             /* consistent spacing between all books */
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: rgba(20,20,20,0.6); /* subtle backdrop for contrast */
}

/* Each book is a link that contains icon + title */
.book-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* aligns top consistently */
  gap: 6px;
}

/* Book icons: fixed size ensures spacing is uniform */
.book-icon {
  width: 140px;       /* fixed width */
  height: 200px;      /* fixed height */
  object-fit: cover;  /* crops images to fit */
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.book-icon:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
}

/* Title under icon */
.book-title {
  font-size: var(--type-sm);
  color: var(--white);
  line-height: 1.25;
  text-align: center;
  max-width: 140px;   /* ensures text doesn't push neighboring items */
}


/* -------------------------
   SERIES / SEASON STYLING
   ------------------------- */
.series-header-img { width:100%; border-radius: 10px; margin: var(--space-md) 0; display:block; }
#series-title { font-size: var(--type-xl); margin: 0 0 var(--space-md) 0; color: var(--white); text-align:left; }
.season-synopsis { font-size: var(--type-md); color: #e6e9eb; margin-bottom: var(--space-md); text-align:left; }

/* -------------------------
   SEARCH & SUGGESTIONS
   ------------------------- */
.search-wrap { width:100%; max-width:560px; margin: var(--space-lg) auto; position:relative; }
.search-bar {
  width:100%;
  padding: 14px 18px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.5);
  color: var(--white);
  font-size: var(--type-md);
}
.suggestions-dropdown { position:absolute; left:0; right:0; top:calc(100% + 8px); background:var(--white); border-radius:8px; box-shadow:0 6px 18px rgba(0,0,0,0.12); max-height:240px; overflow:auto; display:none; z-index:600; }
.suggestions-dropdown.visible { display:block; }
.suggestions-dropdown li { padding:10px 14px; border-bottom:1px solid #f2f2f2; cursor:pointer; color:#222; }
.suggestions-dropdown li:hover { background:#f6f6f6; }

/* -------------------------
   BOTTOM RECTANGLE (callout)
   ------------------------- */
.bottom-rectangle {
  width:100%;
  max-width:1100px;
  margin: var(--space-md) auto;
  padding: var(--space-md);
  background: rgba(0,0,0,0.65);
  color: var(--white);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 25px var(--shadow);
}

/* -------------------------
   BOOK VIEWER (pdf page) - minimal view
   ------------------------- */
.book-viewer-page {
  display:grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 18px;
  align-items:start;
  padding: var(--space-md);
}
.viewer-sidebar {
  background: var(--white);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  max-height: calc(100vh - 160px);
  overflow:auto;
}
.pdf-controls { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.pdf-controls button { background:#222;color:#fff;border:none;padding:8px 10px;border-radius:8px;cursor:pointer; font-weight:600; }
.pdf-canvas-wrap { background: #fff; padding:12px; border-radius:8px; box-shadow:0 8px 20px rgba(0,0,0,0.12); overflow:auto; max-height:70vh; }

/* -------------------------
   UTILITIES & RESPONSIVE
   ------------------------- */

.center { display:flex; align-items:center; justify-content:center; }
.row { display:flex; gap:12px; align-items:center; }

@media (max-width: 960px){
  .book-viewer-page { grid-template-columns: 1fr; padding: var(--space-sm); }
  .page-wrapper { padding-left: var(--space-sm); padding-right: var(--space-sm); }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap:14px; }
  .book-icon { width:110px; height:160px; }
}

@media (max-width: 560px){
  .navbar { padding: 8px; gap:8px; border-radius:8px; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap:12px; }
  .book-icon { width:92px; height:138px; }
  .h1 { font-size: 2rem; }
  .page-wrapper { padding: 16px; }
}