/* ------------------------------------------------------------------
   99makers — a cartographer's night.
   Layout: the globe owns the first screen; everything else is a quiet
   list underneath. Sand and mist on deep ocean teal, blue for markers.
------------------------------------------------------------------- */
:root {
  --ink: #06141a;        /* page ground */
  --ink-2: #0b2028;      /* panel surface */
  --sand: #e6d5ad;       /* land dots, headings */
  --ivory: #f3ede0;      /* body text */
  --mist: #8fa7ac;       /* secondary text */
  --accent: #5aa9ff;     /* markers, the one accent */
  --aqua: #5ad4c8;       /* atmosphere glow, live signal */
  --line: rgba(230, 213, 173, 0.16);

  --display: "Gloock", "Iowan Old Style", Georgia, serif;
  --body: "Albert Sans", "Segoe UI", system-ui, sans-serif;

  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--sand);
  text-wrap: balance;
  margin: 0;
}

a { color: var(--sand); text-underline-offset: 0.18em; }
a:hover { color: var(--ivory); }
:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; border-radius: 2px; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: var(--sand);
}

/* ---------- The stage: one full screen of globe ---------- */
.stage {
  position: relative;
  height: 100svh;
  min-height: 420px;
  isolation: isolate;
  overflow: hidden;
}
#globe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; z-index: 0;
  touch-action: none;
  cursor: grab;
}
#globe.is-dragging { cursor: grabbing; }
#globe.is-hovering { cursor: pointer; }

/* Lens: a soft vignette and a whisper of film grain over the whole stage */
.vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(3, 10, 14, 0) 52%, rgba(3, 10, 14, 0.6) 100%);
}
.grain {
  position: absolute; inset: -40%; z-index: 1; pointer-events: none;
  opacity: 0.05; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 260px 260px;
  animation: grain 0.8s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Corner furniture: all small, all out of the globe's way */
.top {
  position: absolute; z-index: 2;
  left: var(--gutter-l);
  top: calc(1.1rem + env(safe-area-inset-top, 0px));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { font-size: 1.6rem; line-height: 1; letter-spacing: 0.01em; }
.tagline { margin: 0.45rem 0 0; font-size: 0.9rem; color: var(--mist); max-width: 26rem; }

.corner-nav {
  position: absolute; z-index: 2;
  right: var(--gutter-r);
  top: calc(1.35rem + env(safe-area-inset-top, 0px));
  display: flex; gap: 1.3rem; font-size: 0.9rem;
}
.corner-nav a { text-decoration: none; color: var(--mist); }
.corner-nav a:hover { color: var(--ivory); }

/* The showcase card: the business currently on the globe */
.showcase {
  position: absolute; z-index: 2;
  left: var(--gutter-l);
  top: 50%; transform: translateY(-50%);
  width: min(21rem, 42vw);
  padding: 1.1rem 1.2rem 1rem;
  background: rgba(6, 20, 26, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}
/* Handover: the lines leave upward together, then rise back in one after another */
.showcase .swap { transition: opacity 0.26s ease, transform 0.26s ease; }
.showcase.is-swapping .swap { opacity: 0; transform: translateY(-7px); transition-delay: calc(var(--i) * 25ms); }
.showcase.is-entering .swap { animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; animation-delay: calc(var(--i) * 80ms); }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.showcase.is-entering .showcase-label::after { animation: sweep 0.9s ease-out both; }
.showcase-label { position: relative; }
.showcase-label::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 1px; width: 100%;
  background: linear-gradient(90deg, var(--accent), transparent); opacity: 0;
}
@keyframes sweep {
  0% { opacity: 0; transform: scaleX(0); transform-origin: left; }
  40% { opacity: 0.9; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1); }
}
.showcase-label { margin: 0 0 0.5rem; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.showcase-name { font-size: 1.7rem; line-height: 1.1; }
.showcase-place { margin: 0.3rem 0 0; color: var(--mist); font-size: 0.9rem; }
.showcase-tagline { margin: 0.8rem 0 0; color: var(--ivory); font-size: 0.98rem; }
.showcase-links { margin: 0.9rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; font-size: 0.9rem; }
.showcase-progress { margin: 1rem 0 0; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.showcase-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.showcase-next {
  margin: 0.8rem 0 0; padding: 0;
  background: none; border: 0; font: inherit; font-size: 0.85rem; color: var(--mist); cursor: pointer;
}
.showcase-next:hover { color: var(--ivory); }

.hint {
  position: absolute; z-index: 2;
  right: var(--gutter-r);
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  margin: 0; font-size: 0.85rem; color: var(--mist);
}

.noscript {
  position: relative; z-index: 3;
  margin: 0; padding: 5rem var(--gutter-r) 1rem var(--gutter-l);
  color: var(--mist);
}

/* ---------- The list below the globe ---------- */
.directory {
  max-width: 72rem; margin: 0 auto;
  padding: 3.5rem var(--gutter-r) 4rem var(--gutter-l);
}
.directory-head { max-width: 44rem; margin-bottom: 2rem; }
.directory-head h2 { font-size: 2rem; line-height: 1.1; }
.directory-head p { margin: 0.8rem 0 0; color: var(--mist); }
.directory-list {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}
.biz {
  padding: 1.2rem 1.3rem 1.1rem;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(230, 213, 173, 0.03);
  display: flex; flex-direction: column;
}
.biz-name { font-size: 1.35rem; line-height: 1.15; }
.biz-place { margin: 0.25rem 0 0; font-size: 0.88rem; color: var(--mist); }
.biz-tagline { margin: 0.75rem 0 0; color: var(--ivory); }
.biz-links { margin: 0.9rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.9rem; }
.biz-more { margin: 0.9rem 0 0; font-size: 0.92rem; }
.biz-more summary { cursor: pointer; color: var(--mist); list-style: none; }
.biz-more summary::-webkit-details-marker { display: none; }
.biz-more summary::before { content: "+ "; color: var(--accent); }
.biz-more[open] summary::before { content: "\2013\00a0"; }
.biz-more summary:hover { color: var(--ivory); }
.biz-body p { margin: 0.7rem 0 0; color: var(--ivory); }
.biz-facts { margin: 0.9rem 0 0; padding-top: 0.8rem; border-top: 1px solid var(--line); display: grid; gap: 0.35rem; }
.biz-facts div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.5rem; }
.biz-facts dt { color: var(--mist); }
.biz-facts dd { margin: 0; min-width: 0; }
.biz-facts address { font-style: normal; }

/* ---------- Listing form (inside the add panel) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1.1rem; border-radius: 999px;
  font: inherit; font-size: 0.95rem; font-weight: 500;
  text-decoration: none; cursor: pointer;
  background: var(--accent); color: var(--ink); border: 0;
  transition: background-color 0.18s;
}
.btn:hover { background: #7fbaff; color: var(--ink); }
.link-btn {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-size: inherit; color: var(--sand);
  text-decoration: underline; text-underline-offset: 0.18em; cursor: pointer;
}
.link-btn:hover { color: var(--ivory); }
.listing-form { margin: 1.4rem 0 0; display: grid; gap: 0.9rem; }
.field { display: grid; gap: 0.3rem; }
.field label { font-size: 0.85rem; color: var(--mist); }
.field input, .field textarea {
  font: inherit; color: var(--ivory);
  background: rgba(230, 213, 173, 0.05);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.6rem 0.75rem; width: 100%;
}
.field input:focus, .field textarea:focus { border-color: var(--sand); outline: none; }
.form-actions { margin: 0.2rem 0 0; }

/* ---------- Business panel ---------- */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(30rem, 100%);
  background: var(--ink-2);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 60px rgba(0, 0, 0, 0.45);
  transform: translateX(104%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.panel.is-open { transform: none; }
.panel-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem 0.6rem 1.6rem;
}
.panel-coords {
  margin: 0; font-size: 0.82rem; color: var(--mist);
  font-variant-numeric: tabular-nums; letter-spacing: 0.04em;
}
.panel-close {
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 1px solid var(--line); background: transparent; color: var(--sand);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.panel-close:hover { border-color: var(--sand); }
.panel-scroll {
  overflow-y: auto; min-height: 0; flex: 1;
  padding: 0.4rem 1.6rem calc(2rem + env(safe-area-inset-bottom, 0px));
}
.panel-name { font-size: 2.2rem; line-height: 1.05; }
.panel-place { margin: 0.4rem 0 0; color: var(--mist); }
.panel-tagline { margin: 1.3rem 0 0; font-size: 1.15rem; color: var(--ivory); }
.panel-body p { margin: 0.9rem 0 0; color: var(--ivory); }
.panel-facts {
  margin: 1.5rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--line);
  display: grid; gap: 0.6rem; font-size: 0.95rem;
}
.panel-facts div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 0.5rem; }
.panel-facts dt { color: var(--mist); }
.panel-facts dd { margin: 0; min-width: 0; }
.panel-facts address { font-style: normal; }
.panel-actions { margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; }
.panel-listed { margin: 1.2rem 0 0; font-size: 0.85rem; color: var(--mist); }

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .tagline { max-width: 60vw; font-size: 0.85rem; }
  .corner-nav { top: calc(1.2rem + env(safe-area-inset-top, 0px)); flex-direction: column; gap: 0.3rem; align-items: flex-end; }
  .hint { display: none; }
  .showcase {
    top: auto; transform: none;
    left: var(--gutter-l); right: var(--gutter-r);
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    width: auto; padding: 0.9rem 1rem 0.8rem;
  }
  .showcase-name { font-size: 1.35rem; }
  .showcase-tagline { display: none; }

  .panel {
    top: auto; left: 0; width: auto; height: 80svh;
    border-left: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    transform: translateY(104%);
    padding-left: env(safe-area-inset-left, 0px);
  }
  .panel.is-open { transform: none; }
  .panel-facts div { grid-template-columns: 1fr; gap: 0.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .btn, .showcase, .showcase .swap { transition: none; animation: none; }
  .grain { animation: none; }
}
