/* ============================================
   POETRY MAP - Styles
   ============================================ */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', serif;
  background: #fafafa;
  color: #333;
}

/* ============================================
   NAVBAR
   ============================================ */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #fafafa;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 56px;
}

.nav-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ============================================
   THEME TOGGLE
   ============================================ */

.theme-toggle {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle:hover {
  border-color: #666;
}

/* In light mode: show sun, hide moon */
.icon-sun { display: inline; }
.icon-moon { display: none; }

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: fixed;
  top: 50%;
  left: 3%;
  transform: translateY(-50%);      /* Same vertical centering as map */
  margin-top: 28px;                 /* Same offset as map */
  width: 12%;
  height: 75vh;                     /* Same height as map */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;        /* Push list to bottom */
  padding-bottom: 1rem;
  z-index: 100;
}

.city-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.city-list li {
  margin-bottom: 0.75rem;
}

.city-list a {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 400;
  color: #000;
  text-decoration: none;
  font-size: 1.15rem;
  letter-spacing: 2px;
  transition: color 0.2s ease;
  cursor: pointer;
}

.city-list a:hover {
  color: #ff2d95;
}

.city-list a.active {
  color: #000;
}

/* ============================================
   MAP
   ============================================ */

#map {
  position: fixed;
  top: 50%;                       /* Start at vertical center */
  left: 50%;                      /* Start at horizontal center */
  transform: translate(-50%, -50%);  /* Shift back to true center */
  margin-top: 28px;               /* Offset for navbar */
  width: 65%;
  height: 75vh;
  z-index: 1;
  border-radius: 8px;
  border: 1px solid #d0d0d0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* ============================================
   POEM PANEL
   ============================================ */

.poem-panel {
  position: fixed;
  top: calc(50% + 28px - 37.5vh - 4rem);    /* Above map top edge */
  right: 6%;                                  /* Near screen edge, overlaps map */
  width: 400px;
  height: 50vh;
  min-height: 50vh;
  max-height: 50vh;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #d0d0d0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 1.75rem;
  overflow-y: auto;
  z-index: 999;

  /* Fade/scale animation */
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Hidden state */
.poem-panel.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.close-btn:hover {
  color: #333;
}

#poem-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 2px;
  text-transform: lowercase;
  margin-bottom: 0.5rem;
  padding-right: 2rem;  /* Space for close button */
  line-height: 1.3;
}

.poem-author {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 400;
  display: block;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 1.5rem;
}

#poem-text {
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  line-height: 1.9;
  white-space: pre-line;  /* Preserves line breaks from \n */
  margin-bottom: 1.5rem;
}

.poem-date {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 400;
  display: block;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: #888;
}

/* ============================================
   SITE CREDIT
   ============================================ */

.site-credit {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  font-family: 'Crimson Text', serif;
  font-size: 0.9rem;
  color: #888;
  z-index: 50;
}

.site-credit a {
  color: #888;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-credit a:hover {
  color: #ff2d95;
}

/* ============================================
   RESPONSIVE - Mobile adjustments
   ============================================ */

@media (max-width: 1000px) {
  /* Flex layout for mobile */
  body {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }

  .navbar {
    position: relative;
    padding: 0.5rem 1rem;
    flex-shrink: 0;
  }

  .nav-brand {
    font-size: 1.5rem;
  }

  /* Menu: auto height based on content */
  .sidebar {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    width: 100%;
    height: auto;
    background: none;
    padding: 2vh 5%;
    box-shadow: none;
    flex-shrink: 0;
  }

  .city-list li {
    display: inline;
    margin-right: 1rem;
    margin-bottom: 0;
  }

  /* Map: fills remaining space */
  #map {
    position: relative;
    top: auto;
    left: auto;
    bottom: auto;
    transform: none;
    margin: 0 auto;
    width: 90%;
    flex-grow: 1;
    height: auto;
  }

  /* Credit centered at bottom on mobile - part of flex layout */
  .site-credit {
    position: relative;
    bottom: auto;
    right: auto;
    left: auto;
    text-align: center;
    padding: 1.25rem 0 0.75rem 0;
    flex-shrink: 0;
    z-index: auto;
  }

  .poem-panel {
    top: 8vh;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 92vh;
    max-height: none;
    border-radius: 0;
    border: none;
    transition: transform 0.4s ease;
  }

  .poem-panel.hidden {
    opacity: 1;
    transform: translateX(100%);
  }
}

/* Dark mode mobile sidebar */
@media (max-width: 1000px) {
  body.dark-mode .sidebar {
    background: none;
  }
}

/* ============================================
   DARK MODE
   ============================================ */

body.dark-mode {
  background: #1a1a1a;
  color: #e0e0e0;
}

body.dark-mode .navbar {
  background: #1a1a1a;
}

body.dark-mode .city-list a {
  color: #fff;
}

body.dark-mode .city-list a:hover {
  color: #ff2d95;
}

body.dark-mode .city-list a.active {
  color: #e0e0e0;
}

/* Dark mode mobile - must come after general dark mode rules */
@media (max-width: 1000px) {
  body.dark-mode .city-list a {
    color: #fff;
  }
}

body.dark-mode .theme-toggle {
  border-color: #555;
  color: #e0e0e0;
}

body.dark-mode .theme-toggle:hover {
  border-color: #888;
}

/* In dark mode: hide sun, show moon */
body.dark-mode .icon-sun { display: none; }
body.dark-mode .icon-moon { display: inline; }

body.dark-mode #map {
  border-color: #444;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

body.dark-mode .poem-panel {
  background: #252525;
  border-color: #444;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

body.dark-mode .close-btn {
  color: #777;
}

body.dark-mode .close-btn:hover {
  color: #ccc;
}

body.dark-mode .poem-date {
  color: #888;
}

body.dark-mode .site-credit,
body.dark-mode .site-credit a {
  color: #666;
}

body.dark-mode .site-credit a:hover {
  color: #ff2d95;
}

/* ============================================
   MARKER TOOLTIPS
   ============================================ */

.marker-tooltip {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.dark-mode .marker-tooltip {
  background: #252525;
  color: #e0e0e0;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

/* Smaller permanent labels on mobile */
@media (max-width: 1000px) {
  .marker-tooltip {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    opacity: 0.9;
  }
}
