* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, sans-serif;
  color: #1e293b;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 248, 235, 0.78), rgba(255,255,255,0.46), rgba(255,248,235,0.78)),
    url("images/justice-background.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100vh;
}

.page {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.glass {
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 48px rgba(92, 64, 31, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* HOME PAGE */
.home.page {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 2vh, 24px);
  text-align: center;
  background:
    linear-gradient(90deg, rgba(255, 252, 244, 0.96), rgba(255, 248, 232, 0.90), rgba(255, 252, 244, 0.96)),
    url("images/justice-background.png");
  background-size: cover;
  background-position: center;
}

.home.page::before,
.home.page::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(34px, 5vw, 90px);
  opacity: 0.18;
  pointer-events: none;
  background: repeating-linear-gradient(45deg, transparent 0 18px, rgba(199, 151, 67, 0.22) 18px 22px);
}

.home.page::before { left: 0; }
.home.page::after { right: 0; transform: scaleX(-1); }

.home-content {
  width: min(94vw, 1500px);
  height: min(94vh, 844px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  justify-items: center;
  align-items: start;
  padding: clamp(8px, 1.4vh, 18px) clamp(28px, 4vw, 70px) clamp(10px, 1.6vh, 20px);
}

.home-ornament {
  width: min(260px, 22vw);
  height: clamp(14px, 2vh, 22px);
  margin-bottom: clamp(2px, 0.5vh, 6px);
  position: relative;
  background:
    radial-gradient(circle at 50% 50%, #d0a14e 0 4px, transparent 5px),
    radial-gradient(circle at 46% 50%, transparent 0 7px, #d0a14e 7px 9px, transparent 10px),
    radial-gradient(circle at 54% 50%, transparent 0 7px, #d0a14e 7px 9px, transparent 10px);
}

.home-ornament::before,
.home-ornament::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 2px;
  background: #d0a14e;
}

.home-ornament::before { left: 0; }
.home-ornament::after { right: 0; }

.home h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 5.2vw, 78px);
  line-height: 0.95;
  letter-spacing: -1px;
  margin: 0;
  color: #241009;
  text-align: center;
}

.home-subtitle {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2.4vw, 34px);
  color: #6f765d;
  margin: clamp(6px, 1vh, 12px) 0 clamp(18px, 3vh, 30px);
  line-height: 1;
}

.home-options {
  width: min(100%, 1260px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  column-gap: clamp(24px, 3.4vw, 46px);
  row-gap: clamp(28px, 4.1vh, 50px);
}

.court-card {
  position: relative;
  min-height: 0;
  height: 100%;
  text-decoration: none;
  color: #241009;
  text-align: center;
  border: 2px solid rgba(205, 156, 72, 0.92);
  border-radius: 20px;
  background: rgba(255, 252, 242, 0.56);
  box-shadow: 0 14px 32px rgba(92, 64, 31, 0.11);
  padding: clamp(42px, 5.5vh, 62px) clamp(16px, 2vw, 30px) clamp(12px, 1.8vh, 22px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.court-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 252, 242, 0.74);
  box-shadow: 0 22px 48px rgba(92, 64, 31, 0.17);
}

.court-icon {
  position: absolute;
  top: calc(-1 * clamp(32px, 4.6vh, 48px));
  left: 50%;
  transform: translateX(-50%);
  width: clamp(68px, 7.4vw, 112px);
  height: clamp(68px, 7.4vw, 112px);
  border-radius: 50%;
  background: rgba(255, 250, 236, 0.98);
  border: 3px solid rgba(205, 156, 72, 0.92);
  box-shadow: 0 8px 22px rgba(92, 64, 31, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 1vw, 16px);
}

.court-icon img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  display: block;
}

.court-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(23px, 2.3vw, 38px);
  line-height: 1.05;
  color: #241009;
  margin: 0;
}

.court-divider {
  width: clamp(62px, 6vw, 90px);
  height: clamp(12px, 1.8vh, 18px);
  margin: clamp(5px, 0.8vh, 10px) 0;
  position: relative;
}

.court-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: rgba(205, 156, 72, 0.9);
}

.court-divider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #d0a14e;
  transform: translate(-50%, -50%) rotate(45deg);
}

.court-card p {
  max-width: 520px;
  font-size: clamp(14px, 1.25vw, 21px);
  line-height: 1.28;
  color: #241009;
}

/* SLIDE PAGES */
.page:not(.home) {
  display: grid;
  grid-template-columns: clamp(145px, 13vw, 205px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "selector panel";
  gap: clamp(10px, 1.2vw, 18px);
  padding: clamp(12px, 1.8vh, 20px) clamp(14px, 1.8vw, 26px);
  align-items: stretch;
}

.page-header {
  grid-area: header;
  width: 100%;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 110px;
  align-items: center;
  text-align: center;
  z-index: 4;
}

.home-btn {
  grid-column: 1;
  justify-self: start;
  min-width: 96px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #2b1a0d;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(92, 64, 31, 0.1);
}

.title-box {
  grid-column: 2;
  justify-self: center;
  max-width: 100%;
  padding: 7px 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 30px rgba(92, 64, 31, 0.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.small-label {
  display: block;
  font-size: clamp(9px, 0.75vw, 12px);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #7a6042;
  margin-bottom: 4px;
  font-weight: 700;
}

.page-header h2 {
  font-size: clamp(22px, 2.7vw, 42px);
  line-height: 1;
  color: #2b1a0d;
  letter-spacing: -1px;
}

.page-nav {
  grid-area: selector;
  align-self: start;
  width: 100%;
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.48);
  box-shadow: 0 14px 34px rgba(92, 64, 31, 0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 5;
}

.option-card { text-decoration: none; }

.page-nav .option-card {
  width: 100%;
  height: auto;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.50);
  border: 2px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 8px 20px rgba(92, 64, 31, 0.08);
  color: #2b1a0d;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.page-nav .option-card:hover {
  transform: translateX(3px);
  background: rgba(255, 255, 255, 0.80);
}

.page-nav .option-card h2 {
  color: #2b1a0d;
  text-shadow: none;
  font-size: clamp(13px, 1vw, 17px);
  line-height: 1.1;
  margin: 0;
}

#image-slide-page .page-nav .palace,
#list-page .page-nav .market,
#category-three-page .page-nav .religion,
#category-four-page .page-nav .gada {
  border: 2px solid rgba(43, 26, 13, 0.42);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.58),
    0 12px 28px rgba(92, 64, 31, 0.14);
}

.panel {
  grid-area: panel;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 26px;
  padding: clamp(9px, 1.2vh, 16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.category-slide-viewer {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: clamp(5px, 0.7vh, 8px);
}

.category-slide {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.category-slide.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-slide-card {
  position: relative;
  width: min(100%, calc((100vh - 135px) * 16 / 9));
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 100%;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(255, 255, 255, 0.5);
  display: block;
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.category-slide-card input { display: none; }

.category-slide-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: rgba(255, 255, 255, 0.26);
}

.category-description {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(255, 255, 255, 0.86);
  color: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(20px, 3vw, 44px);
  font-size: clamp(17px, 1.8vw, 25px);
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.category-slide-card input:checked ~ .category-description {
  opacity: 1;
  pointer-events: auto;
}

.viewer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
}

.touch-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.prev-btn,
.next-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 36px;
  color: #2b1a0d;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  padding: 7px 13px;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(92, 64, 31, 0.1);
}

.counter,
.hint {
  color: #7a6042;
  font-size: 12px;
}

.hint { margin: 0; }

/* RESPONSIVE */
@media (max-width: 1100px), (max-aspect-ratio: 4 / 3) {
  body { overflow-y: auto; }

  .page:not(.home) {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "header"
      "selector"
      "panel";
    overflow: visible;
  }

  .page-header {
    grid-template-columns: 1fr;
    gap: 8px;
    justify-items: center;
  }

  .home-btn,
  .title-box {
    grid-column: 1;
    justify-self: center;
  }

  .page-nav {
    width: min(94vw, 900px);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .page-nav .option-card {
    min-height: 40px;
    justify-content: center;
    text-align: center;
  }

  .panel {
    width: min(94vw, 900px);
    height: auto;
    aspect-ratio: auto;
  }

  .category-slide-card {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .home.page {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .home-content {
    height: auto;
    min-height: 92vh;
  }

  .home-options {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    height: auto;
    gap: 54px;
  }

  .court-card { min-height: 240px; }
}

@media (max-width: 650px) {
  .home-options,
  .page-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .home h1 { font-size: clamp(34px, 10vw, 56px); }
  .home-subtitle { font-size: 23px; }
  .court-card { padding-top: 58px; }

  .viewer-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .touch-controls { width: 100%; }

  .prev-btn,
  .next-btn { flex: 1; }
}
