/* Base Styles */
html, body {
  height: 100%;
}

body {
  background: #4DD0E1;
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Canvas Elements */
#water-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  pointer-events: none;
  display: block;
}

#cloud-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  pointer-events: none;
  display: block;
}

#boat-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  pointer-events: none;
  display: block;
}

#bottle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: none;
  display: block;
}

/* Header */
h1 {
  text-align: center;
  margin-top: 43px;
  font-size: 2.5rem;
  color: #222;
  z-index: 5;
  position: relative;
  pointer-events: none;
}

h2 {
  text-align: center;
  font-size: 1.5rem;
  color: #222;
  z-index: 5;
  position: relative;
  pointer-events: none;
}

/* Counter */
#sunk-ships-counter {
  position: fixed;
  top: 10px;
  right: 20px;
  background: rgba(44, 62, 80, 0.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 1.2rem;
  z-index: 9999;
  display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  pointer-events: none;
}

/* Island Grid */
.island-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;
  max-width: 1200px;
  margin-top: 40px;
  margin-bottom: 0px;
  margin-left: auto;
  margin-right: auto;
  direction: ltr;
}

.island {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 18px;
  padding: 16px 8px 8px 8px;
  transition: transform 0.2s;
  cursor: pointer;
  position: relative;
  grid-area: auto;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.island img {
  width: 120px;
  height: auto;
  margin-bottom: 12px;
  border-radius: 12px;
}

.city-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #2a4d69;
  text-align: center;
  position: relative;
  z-index: 5;
}

.city-subtitle {
  font-size: 1rem;
  color: #fff;
  text-align: center;
  position: relative;
  z-index: 5;
  font-style: italic;
  padding-bottom: 10px;
}

/* Island Tooltips */
.island-tooltip {
  background: rgba(44, 62, 80, 0.97);
  color: #fff;
  padding: 10px 16px;
  border-radius: 5px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 10;
  font-size: 1rem;
  margin-top: 1.5em;
  max-width: 12em;
}

.island-tooltip a {
  color: #ffd700;
  text-decoration: underline;
  text-align: center;
  display: block;
  padding-top: 10px;
}

.city-dates {
    font-size: 0.9rem;
}

.city-duration {
    font-size: 0.9rem;
    padding-top: 10px;
}

/* Night Mode Toggle */
.night-mode-toggle {
  position: fixed;
  top: 10px;
  left: 20px;
  background: rgba(44, 62, 80, 0.9);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 25px;
  font-size: 1rem;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.night-mode-toggle:hover {
  background: rgba(44, 62, 80, 1);
  transform: scale(1.05);
}

.night-mode-toggle::before {
  content: "🌙";
  margin-right: 8px;
  font-size: 1.2em;
}

.night-mode .night-mode-toggle::before {
  content: "☀️";
}

/* Blog Reader Overlay */
.blog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
}

.blog-overlay.active {
  display: flex;
  opacity: 1;
}

.blog-content {
  background: #fff;
  margin: 20px;
  border-radius: 5px;
  max-width: 800px;
  width: 100%;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-family: 'Georgia', serif;
  line-height: 1.6;
  color: #333;
}

.blog-header {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
}

.blog-title {
  font-size: 1.5rem;
  font-weight: bold;
  color: rgba(0, 0, 0, 0.8);
  margin: 0;
}

.return-button {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.return-button:hover {
  background: rgba(0, 0, 0, 1);
}

.share-button {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
  margin-right: 10px;
}

.share-button:hover {
  background: rgba(0, 0, 0, 1);
}

.share-button.copied {
  background: #28a745;
}

.blog-text {
  padding: 30px;
  font-size: 1.1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Markdown element styling */
.blog-text h1 {
  font-size: 2rem;
  font-weight: bold;
  color: #2a4d69;
  margin: 1.5rem 0 1rem 0;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 0.5rem;
}

.blog-text h2 {
  font-size: 1.6rem;
  font-weight: bold;
  color: #2a4d69;
  margin: 1.3rem 0 0.8rem 0;
}

.blog-text h3 {
  font-size: 1.3rem;
  font-weight: bold;
  color: #2a4d69;
  margin: 1rem 0 0.6rem 0;
}

.blog-text p {
  margin: 0.8rem 0;
  line-height: 1.7;
}

.blog-text strong {
  font-weight: bold;
  color: #1e3a4f;
}

.blog-text em {
  font-style: italic;
  color: #4a6b8a;
}

.blog-text a {
  color: #0066cc;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.blog-text a:hover {
  color: #004499;
}

.blog-text br {
  line-height: 1.5;
}

/* Text Animation Styles */
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: #333;
  animation: blink 1s infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.fade-in-text {
  opacity: 0;
  animation: fadeInText 0.8s ease-out forwards;
}

@keyframes fadeInText {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up-text {
  opacity: 0;
  transform: translateY(20px);
  animation: slideUpText 0.6s ease-out forwards;
}

@keyframes slideUpText {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-text {
  position: relative;
  overflow: hidden;
}

.reveal-text::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  animation: revealText 1.2s ease-out forwards;
}

@keyframes revealText {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

.paragraph-fade {
  opacity: 0;
  transform: translateY(10px);
  animation: paragraphFade 0.5s ease-out forwards;
}

@keyframes paragraphFade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gentle-type {
  opacity: 0;
  animation: gentleType 0.1s ease-out forwards;
}

@keyframes gentleType {
  to { opacity: 1; }
}

/* Night Mode Styles */
.night-mode {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3a 50%, #2d1b69 100%);
  transition: background 0.8s ease;
}

.night-mode h1 {
  color: #e6e6ff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.night-mode .city-name {
  color: #b3b3ff;
  text-shadow: 0 0 10px rgba(179, 179, 255, 0.5);
}

.night-mode .island img {
  filter: 
    brightness(0.6)
    contrast(1.6)
    saturate(0.7)
    hue-rotate(200deg)
    sepia(0.2);
  transition: all 0.8s ease;
  position: relative;
}

.night-mode .island-tooltip {
  background: rgba(15, 15, 35, 0.95);
  border: 1px solid rgba(179, 179, 255, 0.3);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(100, 150, 255, 0.2);
}

.night-mode #water-canvas,
.night-mode #cloud-canvas,
.night-mode #boat-canvas,
.night-mode #bottle-canvas {
  filter: brightness(0.5) contrast(1.2);
  transition: filter 0.8s ease;
}

.night-mode::before {
  opacity: 0.6;
}

.night-mode .island-grid {
  position: relative;
  z-index: 2;
}

.night-mode line {
  stroke: darkcyan;
}

/* Night mode blog overlay */
.night-mode .blog-content {
  background: #1a1a1a;
  color: #e0e0e0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.night-mode .blog-header {
  background: #0f0f0f;
  border-bottom: 1px solid #333;
}

.night-mode .blog-title {
  color: #ffffff;
}

.night-mode .return-button {
  background: #333;
  color: #ffffff;
}

.night-mode .return-button:hover {
  background: #555;
}

.night-mode .share-button {
  background: #333;
  color: #ffffff;
}

.night-mode .share-button:hover {
  background: #555;
}

.night-mode .share-button.copied {
  background: #28a745;
}

.night-mode .typing-cursor {
  background: #ffffff;
}

/* Quote display animations */
@keyframes wipeIn {
  0% {
    clip-path: inset(0 0 100% 0);
  }
  100% {
    clip-path: inset(0 0 0% 0);
  }
}

@keyframes mirageIn {
  0% {
    opacity: 0;
    filter: blur(15px) hue-rotate(180deg);
  }
  25% {
    opacity: 0.3;
    filter: blur(8px) hue-rotate(90deg);
  }
  50% {
    opacity: 0.6;
    filter: blur(4px) hue-rotate(45deg);
  }
  75% {
    opacity: 0.8;
    filter: blur(1px) hue-rotate(10deg);
  }
  100% {
    opacity: 1;
    filter: blur(0px) hue-rotate(0deg);
  }
}

/* Night mode markdown elements */
.night-mode .blog-text h1,
.night-mode .blog-text h2,
.night-mode .blog-text h3 {
  color: #ffffff;
  border-bottom-color: #333;
}

.night-mode .blog-text strong {
  color: #ffffff;
}

.night-mode .blog-text em {
  color: #cccccc;
}

.night-mode .blog-text a {
  color: #66b3ff;
}

.night-mode .blog-text a:hover {
  color: #99ccff;
}

/* Responsive Design */
@media (max-width: 900px) {
  .island-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
  }
  
  body {
    scroll-snap-type: y proximity;
  }

  h1 {
    margin-top: 70px;
  }
  
  .island-grid {
    grid-template-columns: 1fr !important;
    justify-items: center;
    gap: 10vh;
    padding: 0 20px;
  }
  
  .island {
    grid-area: auto !important;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  .island-tooltip {
    max-width: 100%;
  }
  
  .blog-content {
    margin: 10px;
    max-height: calc(100dvh - 20px);
  }
  
  .blog-header {
    padding: 15px;
  }
  
  .blog-text {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    padding: 1.5rem;
    line-height: 1.6;
  }
  
  .blog-title {
    font-size: 1.3rem;
  }

  .blog-text p {
    margin: 2rem 0;
  }
} 