/* Travel Blog Stylesheet */
/* encoding: utf-8 */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
  overflow-x: hidden;
}

/* ============================================
   HEADER SECTION
   ============================================ */

.blog-header {
  background: linear-gradient(135deg, #1a5276 0%, #2980b9 50%, #5dade2 100%);
  color: white;
  padding: 8px 0;
  margin: 0;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.blog-header h1 .date-range {
  font-size: 0.5em;
  font-weight: 300;
  opacity: 0.85;
  margin-right: 10px;
  display: inline-block;
}

.blog-header h1 {
  margin: 0;
  font-size: 2em;
  font-weight: 300;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
  word-wrap: break-word;
}

.blog-header h1 .subtitle {
  font-size: 0.5em;
  font-weight: 300;
  opacity: 0.85;
  margin-left: 10px;
  display: inline-block;
}


.header-wrapper {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 15px;
}

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

.map-container {
  width: 100%;
  height: 300px;
  margin: 0;
  padding: 0;
}

#map {
  width: 100%;
  height: 100%;
}

/* ============================================
   POSTS SECTION
   ============================================ */

.posts-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px;
}

.post {
  background: white;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  overflow: hidden;
}

.post-header {
  background: linear-gradient(to right, #ecf0f1, #f8f9fa);
  padding: 6px 15px;
  border-bottom: 1px solid #e0e0e0;
}

.post-header h2 {
  margin: 0 0 2px 0;
  font-size: 1.3em;
  font-weight: 500;
  color: #2c3e50;
  word-wrap: break-word;
}

.post-header h2 .post-date {
  font-size: 0.6em;
  font-weight: 400;
  color: #7f8c8d;
  margin-left: 10px;
}

.post-header .post-meta {
  font-size: 0.85em;
  color: #7f8c8d;
}

.post-header .post-meta .day-number {
  font-weight: 600;
  color: #3498db;
}

.post-header .post-meta .stats {
  display: block;
  margin-top: 3px;
}

/* Photo Grid */
.post-photos {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  -webkit-touch-callout: none;
}

.photo-thumb:active {
  opacity: 0.8;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 0.75em;
  padding: 4px 6px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: none;
}

body.show-captions .thumb-caption {
  display: block;
}

.view-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 15px;
  padding: 4px 15px;
  font-size: 0.8em;
  color: #666;
}

.view-controls label {
  cursor: pointer;
}

.view-controls input[type="checkbox"] {
  margin-right: 4px;
  vertical-align: middle;
}

.view-controls select {
  padding: 2px 6px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
}

/* Post Text */
.post-text {
  padding: 15px;
  font-size: 1em;
  line-height: 1.7;
}

.post-text p {
  margin: 0 0 1em 0;
}

.post-text p:last-child {
  margin-bottom: 0;
}

.post-text pre {
  background: #f4f4f4;
  padding: 10px 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.9em;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.post-text code {
  background: #f4f4f4;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.post-text a {
  color: #2980b9;
  text-decoration: none;
}

.post-text a:hover {
  text-decoration: underline;
}

/* Comments Footer */
.post-footer {
  background: #d6eaf8;
  padding: 8px 15px;
  border-top: 1px solid #aed6f1;
  font-size: 0.9em;
  color: #333;
}

.post-footer .footer-info {
  color: #333;
}

.post-footer .comments-link {
  color: #922;
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
}

.post-footer .comments-link:hover {
  text-decoration: underline;
}

/* Comments Section */
.comments-section {
  padding: 6px 15px;
  background: #d6eaf8;
  border-top: 1px solid #aed6f1;
  font-size: 0.8em;
}

.comment {
  margin-bottom: 4px;
  line-height: 1.4;
}

.comment:last-child {
  margin-bottom: 0;
}

.comment strong {
  font-weight: 700;
  color: #2c3e50;
}

.comment-reply {
  margin-left: 20px;
  margin-top: 4px;
  color: #555;
}

.comment-reply .reply-author {
  color: #666;
  font-weight: 400;
}

/* ============================================
   LIGHTBOX / GALLERY
   ============================================ */

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.97);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  padding-top: 50px;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-caption {
  color: white;
  text-align: center;
  padding: 10px;
  font-size: 0.95em;
  max-width: 100%;
  word-wrap: break-word;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  font-size: 1.8em;
  padding: 15px 12px;
  cursor: pointer;
  z-index: 1001;
  border-radius: 4px;
}

.lightbox-nav:active {
  background: rgba(255,255,255,0.3);
}

.lightbox-nav.prev {
  left: 5px;
}

.lightbox-nav.next {
  right: 5px;
}

.lightbox-close {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  padding: 8px 12px;
  z-index: 1001;
  border-radius: 4px;
}

.lightbox-close:active {
  background: rgba(255,255,255,0.3);
}

.lightbox-download {
  color: #3498db;
  text-decoration: none;
  font-size: 0.9em;
  padding: 8px 15px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  margin-top: 5px;
}

.lightbox-counter {
  color: rgba(255,255,255,0.7);
  font-size: 0.85em;
  margin-top: 5px;
}

/* ============================================
   COMMENT POPUP
   ============================================ */

.comment-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.comment-popup-overlay.active {
  display: flex;
}

.comment-popup {
  background: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  max-height: 90vh;
  overflow-y: auto;
}

.comment-popup h3 {
  margin: 0 0 15px 0;
  color: #2c3e50;
  font-size: 1.2em;
}

.comment-popup label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
}

.comment-popup input,
.comment-popup textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px; /* Prevents iOS zoom */
  margin-bottom: 15px;
  font-family: inherit;
  -webkit-appearance: none;
}

.comment-popup textarea {
  min-height: 100px;
  resize: vertical;
}

.comment-popup .buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.comment-popup button {
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
}

.comment-popup .btn-cancel {
  background: #ecf0f1;
  color: #555;
}

.comment-popup .btn-submit {
  background: #3498db;
  color: white;
}

/* ============================================
   FULL BLOG BUTTON
   ============================================ */

.full-blog-container {
  text-align: center;
  padding: 20px;
}

.full-blog-btn {
  display: inline-block;
  padding: 15px 30px;
  background: #3498db;
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-size: 1em;
}

.full-blog-btn:active {
  background: #2980b9;
}

/* ============================================
   NO POSTS MESSAGE
   ============================================ */

.no-posts {
  text-align: center;
  padding: 40px 20px;
  color: #7f8c8d;
  font-size: 1.1em;
}

.no-posts p {
  margin: 0;
}

/* ============================================
   DESKTOP STYLES
   ============================================ */

@media (min-width: 768px) {
  .blog-header {
    padding: 8px 0;
  }

  .blog-header h1 {
    font-size: 2.5em;
  }

  .map-container {
    height: 400px;
  }

  .posts-container {
    padding: 20px;
  }

  .post {
    margin-bottom: 30px;
  }

  .post-header {
    padding: 15px 20px;
  }

  .post-header h2 {
    font-size: 1.5em;
  }

  .post-header .post-meta .stats {
    display: inline;
    margin-left: 10px;
    margin-top: 0;
  }

  .post-photos {
    padding: 15px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
  }

  .photo-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }

  .post-text {
    padding: 20px;
    font-size: 1.05em;
  }

  .lightbox-overlay {
    padding: 20px;
    padding-top: 60px;
  }

  .lightbox-nav {
    font-size: 2em;
    padding: 20px 15px;
  }

  .lightbox-nav.prev {
    left: 20px;
  }

  .lightbox-nav.next {
    right: 20px;
  }

  .lightbox-close {
    top: 20px;
    right: 20px;
    font-size: 2em;
  }

  .lightbox-nav:hover,
  .lightbox-close:hover {
    background: rgba(255,255,255,0.4);
  }
}

/* ============================================
   VERY SMALL SCREENS
   ============================================ */

@media (max-width: 374px) {
  .blog-header h1 {
    font-size: 1.5em;
  }

  .blog-header h1 .subtitle {
    display: block;
    margin-left: 0;
    margin-top: 5px;
  }

  .post-photos {
    grid-template-columns: repeat(2, 1fr);
  }
}
