/* ==========================================================================
   SKTED Design System — tokens, resets and shared furniture.
   Loaded before every page-specific stylesheet.

   The language is editorial rather than "app": near-black ink, warm paper
   text, one hot accent, hairline rules instead of glass panels, a serif
   display face against a mono metadata face. Everything else follows from
   those four decisions.
   ========================================================================== */

:root {
  /* ---- Ink — the deep end. Cold, slightly blue, never pure black. ------- */
  --ink-900: #06080b;
  --ink-800: #0a0e13;
  --ink-700: #10161d;
  --ink-600: #171f28;
  --ink-500: #222c37;

  /* ---- Paper — warm off-white, so text never glares on a dark field. ---- */
  --paper: #f2efe8;
  --paper-dim: #b9b4a8;
  --paper-faint: #6f6d68;

  /* ---- Accents. One hot, one cold, the rest for state only. ------------- */
  --ember: #e8622c;        /* primary — flare orange */
  --ember-soft: #f08a5d;
  --ember-deep: #b8461b;
  --glacier: #79c6dd;      /* secondary — cold water */
  --sand: #d8c39a;
  --moss: #7fa05f;
  --signal-bad: #e2705f;

  --hairline: rgba(242, 239, 232, 0.14);
  --hairline-soft: rgba(242, 239, 232, 0.07);

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --measure: 66ch;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Radii — sharp. A 3px corner is the difference between "software" and
     "print". Pills survive because buttons and tags need them. */
  --r-xs: 2px;
  --r-sm: 3px;
  --r-lg: 4px;
  --r-pill: 999px;

  /* Shadows carry almost nothing here; separation comes from hairlines.
     These are for things that genuinely float above the page. */
  --sh-md: 0 14px 34px -12px rgba(0, 0, 0, 0.7);
  --sh-lg: 0 34px 72px -24px rgba(0, 0, 0, 0.85);

  --header-h: 72px;
  --nav-h: var(--header-h);
  --maxw: 1560px;
}

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

* {
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  background: var(--ink-900);
  color: var(--paper);
  min-height: 100vh;
  font-size: clamp(1rem, 0.94rem + 0.25vw, 1.0625rem);
  line-height: 1.65;
  letter-spacing: -0.005em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--ember);
  color: var(--ink-900);
}

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Legacy hook — pages ship an empty .glow-bg div; nothing draws it now. */
.glow-bg {
  display: none;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 239, 232, 0.16) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(242, 239, 232, 0.14);
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(242, 239, 232, 0.26);
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* --------------------------------------------------------------------------
   Film grain — one tiled SVG noise, fixed so it never scrolls with content.
   Pages that own the full viewport (the maps) opt out by hiding .grain.

   `mix-blend-mode` forces everything beneath into a single composited layer,
   so this is kept as small and as still as it can be: the inset only needs to
   cover the 6% drift, it gets its own layer, and on touch devices — where the
   repaint costs battery and the texture is invisible anyway — it holds still.
   -------------------------------------------------------------------------- */

.grain {
  position: fixed;
  inset: -8%;
  z-index: 300;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  transform: translateZ(0);
  will-change: transform;
  animation: grain-shift 6s steps(6) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate3d(0, 0, 0); }
  20%  { transform: translate3d(-6%, 4%, 0); }
  40%  { transform: translate3d(4%, -5%, 0); }
  60%  { transform: translate3d(-3%, 6%, 0); }
  80%  { transform: translate3d(6%, 3%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

@media (hover: none) {
  .grain {
    animation: none;
    will-change: auto;
  }
}

/* --------------------------------------------------------------------------
   Typography primitives
   -------------------------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

/* Sized so a three-line hero headline still clears the viewport on a laptop
   and a phone — the scroll cue below it has to stay visible. */
.display-xl { font-size: clamp(2.5rem, 7vw, 6.6rem); line-height: 0.96; }
.display-lg { font-size: clamp(2.4rem, 6.2vw, 5.4rem); line-height: 0.96; }
.display-md { font-size: clamp(2rem, 4.2vw, 3.6rem); }
.display-sm { font-size: clamp(1.5rem, 2.4vw, 2.2rem); }

.lead {
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.35rem);
  line-height: 1.55;
  color: var(--paper-dim);
  max-width: var(--measure);
  text-wrap: pretty;
}

/* The mono label carries every eyebrow, coordinate and piece of metadata in
   the system. If a string is data rather than prose, it belongs here. */
.label,
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-faint);
  line-height: 1.5;
}

.label--ember,
.eyebrow {
  color: var(--ember);
}

.label-dot::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.7em;
  border-radius: 50%;
  background: var(--ember);
  vertical-align: 0.15em;
  animation: pulse-ring 2.6s var(--ease-out) infinite;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(232, 98, 44, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(232, 98, 44, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 98, 44, 0); }
}

/* The old gradient-text helper now just prints paper — a gradient across a
   serif headline muddies it. Kept so existing markup needs no edit. */
.grad-text {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(4.5rem, 10vw, 9rem);
}

.rule {
  height: 1px;
  background: var(--hairline-soft);
  border: 0;
}

/* A hairline grid: 1px gaps over a rule-coloured backdrop, so cells are
   separated by real rules rather than by shadow. Used across the app. */
.hairgrid {
  display: grid;
  gap: 1px;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline-soft);
}

/* Legacy alias — .glass used to mean a blurred panel. It now means a
   hairline-bounded surface. */
.glass {
  background: var(--ink-800);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg);
}

/* --------------------------------------------------------------------------
   App header (map / explore / auth / creator studio)
   -------------------------------------------------------------------------- */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(6, 8, 11, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--hairline-soft);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* The chevron mark, shared with the landing header. */
.brand-icon {
  display: block;
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--ember);
}

.brand-icon svg {
  width: 100%;
  height: 100%;
}

/* The wordmark is mono, not a gradient. It reads as a stamp. */
.brand-title,
.brand-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--paper);
  white-space: nowrap;
  line-height: 1.3;
}

.brand,
.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
}

/* Splitting the wordmark out of one big anchor (auth.html) — both halves still
   go home, so the header looks and behaves as it does everywhere else. */
.brand-home,
.brand-title-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

/* The icon used to be the flex child that held its own width. */
.brand-home {
  flex: none;
}

.guide-subtitle {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

/* A subtitle that names an action rather than the page. Same type, but it is
   a real button with a touch target, not decoration inside a link. */
.guide-subtitle-btn {
  display: block;
  padding: 2px 0;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: color 0.3s var(--ease-out);
}

.guide-subtitle-btn:hover,
.guide-subtitle-btn:focus-visible {
  color: var(--ember);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
}

.nav-back-btn:hover {
  color: var(--paper);
  border-color: var(--paper);
  transform: translateX(-2px);
}

/* Below this the back button, the wordmark, the mode switch and the page
   action stop fitting on one line and start overlapping each other. The
   wordmark goes first: the compass mark still links home, and it is the only
   piece here that is decoration rather than navigation. */
@media (max-width: 700px) {
  .app-header {
    padding-inline: 14px;
    gap: 8px;
  }

  .app-header .brand-title,
  .app-header .brand-name {
    display: none;
  }

  .app-header .brand-container {
    gap: 8px;
  }

  .app-header .header-actions {
    gap: 6px;
  }

  .nav-back-btn span {
    display: none;
  }

  .nav-back-btn {
    padding: 0 10px;
  }
}

/* --------------------------------------------------------------------------
   Buttons

   One shape: a mono-lettered pill whose fill wipes up from the bottom on
   hover. Primary carries the ember; secondary is a hairline outline.
   -------------------------------------------------------------------------- */

.btn,
.btn-primary,
.btn-primary-action,
.btn-create-header,
.btn-explore-nav,
.nav-dash-btn,
.btn-edit-map,
.btn-empty-explore,
.auth-submit-btn,
.save-pin-btn,
.btn-guest,
.btn-signin,
.btn-hero-primary,
.btn-hero-secondary,
.btn-ghost,
.card-cta,
.nav-cta {
  --btn-bg: transparent;
  --btn-fg: var(--paper);
  --btn-line: var(--hairline);
  --btn-fill: var(--paper);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.95rem 1.5rem;
  border: 1px solid var(--btn-line);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.45s var(--ease-out), border-color 0.45s var(--ease-out);
}

.btn::after,
.btn-primary::after,
.btn-primary-action::after,
.btn-create-header::after,
.btn-explore-nav::after,
.nav-dash-btn::after,
.btn-edit-map::after,
.btn-empty-explore::after,
.auth-submit-btn::after,
.save-pin-btn::after,
.btn-guest::after,
.btn-signin::after,
.btn-hero-primary::after,
.btn-hero-secondary::after,
.btn-ghost::after,
.card-cta::after,
.nav-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-fill);
  transform: translateY(101%);
  transition: transform 0.5s var(--ease-out);
}

.btn:hover,
.btn-primary:hover,
.btn-primary-action:hover,
.btn-create-header:hover,
.btn-explore-nav:hover,
.nav-dash-btn:hover,
.btn-edit-map:hover,
.btn-empty-explore:hover,
.auth-submit-btn:hover,
.save-pin-btn:hover,
.btn-guest:hover,
.btn-signin:hover,
.btn-hero-primary:hover,
.btn-hero-secondary:hover,
.btn-ghost:hover,
.card-cta:hover,
.nav-cta:hover {
  color: var(--ink-900);
  border-color: var(--paper);
}

.btn:hover::after,
.btn-primary:hover::after,
.btn-primary-action:hover::after,
.btn-create-header:hover::after,
.btn-explore-nav:hover::after,
.nav-dash-btn:hover::after,
.btn-edit-map:hover::after,
.btn-empty-explore:hover::after,
.auth-submit-btn:hover::after,
.save-pin-btn:hover::after,
.btn-guest:hover::after,
.btn-signin:hover::after,
.btn-hero-primary:hover::after,
.btn-hero-secondary:hover::after,
.btn-ghost:hover::after,
.card-cta:hover::after,
.nav-cta:hover::after {
  transform: translateY(0);
}

.btn:active,
.btn-primary:active,
.btn-primary-action:active,
.auth-submit-btn:active,
.save-pin-btn:active,
.btn-hero-primary:active,
.btn-guest:active {
  transform: scale(0.985);
}

/* Ember — the one filled button on any given screen. */
.btn--ember,
.btn-primary,
.btn-primary-action,
.btn-create-header,
.auth-submit-btn,
.save-pin-btn,
.btn-hero-primary,
.btn-guest,
.nav-cta {
  --btn-bg: var(--ember);
  --btn-fg: var(--ink-900);
  --btn-line: var(--ember);
  font-weight: 500;
}

/* Compact header variants */
.btn-explore-nav,
.nav-dash-btn,
.btn-create-header,
.nav-cta {
  padding: 0.66rem 1.05rem;
  font-size: 0.64rem;
}

.btn-arrow,
.btn__arrow,
.btn-glyph {
  display: inline-block;
  transition: transform 0.45s var(--ease-out);
}

.btn:hover .btn-arrow,
.btn:hover .btn__arrow,
.btn-primary:hover .btn-arrow,
.auth-submit-btn:hover .btn-arrow,
.btn-hero-primary:hover .btn-glyph,
.card-cta:hover .btn-arrow {
  transform: translateX(4px);
}

/* Text link with a rule that draws in from the left. */
.link-underline {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}
.link-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out);
}
.link-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Danger / sign-out — an outline, never a red slab. */
.logout-btn,
.btn-logout,
.delete-pin-btn {
  padding: 0.85rem 1.3rem;
  background: transparent;
  border: 1px solid rgba(226, 112, 95, 0.4);
  border-radius: var(--r-pill);
  color: var(--signal-bad);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s var(--ease-out), background 0.3s var(--ease-out),
    border-color 0.3s var(--ease-out);
}

.logout-btn:hover,
.btn-logout:hover,
.delete-pin-btn:hover {
  background: var(--signal-bad);
  border-color: var(--signal-bad);
  color: var(--ink-900);
}

/* Text button */
.auth-text-btn,
.modal-text-btn {
  display: inline-block;
  background: transparent;
  border: none;
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 2px;
  text-decoration: none;
  transition: color 0.3s var(--ease-out);
}

.auth-text-btn:hover,
.modal-text-btn:hover {
  color: var(--ember);
}

/* --------------------------------------------------------------------------
   Segmented control (Explore / Creator switcher)
   -------------------------------------------------------------------------- */

.mode-toggle-container {
  display: inline-flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1rem;
  border: none;
  background: transparent;
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}

.mode-btn + .mode-btn {
  border-left: 1px solid var(--hairline);
}

.mode-btn:hover {
  color: var(--paper);
}

.mode-btn.active {
  background: var(--ember);
  color: var(--ink-900);
}

/* Creator Mode is account-only. auth-state.js stamps data-authed on <body>;
   guests get a lock hint instead of a silently-failing button. */
body[data-authed="false"] #mode-creator-btn {
  opacity: 0.6;
}

body[data-authed="false"] #mode-creator-btn::after {
  content: "🔒";
  margin-left: 3px;
  font-size: 0.85em;
}

/* --------------------------------------------------------------------------
   Badges & tags — all mono, all uppercase, all hairline.
   -------------------------------------------------------------------------- */

.badge-guest,
.status-badge,
.badge-creator,
.map-badge-offline,
.brand-badge,
.city-tag,
.card-tag,
.hero-badge,
.popup-category,
.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0.35rem 0.75rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.6;
}

.status-badge.online,
.badge-creator,
.map-badge-offline {
  border-color: rgba(127, 160, 95, 0.45);
  color: var(--moss);
}

.status-badge.offline {
  border-color: rgba(226, 112, 95, 0.45);
  color: var(--signal-bad);
}

.status-badge.online::before,
.map-badge-offline::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--moss);
  animation: pulse-dot 2.4s var(--ease-out) infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.brand-badge,
.hero-badge,
.city-tag,
.popup-category {
  border-color: rgba(232, 98, 44, 0.42);
  color: var(--ember);
}

.rating-badge {
  border-color: rgba(216, 195, 154, 0.4);
  color: var(--sand);
}

/* --------------------------------------------------------------------------
   Cards — shared map card used by dashboard + creator studio
   -------------------------------------------------------------------------- */

/* auto-fit rather than auto-fill: the 1px gaps are drawn by the container's
   background, so an empty auto-fill track would render as a phantom card. */
.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 1px;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline-soft);
}

.map-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(1.4rem, 2.6vw, 2rem);
  background: var(--ink-800);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.5s var(--ease-out);
}

/* An ember rule draws across the top edge on hover — the same gesture the
   itinerary rows and the "how it works" cells use. */
.map-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: var(--ember);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease-out);
  pointer-events: none;
}

.map-card:hover {
  background: var(--ink-700);
}

.map-card:hover::before {
  transform: scaleX(1);
}

.map-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0.4rem;
}

.map-card-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--hairline);
  font-size: 1.1rem;
}

.map-card-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--paper);
}

.map-card-desc {
  font-size: 0.92rem;
  color: var(--paper-dim);
  line-height: 1.55;
}

.map-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--hairline-soft);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.map-card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.btn-edit-map {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */

.empty-state-card,
.creator-empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: clamp(3rem, 7vw, 5.5rem) 1.75rem;
  background:
    repeating-linear-gradient(-45deg, rgba(242, 239, 232, 0.018) 0 12px, transparent 12px 24px),
    var(--ink-800);
  border: 1px solid var(--hairline-soft);
  border-radius: 0;
}

.empty-icon {
  font-size: 2.4rem;
  opacity: 0.75;
  animation: float-soft 5s ease-in-out infinite;
}

@keyframes float-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.empty-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--paper);
}

.empty-desc,
.empty-subtitle {
  font-size: 0.95rem;
  color: var(--paper-dim);
  max-width: 46ch;
  line-height: 1.6;
}

.empty-state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

/* --------------------------------------------------------------------------
   Forms — underlit fields on ink, no rounded chrome.
   -------------------------------------------------------------------------- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label,
.settings-group label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea,
.form-input,
.form-textarea,
.settings-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--ink-900);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}

input::placeholder,
textarea::placeholder {
  color: var(--paper-faint);
}

input:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-textarea:focus {
  border-color: var(--ember);
  background: var(--ink-800);
}

textarea,
.form-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}

select,
.form-input[type="select"] {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23b9b4a8' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

select option {
  background: var(--ink-700);
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  background: rgba(6, 8, 11, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.25s var(--ease-out);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card,
.auth-modal-card {
  position: relative;
  text-align: center;
  width: 100%;
  max-width: 460px;
  padding: clamp(1.8rem, 4vw, 2.75rem);
  background: var(--ink-800);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  animation: modal-pop 0.4s var(--ease-out);
}

/* Ember rule across the top edge of the panel. */
.modal-card::before,
.auth-modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ember);
}

@keyframes modal-pop {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.close-modal-btn,
.close-sheet-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
    transform 0.4s var(--ease-out);
  flex-shrink: 0;
}

.close-modal-btn {
  position: absolute;
  top: 16px;
  right: 16px;
}

.close-modal-btn:hover,
.close-sheet-btn:hover {
  color: var(--paper);
  border-color: var(--paper);
  transform: rotate(90deg);
}

.modal-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.modal-title,
.modal-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.025em;
  margin-bottom: 0.7rem;
  color: var(--paper);
  -webkit-text-fill-color: currentColor;
}

.modal-subtitle,
.modal-card > p {
  font-size: 0.94rem;
  color: var(--paper-dim);
  line-height: 1.6;
  max-width: 40ch;
  margin-inline: auto;
}

.modal-card > p {
  margin-bottom: 1.5rem;
}

.modal-icon {
  font-size: 2rem;
  margin-bottom: 0.9rem;
  opacity: 0.85;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form button[type="submit"] {
  width: 100%;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

#toast-container {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 0.85rem 1.25rem;
  background: var(--ink-700);
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--ember);
  border-radius: var(--r-sm);
  color: var(--paper);
  font-size: 0.88rem;
  box-shadow: var(--sh-lg);
  animation: toast-in 0.45s var(--ease-out);
  pointer-events: auto;
}

.toast a {
  color: var(--ember);
  text-decoration: underline;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */

/* Scoped to `.js`, which the page stamps on <html> before anything renders.
   Without that guard a script failure would leave every revealable element
   at opacity 0 — that is, a blank page. */
.js [data-reveal],
.js .reveal-item {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-in,
.js .reveal-item.in-view {
  opacity: 1;
  transform: none;
}

.reveal {
  animation: reveal-up 0.7s var(--ease-out) backwards;
}

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain { animation: none; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js [data-reveal],
  .js .reveal-item {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   MapLibre skinning (shared by map + explore)
   -------------------------------------------------------------------------- */

/* Backdrop under the canvas while the first tiles are still in flight — it
   matches the basemap in play so a light map doesn't flash black. */
#map,
#explore-map {
  background: var(--ink-900);
}

:root[data-map-theme="light"] #map,
:root[data-map-theme="light"] #explore-map {
  background: #e9ecef;
}

.maplibregl-ctrl-group {
  background: rgba(6, 8, 11, 0.82) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--r-sm) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: none !important;
  overflow: hidden;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--hairline-soft) !important;
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(1) brightness(1.5);
}

.maplibregl-ctrl-group button:hover {
  background: rgba(232, 98, 44, 0.28) !important;
}

/* Light/dark basemap switch — same glass slab as the zoom controls it sits
   under, but drawn with an inline SVG instead of a MapLibre sprite icon. */
.map-theme-ctrl button {
  display: grid !important;
  place-items: center;
  width: 29px;
  height: 29px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--paper-dim);
  cursor: pointer;
  transition: color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}

.map-theme-ctrl button:hover {
  color: var(--paper);
}

.map-theme-ctrl svg {
  width: 16px;
  height: 16px;
}

.maplibregl-ctrl-attrib {
  background: rgba(6, 8, 11, 0.72) !important;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.maplibregl-ctrl-attrib a {
  color: var(--paper-faint) !important;
}

/* City markers — a numbered ember disc. Shared by the world map and the
   route preview on the landing page. */
.city-marker-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ember);
  color: var(--ink-900);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(255, 217, 196, 0.7);
  box-shadow: 0 0 0 6px rgba(232, 98, 44, 0.16);
  transition: box-shadow 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.city-marker-badge:hover,
.city-marker-badge.is-selected {
  transform: scale(1.12);
  box-shadow: 0 0 0 10px rgba(232, 98, 44, 0.22);
}

/* Popups on the map read as small hairline cards, not balloons. */
.maplibregl-popup-content {
  background: var(--ink-800) !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--r-sm) !important;
  color: var(--paper) !important;
  font-family: var(--font-body);
  box-shadow: var(--sh-md) !important;
}

.maplibregl-popup-tip {
  border-top-color: var(--ink-800) !important;
  border-bottom-color: var(--ink-800) !important;
}

.maplibregl-popup-close-button {
  color: var(--paper-dim) !important;
  font-size: 1.1rem;
}
