/* Invisible Cities — Digital Translation */

:root {
  --gradient-start: #E8E8E8;
  --gradient-end: #4A4A4A;
  --text-primary: rgba(30, 30, 30, 0.95);
  --text-secondary: rgba(50, 50, 50, 0.75);
  --text-muted: rgba(60, 60, 60, 0.6);
  --overlay-bg: rgba(255, 255, 255, 0.98);
  --transition-slow: 0.4s ease;
}

/* Custom scrollbars */
.city-excerpt-wrap,
.chapter-overview-text-wrap,
.nav-overlay-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.25) rgba(0, 0, 0, 0.06);
}

.city-excerpt-wrap::-webkit-scrollbar,
.chapter-overview-text-wrap::-webkit-scrollbar,
.nav-overlay-list::-webkit-scrollbar {
  width: 8px;
}

.city-excerpt-wrap::-webkit-scrollbar-track,
.chapter-overview-text-wrap::-webkit-scrollbar-track,
.nav-overlay-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
}

.city-excerpt-wrap::-webkit-scrollbar-thumb,
.chapter-overview-text-wrap::-webkit-scrollbar-thumb,
.nav-overlay-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

.city-excerpt-wrap::-webkit-scrollbar-thumb:hover,
.chapter-overview-text-wrap::-webkit-scrollbar-thumb:hover,
.nav-overlay-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.35);
}

/* Light scrollbars on midnight chapter-overview */
#chapter-overview .chapter-overview-text-wrap {
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.1);
}

#chapter-overview .chapter-overview-text-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

#chapter-overview .chapter-overview-text-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
}

#chapter-overview .chapter-overview-text-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Light scrollbars on city view (dark background) */
#city-view .city-excerpt-wrap {
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.1);
}

#city-view .city-excerpt-wrap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

#city-view .city-excerpt-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
}

#city-view .city-excerpt-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Josefin Sans", sans-serif;
  font-weight: 300;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--gradient-start), var(--gradient-end));
  transition: background var(--transition-slow);
}

body.nav-open { overflow: hidden; }

/* Screens — only one visible */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ===== SCREEN 1 — Splash ===== */
#splash {
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  color: #fff;
}

.splash-decoration {
  font-family: "Cormorant Garamond", serif;
  font-size: 1rem;
  letter-spacing: 0.5em;
  color: #fff;
  margin-bottom: 4rem;
}

.splash-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(2.5rem, 10vw, 5rem);
  letter-spacing: 0.15em;
  margin: 0 0 2.5rem;
  text-align: center;
  color: #fff;
}

.splash-author {
  font-family: "Josefin Sans", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 1rem;
}

.splash-translation {
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 5rem;
}

/* Glass-style buttons (translucent, consistent across app) */
.splash-enter,
.chapter-overview-continue,
.nav-btn,
.motif-view-back,
.nav-read-chapter {
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: background var(--transition-slow), border-color var(--transition-slow), opacity var(--transition-slow);
}

.splash-enter {
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  padding: 0.5rem 1rem;
  color: #fff;
  cursor: pointer;
  margin-bottom: 4rem;
}

.splash-enter:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

.splash-quote {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.4;
  max-width: 24rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

/* ===== SCREEN 2 — Chapter Overview ===== */
#chapter-overview {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  color: #fff;
}

#chapter-overview .chapter-overview-header {
  flex-shrink: 0;
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

#chapter-overview .chapter-overview-header .city-logo,
#chapter-overview .chapter-overview-header .city-header-chapter,
#chapter-overview .chapter-overview-header .menu-toggle,
#chapter-overview .chapter-overview-header .menu-toggle-bar {
  color: #fff;
}

.chapter-overview-inner {
  max-width: 36rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 2rem;
  margin: 0 auto;
  box-sizing: border-box;
}

.chapter-overview-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin: 0 0 1.5rem;
  text-align: center;
  color: #fff;
}

.chapter-overview-text-wrap {
  height: 40rem;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.chapter-overview-desc {
  font-family: "Josefin Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
  white-space: pre-wrap;
}

.chapter-overview-continue {
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  padding: 0.5rem 1rem;
  color: #fff;
  cursor: pointer;
  margin-bottom: 1rem;
  align-self: center;
}

.chapter-overview-continue:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

.chapter-overview-decoration {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.9rem;
  letter-spacing: 0.5em;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}

/* ===== SCREEN 3 — City View ===== */
#city-view {
  padding: 0;
}

#city-view .city-header {
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

#city-view .city-logo,
#city-view .city-header-chapter,
#city-view .menu-toggle,
#city-view .menu-toggle-bar { color: #fff; }

#city-view .city-logo:hover { opacity: 0.85; }

.city-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.city-logo, .nav-overlay-logo {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  transition: opacity var(--transition-slow);
}

.city-logo:hover, .nav-overlay-logo:hover { opacity: 0.7; }

.city-header-chapter {
  font-family: "Josefin Sans", sans-serif;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  margin: 0;
}

.menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 1.25rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
}

.menu-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  background: currentColor;
}

.city-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  max-width: 48rem;
  margin: 0 auto;
  width: 100%;
}

.city-content {
  flex: 1;
  min-height: 0;
}

.city-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.city-icon {
  width: 5rem;
  height: 5rem;
  opacity: 0.6;
  object-fit: contain;
}

#city-view .city-icon {
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.city-icon[src=""], .city-icon:not([src]) { display: none; }

.city-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 0.25rem;
  letter-spacing: 0.02em;
  text-align: center;
}

#city-view .city-title { color: #fff; }

.city-subtitle {
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  letter-spacing: 0.05em;
  text-align: center;
}

#city-view .city-subtitle { color: rgba(255, 255, 255, 0.9); }

.city-excerpt-wrap {
  height: 22rem;
  overflow-y: auto;
  padding: 1rem 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1rem;
  margin-bottom: 0;
}

#city-view .city-excerpt-wrap {
  border-color: rgba(255, 255, 255, 0.25);
}

.city-excerpt {
  font-size: 1rem;
  line-height: 1.8;
  margin: 0;
}

#city-view .city-excerpt { color: rgba(255, 255, 255, 0.95); }

/* Line with asterisk separating reading panel and motifs */
.city-section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-primary);
}

#city-view .city-section-divider,
#city-view .city-section-divider-asterisk { color: rgba(255, 255, 255, 0.8); }

#city-view .city-section-divider::before,
#city-view .city-section-divider::after {
  background: rgba(255, 255, 255, 0.5);
}

.city-section-divider::before,
.city-section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: 0.5;
}

.city-section-divider-asterisk {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.motif-section {
  margin-top: 0;
  text-align: center;
}

.motif-label {
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

#city-view .motif-label { color: rgba(255, 255, 255, 0.85); }

.motif-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.motif-tag {
  padding: 0.35rem 0.75rem;
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: opacity var(--transition-slow), background var(--transition-slow);
}

.motif-tag:hover {
  background: rgba(255, 255, 255, 0.2);
}

#city-view .motif-tag {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
}

#city-view .motif-tag:hover {
  background: rgba(255, 255, 255, 0.25);
}

.city-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.nav-btn {
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  color: var(--text-primary);
  cursor: pointer;
}

.nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: default;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

#city-view .nav-btn {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

#city-view .nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

#city-view .nav-btn:disabled {
  color: rgba(255, 255, 255, 0.6);
}

/* ===== SCREEN 4 — Navigation Overlay (dark gradient, matches home) ===== */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.nav-overlay.open {
  opacity: 1;
  visibility: visible;
}

.nav-overlay .nav-overlay-logo {
  color: rgba(255, 255, 255, 0.95);
}

.nav-overlay .nav-overlay-logo:hover {
  color: #fff;
}

.nav-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-overlay-title {
  font-family: "Josefin Sans", sans-serif;
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.1em;
  margin: 0;
  color: #fff;
}

.menu-close {
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
}

.menu-close:hover {
  color: #fff;
}

.nav-overlay-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.1);
}

.nav-overlay-list::-webkit-scrollbar {
  width: 8px;
}

.nav-overlay-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

.nav-overlay-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
}

.nav-accordion {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: none;
}

.nav-accordion:last-of-type {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.1rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
}

.nav-accordion-header::after {
  content: "▼";
  font-size: 0.7rem;
  transition: transform var(--transition-slow);
}

.nav-accordion.open .nav-accordion-header::after {
  transform: rotate(-180deg);
}

.nav-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.nav-accordion.open .nav-accordion-body {
  max-height: 50rem;
}

.nav-read-chapter {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.nav-read-chapter:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-accordion-cities {
  padding: 0.5rem 0 0.5rem 1.5rem;
}

.nav-city-link {
  display: block;
  width: 100%;
  padding: 0.5rem 0;
  font-family: "Josefin Sans", sans-serif;
  font-size: 1rem;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9);
  transition: opacity var(--transition-slow);
}

.nav-city-link:hover {
  opacity: 0.85;
  color: #fff;
}

/* ===== SCREEN 5 — Motif View ===== */
#motif-view {
  padding: 1.5rem;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  color: #fff;
}

.motif-view-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 2rem;
  min-height: 2.5rem;
}

.motif-view-back {
  position: absolute;
  left: 0;
  font-family: "Josefin Sans", sans-serif;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: #fff;
}

.motif-view-back:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
}

.motif-view-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.5rem;
  margin: 0;
  color: #fff;
  text-align: center;
}

.motif-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  max-width: 56rem;
  margin: 0 auto;
}

@media (max-width: 640px) {
  .motif-cards {
    grid-template-columns: 1fr;
  }
}

.motif-card {
  padding: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: background var(--transition-slow);
  text-align: center;
  color: #fff;
}

.motif-card:hover {
  background: rgba(255, 255, 255, 0.12);
}

.motif-card-icon {
  width: 3.5rem;
  height: 3.5rem;
  opacity: 0.85;
  object-fit: contain;
  margin: 0 auto 0.75rem;
  display: block;
  filter: brightness(0) invert(1);
}

.motif-card-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0;
  margin-bottom: 1rem;
  color: #fff;
}

.motif-card-quote {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}
