/* Fonts loaded via <link> in HTML — no @import needed (avoids sequential blocking request) */

/* ═══════════════════════════════════════════════════════════
   SPOLORE — Mountain Editorial Design System
   Aesthetic: Organic / Editorial
   Palette:   Parchment + Terracotta + Forest
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Background / Surface ───────────────────────────────── */
  --color-bg:           #F5F2EC;   /* warm parchment */
  --color-bg-elevated:  #EDE9E0;   /* slightly deeper parchment */
  --color-bg-surface:   #FFFDF7;   /* cream white for cards */
  --color-border:       #D8D2C4;   /* warm light border */
  --color-border-deep:  #C4BBAC;   /* deeper border */

  /* ── Text ───────────────────────────────────────────────── */
  --color-text-primary:   #1C1C1A;   /* near-black, not harsh */
  --color-text-secondary: #4A4540;   /* warm dark-grey */
  --color-text-muted:     #7A7268;   /* warm mid-grey */
  --color-text-subtle:    #A09890;   /* very muted */

  /* ── Accent ─────────────────────────────────────────────── */
  --color-accent:       #C4622D;   /* terracotta — Dehradun earth */
  --color-accent-hover: #A8511F;   /* deeper terracotta */
  --color-accent-muted: rgba(196, 98, 45, 0.12);
  --color-accent-2:     #4A7C59;   /* forest green */
  --color-accent-2-muted: rgba(74, 124, 89, 0.12);

  /* ── Local Code strip ───────────────────────────────────── */
  --local-code-bg:      #1C1C1A;
  --local-code-text:    #F5F2EC;
  --local-code-muted:   #7A7268;

  /* ── Spot Type Colors ───────────────────────────────────── */
  --type-gem:       #C4622D;   /* terracotta — Underrated gem */
  --type-eat:       #D4892A;   /* saffron — Local eat */
  --type-olddoon:   #6B5B45;   /* aged brown — Old Doon */
  --type-memory:    #4A7C59;   /* forest green — Memory spot */
  --type-seasonal:  #3B7CB8;   /* monsoon blue — Seasonal window */
  --type-nature:    #2D6B4A;   /* deep green — Nature hide */
  --type-story:     #7B4E8B;   /* faded purple — Story spot */
  --type-catching:  #B83B3B;   /* warm red — Catching on */
  --type-store:     #5B8C85;   /* muted teal — Local store */

  /* ── Typography ─────────────────────────────────────────── */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* ── Spacing ─────────────────────────────────────────────── */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;

  /* ── Easing ─────────────────────────────────────────────── */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-unfold: cubic-bezier(0.32, 0.72, 0, 1);

  /* ── Radius ─────────────────────────────────────────────── */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  /* ── Backward-compat aliases for Tailwind config ────────── */
  --color-accent-compat: #C4622D;
}

/* ═══════════════════════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  margin: 0;
  padding: 0;
}

/* Viewport Lock for Web-App Pages (Map, Submission) to prevent mobile browser bouncing and address bar resizing issues */
html.viewport-locked,
body.viewport-locked {
  height: 100% !important;
  height: 100dvh !important;
  overflow: hidden !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  overscroll-behavior: none !important;
  overscroll-behavior-y: none !important;
  overscroll-behavior-x: none !important;
}

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: var(--font-display);
}

.font-mono, code {
  font-family: var(--font-mono);
}

/* Map canvas — no CSS filter applied (causes per-frame GPU readback + dropped frames on mobile) */
/* Use MapTiler style customization instead of runtime CSS filters for color adjustments */

/* ═══════════════════════════════════════════════════════════
   DESIGN SPELLS — 7 Curated Micro-Interactions
   ═══════════════════════════════════════════════════════════ */

/* 1. Ink-drop — map pin appears */
@keyframes inkDrop {
  0%   { transform: scale(0); opacity: 0; filter: blur(4px); }
  60%  { transform: scale(1.15); opacity: 1; filter: blur(0); }
  100% { transform: scale(1); }
}

/* 2. Unfold — card slides up like a folded note opening */
@keyframes unfoldUp {
  from { transform: translateY(100%) scaleY(0.92); opacity: 0; transform-origin: bottom; }
  to   { transform: translateY(0) scaleY(1); opacity: 1; }
}

/* 3. Fade slide up (general) */
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* 4. Stamp burst — save/heart button */
@keyframes stampBurst {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  60%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}

/* 5. Paper fold — share button before opening sheet */
@keyframes paperFold {
  0%   { transform: rotateY(0deg); }
  40%  { transform: rotateY(-25deg) scaleX(0.9); }
  100% { transform: rotateY(0deg); }
}

/* 6. Handwritten check draws itself */
@keyframes drawCheck {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}

/* 7. Fog lift — subtle opacity reveal on map pan */
@keyframes fogLift {
  from { opacity: 0; filter: blur(3px); }
  to   { opacity: 1; filter: blur(0); }
}

/* General fadeIn */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Typewriter cursor blink */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Utility classes */
.animate-ink-drop  { animation: inkDrop 0.45s var(--ease-bounce) forwards; }
.animate-unfold    { animation: unfoldUp 0.42s var(--ease-unfold) forwards; }
.animate-slide-up  { animation: slideUp 0.3s var(--ease-smooth) forwards; }
.animate-fade-in   { animation: fadeIn 0.3s var(--ease-smooth) forwards; }
.stamp-burst       { animation: stampBurst 0.4s var(--ease-bounce) forwards; }
.paper-fold        { animation: paperFold 0.35s var(--ease-smooth) forwards; }

@keyframes slideDown {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}
.animate-slide-down { animation: slideDown 0.35s var(--ease-smooth) forwards; }

/* ═══════════════════════════════════════════════════════════
   LOCAL CODE COMPONENT
   ═══════════════════════════════════════════════════════════ */

.local-code {
  background: var(--local-code-bg);
  color: var(--local-code-text);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 16px 0;
  position: relative;
  overflow: hidden;
}

.local-code::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-accent);
}

.local-code__header {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--local-code-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.local-code__header span {
  color: var(--color-accent);
}

.local-code__row {
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.5;
  color: var(--local-code-text);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
  opacity: 0;
  /* typewriter rows animate in via JS */
}

.local-code__row:last-child { margin-bottom: 0; }

.local-code__row.visible { opacity: 1; transition: opacity 0.2s; }

.local-code__emoji {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ═══════════════════════════════════════════════════════════
   SPOT CARD
   ═══════════════════════════════════════════════════════════ */

.spot-card {
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(28,28,26,0.05);
  transition: box-shadow 0.25s var(--ease-smooth), transform 0.25s var(--ease-smooth), border-color 0.25s var(--ease-smooth);
  position: relative;
  display: flex;
  flex-direction: column;
}

.spot-card:hover {
  box-shadow: 0 10px 24px rgba(28,28,26,0.12);
  transform: translateY(-2px);
  border-color: var(--color-border-deep);
}

.spot-card__body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.spot-card__name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text-primary);
  margin: 0 0 6px;
  transition: color 0.15s;
}

.spot-card:hover .spot-card__name {
  color: var(--color-accent);
}

.spot-card__story {
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-secondary);
  margin: 0 0 12px;
}

.spot-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.spot-card__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.spot-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  margin-top: auto;
  border-top: 1px solid var(--color-border);
}

.spot-card__drawer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--color-bg);
  border-top: 0px solid transparent;
}

.spot-card__drawer.expanded {
  grid-template-rows: 1fr;
  border-top: 1px solid var(--color-border);
}

.spot-card__drawer-inner {
  overflow: hidden;
}

.quick-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, opacity 0.15s;
}

.quick-view-toggle:hover {
  background: rgba(196, 98, 45, 0.08);
}

.quick-view-toggle i {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 12px;
}

.quick-view-toggle.expanded i {
  transform: rotate(180deg);
}

/* Save / Heart button spell */
.btn-save {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 99px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  min-height: 48px; /* mobile touch target */
}

.btn-save:hover    { color: #C44A4A; border-color: #C44A4A; }
.btn-save.saved    { color: #C44A4A; border-color: #C44A4A; background: rgba(196,74,74,0.06); }
.btn-save.stamping { animation: stampBurst 0.4s var(--ease-bounce) forwards; }

/* Share button spell */
.btn-share {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
  perspective: 300px;
}

.btn-share:hover     { color: var(--color-accent); border-color: var(--color-accent); }
.btn-share.folding   { animation: paperFold 0.35s var(--ease-smooth) forwards; }

/* ═══════════════════════════════════════════════════════════
   MAP CONTROLS
   ═══════════════════════════════════════════════════════════ */

.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-bottom-left { display: none !important; }

.maplibregl-ctrl-group {
  background: var(--color-bg-surface) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 15px rgba(28,28,26,0.12) !important;
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  background-color: var(--color-bg-surface) !important;
  border-bottom: 1px solid var(--color-border) !important;
  width: 36px !important;
  height: 36px !important;
}

.maplibregl-ctrl-group button:hover {
  background-color: var(--color-bg-elevated) !important;
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(0.4) sepia(0.2);
}

/* ═══════════════════════════════════════════════════════════
   MAP PINS
   ═══════════════════════════════════════════════════════════ */

.spot-marker {
  cursor: pointer;
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.spot-marker .spot-squircle-wrap,
.spot-marker svg {
  transition: transform 0.2s var(--ease-bounce), filter 0.2s;
  filter: drop-shadow(0 2px 6px rgba(28,28,26,0.25));
  display: flex;
  transform-origin: bottom center;
  will-change: transform;
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Glassmorphism enabled on desktop / capable screens */
.spot-hover-pill__inner,
.spot-squircle-body {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Phase 1 Mobile Optimization: Disable heavy blur & complex shadows on touch devices */
@media (max-width: 640px) {
  .spot-hover-pill__inner,
  .spot-squircle-body {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #FFFDF7 !important; /* Solid opaque cream white for zero GPU blur tax */
  }

  .spot-marker .spot-squircle-wrap {
    filter: drop-shadow(0 2px 4px rgba(28,28,26,0.18)) !important; /* Lighter shadow calculation */
  }
}

.spot-marker:hover .spot-squircle-wrap,
.spot-marker:hover svg {
  transform: scale(1.14) translateY(-3px);
  filter: drop-shadow(0 6px 14px rgba(28,28,26,0.35));
}

/* Hover pill tooltip */
.spot-hover-pill {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.94);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s var(--ease-bounce);
  white-space: nowrap;
  z-index: 50;
}

.spot-marker:hover .spot-hover-pill {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.spot-hover-pill__inner {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: 99px;
  padding: 5px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  box-shadow: 0 4px 14px rgba(28,28,26,0.15);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Spot label (legacy — keep for fallback) */
.spot-label {
  margin-top: 2px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  color: #FFFFFF;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000,
               -1px 1px 0 #000, 1px 1px 0 #000,
               0 0 6px rgba(0,0,0,0.8);
}

/* ═══════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════ */

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Typewriter cursor */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--color-accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

/* Submit success check SVG */
.draw-check {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: drawCheck 0.5s var(--ease-smooth) 0.1s forwards;
}

/* Filter pill chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  min-height: 36px;
}

.filter-chip:hover,
.filter-chip.active {
  color: var(--color-text-primary);
  border-color: var(--color-text-primary);
  background: var(--color-bg);
}

/* ═══════════════════════════════════════════════════════════
   MOBILE TOUCH & FAST NAV TRANSITIONS
   ═══════════════════════════════════════════════════════════ */

/* Instant touch feedback for mobile navigation */
nav a {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Eliminate tap delays on mobile touch devices */
html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

/* ═══════════════════════════════════════════════════════════
   LEGACY COMPAT — MapLibre popup
   ═══════════════════════════════════════════════════════════ */

.maplibregl-popup-content {
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(28,28,26,0.12);
  border: 1px solid var(--color-border);
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 13px;
}
