:root {
  --navy: #172742;
  --green: #172742;
  --muted: #64748b;
  --paper: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --border-strong: #cbd5e1;
  --red: #b8382e;
  --red-hover: #9c2e25;
  --red-light: #fef2f2;
  --red-border: #fecaca;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 12px 32px -4px rgba(15, 23, 42, 0.09), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
}

body {
  background: var(--paper);
  color: var(--navy);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
}

header {
  height: 96px;
  max-width: none;
  padding: 0 max(5vw, 24px);
  background: #ffffff;
  border-bottom: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.brand {
  gap: 14px;
  align-items: center;
}

.emblem {
  font-family: 'Noto Serif', serif;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -6px;
  padding-right: 6px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(184, 56, 46, 0.28);
}

.emblem span {
  font-size: 19px;
  transform: translateY(5px);
}

.brand strong {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--navy);
}

.brand small {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--muted);
  text-transform: uppercase;
}

nav {
  gap: 20px;
  font-size: 13px;
  font-weight: 600;
}

nav a {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  color: #475569;
  transition: all 0.2s;
}

nav a:hover {
  color: var(--red);
  background: #f1f5f9;
}

.tools {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
}

.save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.save:hover {
  border-color: var(--navy);
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.wrap {
  max-width: 1280px;
  margin: auto;
  padding: 0 40px;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  text-align: left;
  overflow: visible;
  padding: 56px 0 48px;
  gap: 48px;
  min-height: 470px;
  align-items: center;
}

.hero:before,
.hero:after {
  display: none;
}

.eyebrow {
  justify-content: flex-start;
  letter-spacing: 2px;
  font-size: 10px;
  font-weight: 800;
  color: var(--red);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow:before {
  content: '';
  background: var(--red);
  width: 26px;
  height: 2px;
  border-radius: 2px;
}

h1 {
  font-family: 'Noto Serif', serif;
  font-size: 50px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -1.2px;
  margin-top: 20px;
  margin-bottom: 18px;
  color: var(--navy);
}

h1 em {
  color: var(--red);
  font-style: normal;
}

.hero p {
  font-size: 14px;
  line-height: 1.85;
  color: var(--muted);
  font-weight: 500;
}

/* Modern Rounded Search with Subtle Borders */
.search {
  margin: 28px 0 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  padding: 6px 7px 6px 20px;
  gap: 12px;
  max-width: 620px;
  background: #ffffff;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.search:focus-within {
  border-color: var(--red);
  box-shadow: 0 8px 24px -2px rgba(184, 56, 46, 0.18), 0 0 0 3px rgba(184, 56, 46, 0.12);
}

.search input {
  width: 100%;
  border: 0;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  background: none;
}

.search button {
  background: var(--red);
  color: #ffffff;
  white-space: nowrap;
  border: 0;
  border-radius: var(--radius-full);
  padding: 13px 26px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(184, 56, 46, 0.26);
}

.search button:hover {
  background: var(--red-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(184, 56, 46, 0.36);
}

.suggest {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.suggest button {
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--line);
  background: #ffffff;
  border-radius: var(--radius-full);
  padding: 5px 14px;
  text-decoration: none;
  transition: all 0.15s;
}

.suggest button:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

/* Hero Art - 3D Book Viewer */
.hero-art {
  height: 420px;
  position: relative;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: none;
}

.hero-art model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  cursor: grab;
}

.hero-art model-viewer:active {
  cursor: grabbing;
}

.art-badge {
  position: absolute;
  bottom: 16px;
  right: 18px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 700;
  color: #172742;
  letter-spacing: 0.5px;
  pointer-events: auto;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.art-badge:hover {
  background: #ffffff;
  border-color: var(--red);
  color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(184, 56, 46, 0.18);
}

.art-badge span {
  background: var(--red);
  color: white;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 800;
}

/* Alphabet Bar */
.alphabet-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: none;
  border-radius: var(--radius-xl);
  background: #ffffff;
  padding: 20px 24px;
  gap: 16px;
  margin-bottom: 34px;
  box-shadow: var(--shadow-sm);
}

.alphabet-bar>span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.alphabet-bar>span:before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

.alphabet {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.alphabet button {
  flex: 1 0 auto;
  min-width: 36px;
  max-width: 52px;
  height: 44px;
  padding: 0 6px;
  font-size: 15px;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.alphabet button:hover {
  background: #ffffff;
  color: var(--red);
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(184, 56, 46, 0.16);
}

.alphabet button.active {
  background: var(--red);
  color: #ffffff;
  font-weight: 800;
  border-color: var(--red);
  box-shadow: 0 4px 14px rgba(184, 56, 46, 0.35);
  transform: translateY(-2px);
}

/* Stats Section */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  border: 0;
  background: transparent;
  padding: 0;
  margin-bottom: 46px;
}

.stat {
  background: #ffffff;
  border: none;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat:last-child {
  border-right: none;
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat b {
  font-family: Manrope, sans-serif;
  font-weight: 800;
  font-size: 24px;
  color: var(--navy);
  display: block;
  margin-bottom: 4px;
}

.stat span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* Section Headings */
.sectionhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

h2 {
  font-family: 'Noto Serif', serif;
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--navy);
}

.sectionhead small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-top: 6px;
}

.sectionhead button {
  color: var(--red);
  font-weight: 700;
  font-size: 12px;
  background: none;
  border: 0;
  cursor: pointer;
}

/* Category cards */
.categories {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  border: 0;
  margin-bottom: 44px;
}

.category {
  background: #ffffff;
  border: none;
  border-radius: var(--radius-lg);
  padding: 22px 18px;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: all 0.2s;
}

.category:hover,
.category.selected {
  background: #ffffff;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.category i {
  color: var(--red);
  font-size: 26px;
  height: 38px;
  display: block;
}

.category b {
  font-size: 13px;
  font-weight: 700;
  display: block;
}

.category small {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 5px;
  display: block;
}

/* Feature of the Day */
.feature {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  border: none;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  background: linear-gradient(135deg, #152238 0%, #1f3557 100%);
  margin-bottom: 48px;
  color: white;
  box-shadow: var(--shadow-lg);
}

.featureimg {
  min-height: 320px;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #101d32;
}

.photolabel {
  position: absolute;
  bottom: 20px;
  left: 24px;
  z-index: 1;
  color: white;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.featuretext {
  padding: 38px 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.tag {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  color: var(--red);
  background: var(--red-light);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.feature .tag {
  background: rgba(220, 195, 148, 0.18);
  color: #e5cb9b;
  border: 1px solid rgba(220, 195, 148, 0.35);
}

.feature h2 {
  font-size: 36px;
  font-weight: 700;
  margin: 16px 0 12px;
  color: #ffffff;
}

.feature p {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.85;
  margin: 0 0 24px;
}

.feature .primary {
  background: #ffffff;
  color: var(--navy);
  border: 0;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 13px;
  padding: 14px 26px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  cursor: pointer;
}

.feature .primary:hover {
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.feature .meta {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  margin-left: 16px;
  align-self: center;
}

/* Cards Grid & Modern Article Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 48px;
}

.card {
  background: #ffffff;
  border: none !important;
  border-radius: var(--radius-xl) !important;
  overflow: hidden;
  box-shadow: var(--shadow-md) !important;
  display: flex;
  flex-direction: column;
  text-align: left;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg) !important;
}

.card img {
  display: none !important;
}

.cardbody {
  padding: 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card h3 {
  font-family: 'Noto Serif', serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  margin: 12px 0 10px;
  color: var(--navy);
}

.card p {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 20px;
  flex: 1;
}

.cardfoot {
  border-top: 1.5px solid var(--line);
  padding-top: 16px;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.cardfoot span:last-child {
  color: var(--red);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}

.card:hover .cardfoot span:last-child {
  gap: 7px;
}

/* Banner */
.banner {
  border-radius: var(--radius-xl);
  margin: 44px 0;
  background: #ffffff;
  color: var(--navy);
  border: none;
  border-left: 5px solid var(--red);
  padding: 32px 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
}

.banner h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
}

.banner p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.banner button {
  border: 1.5px solid var(--border-strong);
  background: #ffffff;
  color: var(--navy);
  border-radius: var(--radius-md);
  padding: 12px 22px;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.2s;
  cursor: pointer;
}

.banner button:hover {
  border-color: var(--navy);
  background: #f8fafc;
  transform: translateY(-1px);
}

/* Footer */
footer.wrap {
  padding: 32px 40px;
  border-top: 1.5px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

footer a {
  color: var(--red);
  font-weight: 700;
}

/* Modal Dialog */
dialog {
  max-width: 820px;
  width: 92%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-2xl);
  padding: 40px 48px;
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 25px 80px -10px rgba(15, 23, 42, 0.35);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
}

dialog h2 {
  font-size: 34px;
  font-weight: 700;
  margin: 20px 0 16px;
}

dialog p {
  font-family: 'Noto Serif', serif;
  font-size: 16px;
  line-height: 2;
  color: #334155;
}

dialog img {
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--line);
  max-height: 300px;
  width: 100%;
  object-fit: contain;
  background: #f8fafc;
}

dialog .close {
  float: right;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid var(--line);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

dialog .close:hover {
  background: #e2e8f0;
  color: var(--navy);
}

.primary {
  border-radius: var(--radius-md);
  font-weight: 700;
}

.empty {
  grid-column: 1 / -1;
  padding: 40px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  background: #ffffff;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.notice {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin: 22px 0;
}

/* Article images inside modal */
#modalBody figure {
  width: 100%;
  max-width: 440px;
  margin: 24px auto;
}

#modalBody figure>a {
  display: block;
}

#modalBody figure img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 440px);
  max-height: 270px;
  object-fit: contain;
  margin: 0 auto;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
}

#modalBody .original-image-link {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  margin-top: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

#modalBody .image-caption {
  display: block;
  margin: 12px 0 0;
  padding: 12px 14px;
  background: #f1f5f9;
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#articleStatus[hidden] {
  display: none;
}

/* Responsive Styles */
@media (max-width: 1050px) {
  .hero {
    gap: 32px;
    grid-template-columns: 1.2fr 1fr;
  }

  h1 {
    font-size: 42px;
  }

  .wrap {
    padding: 0 28px;
  }

  .alphabet-bar {
    gap: 14px;
    padding: 18px 20px;
  }

  .alphabet button {
    min-width: 34px;
    height: 42px;
    font-size: 14px;
  }

  .category {
    padding: 20px 14px;
  }

  .hero-art {
    height: 330px;
  }
}

@media (max-width: 800px) {
  header {
    height: 80px;
    padding: 0 20px;
  }

  nav {
    display: none;
  }

  .wrap {
    margin: 0;
    padding: 0 20px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 36px 0 28px;
    gap: 28px;
  }

  h1 {
    font-size: 36px;
    letter-spacing: -0.8px;
  }

  .hero-art {
    height: 300px;
  }

  .alphabet-bar {
    display: flex;
    flex-direction: column;
    padding: 18px 16px;
    gap: 12px;
  }

  .alphabet-bar>span {
    display: inline-flex;
    margin-bottom: 0;
  }

  .alphabet {
    justify-content: flex-start;
    gap: 6px;
  }

  .alphabet button {
    flex: 1 0 auto;
    min-width: 32px;
    max-width: 44px;
    height: 40px;
    font-size: 13px;
    border-radius: 8px;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 32px;
  }

  .stat b {
    font-size: 18px;
  }

  .stat span {
    font-size: 10px;
  }

  .categories {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .feature {
    grid-template-columns: 1fr;
  }

  .featureimg {
    min-height: 240px;
  }

  .featuretext {
    padding: 28px;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .card {
    display: flex;
    flex-direction: column;
  }

  .cardbody {
    padding: 24px;
  }

  .card h3 {
    font-size: 20px;
    margin: 8px 0;
  }

  .card p {
    font-size: 13px;
    margin-bottom: 14px;
  }

  .banner {
    padding: 26px 22px;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  dialog {
    padding: 28px 20px;
  }

  dialog h2 {
    font-size: 26px;
  }

  .brand strong {
    font-size: 18px;
    letter-spacing: 1.5px;
  }

  .brand small {
    font-size: 7px;
    letter-spacing: 1px;
  }

  .emblem {
    width: 40px;
    height: 40px;
    font-size: 23px;
  }

  .search input {
    font-size: 13px;
  }

  .search button {
    padding: 12px 18px;
    font-size: 12px;
  }
}