/* St. Dominic's Academy Digital Archives — GPURA & PIB NIS Theme */
:root {
  --sda-navy: #142459;
  --sda-navy-dark: #0c173b;
  --sda-crimson: #c62828;
  --sda-gold: #f4b400;
  --sda-cream: #fcfaf2;
  --sda-card: #ffffff;
  --sda-border: #e5dec9;
  --sda-text: #1f2430;
  --sda-muted: #5e6472;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Georgia", "Cambria", "Times New Roman", serif;
  background-color: var(--sda-cream);
  color: var(--sda-text);
  line-height: 1.6;
}
.sans { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }

/* Top Institutional Banner */
.top-ribbon {
  background: var(--sda-crimson);
  color: #fff;
  font-size: 0.84rem;
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Segoe UI", sans-serif;
  letter-spacing: 0.4px;
  flex-wrap: wrap;
  gap: 8px;
}
@media (max-width: 600px) {
  .top-ribbon { justify-content: center; text-align: center; }
}

.navbar {
  background: var(--sda-navy);
  color: #fff;
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 4px solid var(--sda-gold);
  flex-wrap: wrap;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #fff;
}
.crest-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sda-cream);
  border: 2px solid var(--sda-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--sda-crimson);
  font-size: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  flex-shrink: 0;
}
.brand-text h1 { font-size: 1.35rem; letter-spacing: 0.5px; }
.brand-text p { font-size: 0.8rem; color: var(--sda-gold); font-family: "Segoe UI", sans-serif; }

.nav-links {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: "Segoe UI", sans-serif;
  flex-wrap: wrap;
}
.nav-links a {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}
.nav-links a:hover { background: rgba(255,255,255,0.12); }
.nav-links .btn-admin {
  background: var(--sda-gold);
  color: var(--sda-navy-dark);
  font-weight: 700;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--sda-navy-dark) 0%, var(--sda-navy) 100%);
  color: #fff;
  padding: 48px 24px;
  text-align: center;
  border-bottom: 1px solid var(--sda-border);
}
.hero h2 { font-size: clamp(1.7rem, 4vw, 2.2rem); margin-bottom: 10px; color: #fff; }
.hero p { max-width: 740px; margin: 0 auto 24px; color: #dce3f5; font-size: 1.05rem; }
.search-bar {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.search-bar input {
  flex: 1;
  min-width: 200px;
  padding: 13px 18px;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
}
.search-bar button {
  background: var(--sda-crimson);
  color: #fff;
  border: 2px solid var(--sda-gold);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

/* GPURA Telemetry Strip */
.telemetry-strip {
  max-width: 1180px;
  margin: -26px auto 36px;
  background: #fff;
  border: 1px solid var(--sda-border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(20, 36, 89, 0.08);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  padding: 18px;
  text-align: center;
  gap: 10px;
}
.stat-cell { border-right: 1px solid var(--sda-border); padding: 6px 10px; }
.stat-cell:last-child { border-right: none; }
@media (max-width: 600px) {
  .stat-cell { border-right: none; border-bottom: 1px solid var(--sda-border); }
  .stat-cell:last-child { border-bottom: none; }
}
.stat-num { font-size: 1.85rem; font-weight: 800; color: var(--sda-crimson); font-family: "Segoe UI", sans-serif; }
.stat-label { font-size: 0.82rem; text-transform: uppercase; color: var(--sda-muted); letter-spacing: 0.8px; font-family: "Segoe UI", sans-serif; }

/* Main Container & Section Headers */
.container { max-width: 1240px; margin: 0 auto; padding: 20px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 32px 0 18px;
  border-bottom: 2px solid var(--sda-border);
  padding-bottom: 8px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-head h3 { font-size: clamp(1.2rem, 3vw, 1.45rem); color: var(--sda-navy); }
.section-head a { color: var(--sda-crimson); text-decoration: none; font-family: "Segoe UI", sans-serif; font-size: 0.9rem; font-weight: 600; }

/* Publication Grid & Cards */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
}
.archive-card {
  background: var(--sda-card);
  border: 1px solid var(--sda-border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.archive-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 26px rgba(20, 36, 89, 0.12);
}
.card-cover {
  height: 310px;
  background: #eae4d3;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--sda-border);
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.badge-year {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--sda-navy);
  color: var(--sda-gold);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-family: "Segoe UI", sans-serif;
  font-weight: 700;
}
.badge-pages {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(12, 23, 59, 0.85);
  color: #fff;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: "Segoe UI", sans-serif;
}
.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.card-cat { font-size: 0.75rem; text-transform: uppercase; color: var(--sda-crimson); font-family: "Segoe UI", sans-serif; font-weight: 700; margin-bottom: 4px; }
.card-title { font-size: 1.08rem; font-weight: 700; color: var(--sda-navy-dark); margin-bottom: 6px; }
.card-meta { margin-top: auto; padding-top: 10px; font-size: 0.82rem; color: var(--sda-muted); font-family: "Segoe UI", sans-serif; display: flex; justify-content: space-between; }

/* Category Pills */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.cat-box {
  background: #fff;
  border: 1px solid var(--sda-border);
  border-left: 5px solid var(--sda-navy);
  border-radius: 8px;
  padding: 16px;
}
.cat-box h4 { color: var(--sda-navy); margin-bottom: 8px; }
.subcat-links { display: flex; flex-wrap: wrap; gap: 6px; }
.subcat-links a {
  font-family: "Segoe UI", sans-serif;
  font-size: 0.8rem;
  background: var(--sda-cream);
  color: var(--sda-text);
  padding: 4px 9px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--sda-border);
}
.subcat-links a:hover { background: var(--sda-navy); color: #fff; }

/* ======================================================================
   NEW INDIA SAMACHAR (PIB) STYLE 3D FLIPBOOK THEATRE
   ====================================================================== */
.nis-theatre {
  position: relative;
  width: 100%;
  height: clamp(540px, 84vh, 920px);
  background: radial-gradient(circle at center, #363a45 0%, #181b20 100%);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  margin-bottom: 28px;
  user-select: none;
  -webkit-user-select: none;
}

.nis-theatre:fullscreen,
.nis-theatre:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  margin: 0;
}

/* Top Subtle Info Bar inside Theatre */
.nis-topbar {
  height: 40px;
  background: rgba(15, 18, 24, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #e2e8f0;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.85rem;
  z-index: 30;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nis-topbar-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}
.nis-zoom-hint {
  font-size: 0.78rem;
  color: var(--sda-gold);
  background: rgba(244, 180, 0, 0.14);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(244, 180, 0, 0.35);
}

/* Center Stage Area */
#flipbook-viewport {
  position: relative;
  flex: 1;
  width: 100%;
  height: calc(100% - 92px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: default;
}
#flipbook-viewport.is-zoomed {
  cursor: grab;
}
#flipbook-viewport.is-zoomed.is-dragging {
  cursor: grabbing;
}

/* Transform Layer moved by Pan (X/Y) and Scale (Zoom) */
#flipbook-zoom-layer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.12s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
#flipbook-zoom-layer.no-transition {
  transition: none !important;
}

#flipbook-canvas-root {
  background: transparent !important;
  box-shadow: none !important;
}

.flip-page {
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
/* Center book spine shadow */
.flip-page.--left::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.18));
  pointer-events: none;
}
.flip-page.--right::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to left, rgba(0,0,0,0), rgba(0,0,0,0.16));
  pointer-events: none;
}
.flip-page canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: fill;
  display: block;
}

/* Floating Side Arrows */
.nis-side-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 68px;
  background: rgba(15, 18, 24, 0.65);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(4px);
}
.nis-side-arrow:hover {
  background: var(--sda-crimson);
  border-color: var(--sda-gold);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.nis-side-arrow.left { left: 12px; }
.nis-side-arrow.right { right: 12px; }
@media (max-width: 640px) {
  .nis-side-arrow {
    width: 34px;
    height: 50px;
    font-size: 1.2rem;
  }
  .nis-side-arrow.left { left: 4px; }
  .nis-side-arrow.right { right: 4px; }
}

/* Thumbnail Drawer Popup */
.nis-thumb-drawer {
  position: absolute;
  bottom: 56px;
  left: 16px;
  right: 16px;
  background: rgba(18, 21, 28, 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 12px 16px;
  display: none;
  gap: 12px;
  overflow-x: auto;
  z-index: 35;
  align-items: center;
}
.nis-thumb-drawer.open { display: flex; }
.nis-thumb-item {
  flex: 0 0 auto;
  width: 74px;
  text-align: center;
  cursor: pointer;
  color: #cbd5e1;
  font-family: "Segoe UI", sans-serif;
  font-size: 0.75rem;
  padding: 6px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.15s;
}
.nis-thumb-item:hover,
.nis-thumb-item.active {
  border-color: var(--sda-gold);
  color: #fff;
  background: rgba(244, 180, 0, 0.16);
}
.nis-thumb-box {
  height: 92px;
  background: #fff;
  border-radius: 4px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sda-navy);
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
}
.nis-thumb-box canvas { width: 100%; height: 100%; object-fit: cover; }

/* Bottom Docked Control Bar */
.nis-bottom-bar {
  height: 52px;
  background: rgba(15, 18, 24, 0.9);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  z-index: 30;
  font-family: "Segoe UI", sans-serif;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.nis-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14);
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.nis-btn:hover {
  background: var(--sda-crimson);
  border-color: var(--sda-gold);
  color: #fff;
}
.nis-btn.active {
  background: var(--sda-gold);
  color: var(--sda-navy-dark);
  border-color: var(--sda-gold);
}
.nis-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 4px;
  flex-shrink: 0;
}
.nis-page-box {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0 8px;
  height: 36px;
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.nis-page-input {
  width: 42px;
  background: transparent;
  border: none;
  color: var(--sda-gold);
  font-weight: 700;
  text-align: center;
  font-size: 0.9rem;
  outline: none;
}
.nis-zoom-badge {
  min-width: 48px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--sda-gold);
  flex-shrink: 0;
}

/* Accessible Scroll Reader Fallback */
#scroll-viewport {
  display: none;
  flex: 1;
  overflow-y: auto;
  text-align: center;
  padding: 20px;
  background: #1a1d24;
}
#scroll-viewport canvas {
  max-width: 100%;
  margin: 0 auto 18px;
  display: block;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

footer {
  background: var(--sda-navy-dark);
  color: #c9d2e8;
  padding: 32px 24px;
  margin-top: 48px;
  text-align: center;
  border-top: 4px solid var(--sda-crimson);
  font-family: "Segoe UI", sans-serif;
  font-size: 0.9rem;
}
