/**
 * Tripuppy — Corner layout. Photo is hero; info in corners, grouped.
 */

:root {
  --text: #fff;
  --text-muted: rgba(255, 255, 255, 0.82);
  --card-bg: rgba(0, 0, 0, 0.28);
  --card-border: rgba(255, 255, 255, 0.08);
  /* Typography: display (logo), heading (city name), body (intro text), ui (labels, buttons) */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-heading: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --space: 20px;
  --space-sm: 12px;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: 0.25s ease;
  --ken-burns: 26s;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Hero — full bleed, central */
.hero-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: #0c0c0c center/cover no-repeat;
  transform-origin: center;
}

.hero-bg--current { z-index: 1; opacity: 1; }
.hero-bg--next { z-index: 0; opacity: 0; }

.hero-bg.ken-burns {
  animation: kenBurns var(--ken-burns) ease-in-out forwards;
}

.hero-bg--current.initial-reveal {
  animation: heroReveal 1s ease-out forwards;
}

.hero-bg--current.initial-reveal.ken-burns {
  animation: heroReveal 1s ease-out forwards,
             kenBurns var(--ken-burns) ease-in-out 1s forwards;
}

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

@keyframes kenBurns {
  0% { transform: scale(1); }
  100% { transform: scale(1.04); }
}

.hero-bg--next.crossfade-in {
  z-index: 2;
  opacity: 1;
  transition: opacity 0.6s ease;
}

.hero-bg--current.crossfade-out {
  opacity: 0;
  z-index: 0;
  transition: opacity 0.6s ease;
}

/* Overlay — light vignette so the photo stays enjoyable */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    ellipse 85% 75% at 50% 50%,
    transparent 40%,
    rgba(0, 0, 0, 0.15) 100%
  );
  pointer-events: none;
}

/* UI layer — corners only */
.ui-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  padding: var(--space);
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  padding-left: max(var(--space), env(safe-area-inset-left));
  padding-right: max(var(--space), env(safe-area-inset-right));
  transition: opacity var(--ease);
}

.ui-layer > * { pointer-events: auto; }
.ui-layer.idle { opacity: 0.2; }

/* Corner positions */
.corner {
  position: absolute;
  max-width: min(320px, 85vw);
  opacity: 0;
  animation: cardIn 0.5s ease forwards;
}

.corner--tl { top: var(--space); left: var(--space); animation-delay: 0.05s; max-width: none; }
.corner--left { bottom: max(var(--space), env(safe-area-inset-bottom)); left: var(--space); animation-delay: 0.15s; }
.corner--tr { top: var(--space); right: var(--space); animation-delay: 0.2s; }
.corner--tr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.corner--br { bottom: max(var(--space), env(safe-area-inset-bottom)); right: var(--space); animation-delay: 0.3s; }

.ui-layer.idle .corner { animation: none; opacity: 1; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Top-left: Logo only — display font, minimal */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  transition: opacity var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.logo:hover { opacity: 0.92; }

.logo__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
}

.logo__mark img {
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.logo__wordmark {
  position: relative;
  top: 1px;
}

/* Bottom-left: City card only */
.corner--left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* Top-right: Icon-only buttons — icon-first, simple */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  min-width: 44px;
  min-height: 44px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.28s ease, border-color 0.28s ease, background 0.28s ease,
              transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.28s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-icon--compact {
  padding: 10px;
}

.btn-icon:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.04);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.btn-icon:active {
  transform: scale(0.98);
}

.btn-icon:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.btn-icon__svg {
  flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-icon:hover .btn-icon__svg--arrow {
  transform: translateX(3px);
}

.btn-about:hover .btn-icon__svg {
  transform: scale(1.1);
}

/* Labels hidden for icon-only design */
.btn-icon .btn-icon__label {
  display: none;
}

.btn-discover:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-discover:disabled:hover {
  transform: none;
}

/* Favorites panel — slide-in from right */
.favorites-panel {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.favorites-panel.is-open {
  opacity: 1;
  visibility: visible;
}

.favorites-panel.is-open .favorites-panel__card {
  transform: translateX(0);
}

.favorites-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.favorites-panel__card {
  position: relative;
  width: min(360px, 92vw);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--card-border);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.favorites-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--card-border);
}

.favorites-panel__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

.favorites-panel__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.favorites-panel__close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.favorites-panel__list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.favorites-panel__empty {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.favorite-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.favorite-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.favorite-item__thumb {
  width: 64px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #1a1a1a center/cover no-repeat;
}

.favorite-item__info {
  flex: 1;
  min-width: 0;
}

.favorite-item__name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 2px;
}

.favorite-item__country {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.favorite-item__remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
}

.favorite-item__remove:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.15);
}

.favorite-item__guide {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  margin-left: 6px;
}

.favorite-item__guide:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* Intro popout — purpose of Tripuppy */
.intro-popout {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

.intro-popout.is-open {
  opacity: 1;
  visibility: visible;
}

.intro-popout.is-open .intro-popout__card {
  transform: scale(1);
  opacity: 1;
}

.intro-popout__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.intro-popout__card {
  position: relative;
  width: min(380px, 92vw);
  padding: 28px 24px;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  transform: scale(0.96);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.intro-popout__close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.intro-popout__close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.intro-popout__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.intro-popout__logo {
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.intro-popout__wordmark {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.intro-popout__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}

.intro-popout__tagline {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 0 14px;
  line-height: 1.4;
}

.intro-popout__body {
  font-family: var(--font-body);
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0;
}

.intro-popout__body p {
  margin: 0 0 14px;
}

.intro-popout__body p:last-child {
  margin-bottom: 0;
}

.intro-popout__body strong {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 500;
}

/* Shared card glass */
.card {
  padding: var(--space-sm) var(--space);
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
}

/* Left: City block (name + introduction + map) */
.card--city {
  width: min(300px, 82vw);
}

/* City block typography: heading (name), body (country + intro) */
.card--city .city-name {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 2.8vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 2px;
  line-height: 1.2;
  color: var(--text);
}

.card--city .city-country {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
}

.card--city .introduction {
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card--city .city-local-time {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: var(--space-sm);
}

.card--city .city-local-time .local-time {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.card--city .city-local-time .local-meta {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.card--city .mini-map {
  margin-bottom: 0;
}

/* Save to favorites — subtle, in city card */
.card--city {
  position: relative;
}

.card__save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--space-sm) 0;
  padding: 6px 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--ease), background var(--ease), border-color var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.card__save:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.card__save.is-saved {
  color: #f472b6;
  border-color: rgba(244, 114, 182, 0.35);
}

.card__save.is-saved .card__save-icon { fill: currentColor; }

.card__save-icon { flex-shrink: 0; }
.card__save-label { letter-spacing: 0.02em; }

/* Map wrapper — enlarges on hover over mini-map only */
.map-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: left 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              top 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 0.4s ease,
              border-color 0.4s ease;
}

.map-wrapper .mini-map {
  width: 100%;
  height: 100%;
  min-height: 72px;
  margin-bottom: 0;
}

.map-wrapper--expanded {
  z-index: 100;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.map-wrapper--expanded .mini-map {
  height: 100%;
  min-height: 200px;
}

/* Highlight location when expanded */
.map-wrapper--expanded .map-pin__dot {
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4),
              0 0 20px rgba(255, 200, 100, 0.5);
  animation: mapPinPulse 2s ease-in-out infinite;
}

.map-wrapper--expanded .map-pin {
  z-index: 1000;
}

@keyframes mapPinPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.95; }
}

.map-placeholder {
  display: none;
  min-height: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  pointer-events: none;
}


/* Bottom-right: Time only */
.card--time {
  width: min(260px, 82vw);
}

.card__label {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.mini-map {
  position: relative;
  width: 100%;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #0d1117;
  margin-bottom: var(--space-sm);
  transition: height 0.28s ease;
}

/* Map height when not expanded is set by .map-wrapper .mini-map (72px) */

.mini-map .leaflet-tile-pane { opacity: 0.88; }
.mini-map .leaflet-control-attribution {
  font-size: 6px;
  margin: 0;
  padding: 2px 4px;
  background: rgba(0, 0, 0, 0.3) !important;
  color: rgba(255, 255, 255, 0.3);
  border: none;
}

.mini-map .map-pin { background: none !important; border: none !important; }
.mini-map .map-pin__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3);
}

.time-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

.time-row__label {
  flex-shrink: 0;
  width: 28px;
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.time-row .local-time {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.time-row .local-meta {
  font-family: var(--font-body);
  margin-left: auto;
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* Photo credit — bottom center, UI typography */
.photo-credit {
  position: absolute;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

.photo-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

body.ui-idle .photo-credit { opacity: 0.8; }

/* Responsive */
@media (max-width: 640px) {
  .ui-layer {
    padding: 14px;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .corner--tl { top: 14px; left: 14px; }
  .corner--left { left: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .corner--tr { top: 14px; }
  .corner--br { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }

  .logo { font-size: 1.1rem; }
  .logo__mark img { width: 18px; height: 18px; }

  .btn-icon { padding: 8px 12px; min-width: 40px; }
  .btn-about { padding: 8px; }
  .btn-icon__label { font-size: 0.75rem; }

  .card--city .introduction {
    -webkit-line-clamp: 2;
  }


  .photo-credit {
    font-size: 0.55rem;
    white-space: normal;
    text-align: center;
    max-width: 90vw;
  }

}
