:root {
  --bg-gradient-start: #f7f9fc;
  --bg-gradient-end: #edf1f7;
  --text-color: #333;
  --text-color-dark: #1a1a1a;
  --text-color-light: #555;
  --text-color-lighter: #777;
  --card-bg: #fff;
  --card-bg-hover: #e8f0fa;
  --card-shadow: rgba(0,0,0,0.05);
  --card-shadow-hover: rgba(37, 99, 235, 0.1);
  --link-bg: #f8fafd;
  --link-color: #5182c8;
  --link-hover: #2c5999;
  --border-color: rgba(0,0,0,0.03);
  --star-color: #e9a800;
}

@media (prefers-color-scheme: dark) {
  :root.auto-theme {
    --bg-gradient-start: #1a1f2b;
    --bg-gradient-end: #121620;
    --text-color: #e1e1e1;
    --text-color-dark: #f5f5f5;
    --text-color-light: #b8b8b8;
    --text-color-lighter: #a0a0a0;
    --card-bg: #222836;
    --card-bg-hover: #2d364a;
    --card-shadow: rgba(0,0,0,0.2);
    --card-shadow-hover: rgba(0,0,0,0.3);
    --link-bg: #1c2433;
    --link-color: #5d9aef;
    --link-hover: #7ab0ff;
    --border-color: rgba(255,255,255,0.05);
    --star-color: #ffc41f;
  }
}

:root.dark-theme {
  --bg-gradient-start: #1a1f2b;
  --bg-gradient-end: #121620;
  --text-color: #e1e1e1;
  --text-color-dark: #f5f5f5;
  --text-color-light: #b8b8b8;
  --text-color-lighter: #a0a0a0;
  --card-bg: #222836;
  --card-bg-hover: #2d364a;
  --card-shadow: rgba(0,0,0,0.2);
  --card-shadow-hover: rgba(0,0,0,0.3);
  --link-bg: #1c2433;
  --link-color: #5d9aef;
  --link-hover: #7ab0ff;
  --border-color: rgba(255,255,255,0.05);
  --star-color: #ffc41f;
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(to bottom, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-color);
  text-align: center;
  margin: 0;
  padding: 40px 20px;
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

img.profile {
  width: 120px;
  border-radius: 50%;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

h1 {
  color: var(--text-color-dark);
  font-size: 2.2rem;
  margin-bottom: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  max-width: 95%;
}

p.description {
  max-width: 580px;
  margin: 0 auto 50px;
  line-height: 1.6;
  color: var(--text-color-light);
  padding: 0 10px;
}

.categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  margin-top: 40px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 15px;
}

.category {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 4px 20px var(--card-shadow);
  padding: 30px 24px 22px 24px;
  min-width: 260px;
  max-width: 320px;
  flex: 1 1 260px;
  margin-bottom: 24px;
  transition: box-shadow 0.3s, transform 0.2s, background 0.3s ease;
  border: 1px solid var(--border-color);
  width: calc(33.333% - 30px);
}

.category:hover {
  box-shadow: 0 8px 30px var(--card-shadow-hover);
  transform: translateY(-2px);
}

.category h2 {
  font-size: 1.35em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  color: var(--text-color-dark);
  font-weight: 600;
}

.emoji {
  font-size: 1.25em;
}

.link-card {
  width: 100%;
  margin: 14px 0;
  border: none;
  box-shadow: 0 2px 8px var(--card-shadow);
  background: var(--link-bg);
  color: var(--text-color-dark);
  font-size: 1em;
  padding: 18px 10px 14px 10px;
  border-radius: 10px;
  transition: all 0.25s ease;
  display: block;
  border: 1px solid var(--border-color);
  text-decoration: none;
  box-sizing: border-box;
}

.link-card:hover {
  background: var(--card-bg-hover);
  box-shadow: 0 6px 16px var(--card-shadow-hover);
  transform: translateY(-2px);
}

.link-title {
  font-weight: 600;
  font-size: 1.08em;
  color: var(--text-color-dark);
  letter-spacing: -0.01em;
  padding: 0 5px;
}

.link-desc {
  font-weight: 400;
  font-size: 0.96em;
  color: var(--text-color-light);
  margin-top: 2px;
  display: inline-block;
  padding: 0 5px;
}

.link-desc .highlight {
  font-weight: 500;
  color: var(--link-color);
  opacity: 0.9;
}

/* Visual style for coffee brewing method keywords */
.coffee-method {
  display: inline-block;
  margin-right: 4px;
  font-weight: 500;
  font-style: italic;
  border-bottom: 1px dotted var(--link-color);
}

.wave {
  display: inline-block;
  animation: wave-animation 2.5s ease-in-out infinite;
  transform-origin: 70% 70%;
}

@keyframes wave-animation {
  0% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

.subtle {
  color: var(--text-color-lighter);
  font-size: 0.97em;
  letter-spacing: 0.01em;
}

.footer {
  margin-top: 70px;
  color: var(--text-color-lighter);
  font-size: 0.95em;
  letter-spacing: 0.02em;
  padding-bottom: 30px;
  padding-left: 15px;
  padding-right: 15px;
  line-height: 1.7;
  border-top: 1px solid rgba(81, 130, 200, 0.2);
  padding-top: 20px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.footer-link {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px dotted rgba(81, 130, 200, 0.5);
  transition: all 0.2s;
}

.footer-link:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

.star {
  color: var(--star-color);
  font-size: 1em;
  margin-left: 3px;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(255,255,255,0.2));
}

.category-desc {
  color: var(--text-color-light);
  font-size: 0.96em;
  margin-bottom: 16px;
  margin-top: -5px;
  line-height: 1.5;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}

.visitor-info {
  margin-top: 20px;
  font-size: 0.85em;
  color: var(--text-color-lighter);
  opacity: 0.8;
  border-top: 1px dashed rgba(81, 130, 200, 0.15);
  padding-top: 15px;
  line-height: 1.5;
}

#last-updated, #visitor-location {
  margin: 3px 0;
}

@media (max-width: 1100px) {
  .category {
    width: calc(50% - 30px);
    max-width: 450px;
  }
}

@media (max-width: 900px) {
  .categories {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }

  .category {
    margin: 0 auto 25px auto;
    width: 100%;
    max-width: 500px;
    min-width: 0;
  }

  body {
    padding: 30px 15px;
  }

  h1 {
    font-size: 1.9rem;
  }

  .theme-switch-wrapper {
    top: 15px;
    right: 15px;
  }
}

@media (max-width: 480px) {
  .category {
    padding: 25px 20px 18px 20px;
  }

  .link-card {
    padding: 15px 0 12px 0;
  }

  body {
    padding: 25px 12px;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 45px;
  height: 45px;
  background-color: var(--card-bg);
  color: var(--link-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 12px var(--card-shadow);
  border: 1px solid var(--border-color);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 100;
  cursor: pointer;
  transform: translateY(20px) scale(0.9);
}

.back-to-top.visible {
  opacity: 0.9;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 15px var(--card-shadow-hover);
  color: var(--link-hover);
}

.back-to-top:active {
  transform: translateY(0) scale(0.95);
  transition: all 0.1s ease;
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  transition: all 0.3s ease;
}

/* Dark mode specific back-to-top styling */
:root.dark .back-to-top {
  background-color: rgba(34, 40, 54, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Light mode specific back-to-top styling */
:root.light .back-to-top {
  background-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Make sure the button doesn't overlap with other elements on mobile */
@media (max-width: 768px) {
  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
  }

  .back-to-top svg {
    width: 18px;
    height: 18px;
  }
}

.theme-switch-wrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  z-index: 100;
}

.theme-switch {
  display: flex;
  background: var(--card-bg);
  border-radius: 30px;
  padding: 5px;
  box-shadow: 0 4px 15px var(--card-shadow);
  border: 1px solid var(--border-color);
  transition: background 0.3s ease;
}

.theme-switch button {
  border: none;
  background: transparent;
  color: var(--text-color-light);
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 500;
  opacity: 0.7;
  transition: all 0.2s;
}

.theme-switch button.active {
  background: rgba(81, 130, 200, 0.15);
  color: var(--link-color);
  opacity: 1;
}

.theme-switch button:hover {
  opacity: 1;
}

/* Easter Egg Styles */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1000;
  animation: confetti-fall 4s ease-in-out forwards;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.easter-egg-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--card-bg);
  color: var(--text-color-dark);
  padding: 20px 30px;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  animation: bounce-in 0.5s ease-out;
  transition: opacity 1s ease;
}

.easter-egg-message .small {
  font-size: 1rem;
  color: var(--text-color-light);
  display: block;
  margin-top: 8px;
}

.easter-egg-message.fade-out {
  opacity: 0;
}

@keyframes bounce-in {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  70% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.hidden-icon {
  position: fixed;
  bottom: 20px;
  left: 20px;
  font-size: 20px;
  opacity: 0.15;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 100;
  user-select: none;
}

.hidden-icon:hover {
  opacity: 0.5;
  transform: rotate(15deg);
}

.hidden-icon:active {
  transform: scale(1.2) rotate(15deg);
}

.logo-wrapper {
  text-align: center;
  margin-bottom: 10px;
  padding: 5px;
  border-radius: 50%;
  display: inline-block;
  margin: 0 auto 10px;
}

/* Add a subtle background in light mode for better contrast */
:root.light .logo-wrapper {
  background-color: rgba(0, 0, 0, 0.03);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.site-logo {
  height: 40px;
  width: auto;
  opacity: 0.85;
  transition: all 0.3s ease;
}

/* Add contrast in light mode */
:root.light .site-logo {
  filter: brightness(0.7) contrast(1.3);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Maintain visibility in dark mode */
:root.dark .site-logo {
  filter: brightness(1.1) drop-shadow(0 1px 3px rgba(255, 255, 255, 0.1));
}

.site-logo:hover {
  opacity: 1;
  transform: scale(1.05);
}
