/* assets/css/style.css */

:root {
  --parci-yellow: #FFDE59;
  --parci-yellow-deep: #E8C73D;
  --ink: #111;
  --paper: #fff;
  --shadow-color: rgba(17, 17, 17, 0.18);
  --sticker-pill: 999px;
  --sticker-card: 12px;
  --sticker-border: 2.5px;

  /* Story types (Maelys' palette from docs/parci-tags.pdf) */
  /* Story types (6 after the 2026-10 remix: vecu/fiction/histoire/
     observation/poeme/message). Kept 4 of Maelys' originals; added
     observation (sky blue, previously astuce) and poeme (deep teal, new). */
  --type-vecu: #FF4FBD;
  --type-fiction: #4A2BC1;
  --type-histoire: #C2652A;
  --type-observation: #3BB8EC;
  --type-poeme: #2A8E8E;
  --type-message: #4DD898;
}

html, body {
  margin: 0;
  position: relative;
  height: 100%;
  width: 100%;
  font-family: "Alegreya", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
}

h1, h2, h3,
#navbar,
button,
.form-group label,
#user-menu-list a {
  font-family: "Capriola", system-ui, sans-serif;
}

/* ============ Center-me button (floating, bottom-right) ============ */
#center-me {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  outline: 1px solid var(--parci-yellow);
  outline-offset: -5px;
  border-radius: 50%;
  box-shadow: 0 4px 10px var(--shadow-color);
  cursor: pointer;
  z-index: 999;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#center-me:hover {
  background: var(--parci-yellow);
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 7px 14px var(--shadow-color);
}

#center-me:active {
  transform: translateY(1px) scale(0.97);
}

#center-me svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* ============ Welcome sequence (tagline + expanding ring) ============ */

#tagline {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translateX(-50%) rotate(-1deg);
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 7px 16px;
  background: var(--parci-yellow);
  border: 2.5px solid var(--paper);
  outline: 1px solid var(--ink);
  outline-offset: -5px;
  border-radius: var(--sticker-pill);
  box-shadow: 0 3px 7px var(--shadow-color);
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.88rem;
  color: var(--ink);
  z-index: 1000;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

#tagline.hidden {
  opacity: 0;
  transform: translateX(-50%) rotate(-1deg) translateY(-10px);
  pointer-events: none;
}

.tagline-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--ink);
  border-top-color: transparent;
  border-radius: 50%;
  animation: parci-spin 0.9s linear infinite;
}

@keyframes parci-spin {
  to { transform: rotate(360deg); }
}

/* Radar ring: viewport-center (map auto-centers on the user when this fires).
   Starts larger than the avatar so it's immediately visible outside the
   sticker, expands past viewport max, fades out as it grows. */
#welcome-ring {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 90px;
  margin-left: -45px;
  margin-top: -45px;
  border: 4px dashed var(--parci-yellow);
  border-radius: 50%;
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  box-sizing: border-box;
}

#welcome-ring.animating {
  animation: parci-welcome-ring 3s cubic-bezier(.15, .7, .25, 1) forwards;
}

@keyframes parci-welcome-ring {
  0% {
    width: 90px; height: 90px;
    margin-left: -45px; margin-top: -45px;
    opacity: 0;
    border-width: 4px;
  }
  10% {
    opacity: 0.95;
    border-width: 5px;
  }
  60% {
    opacity: 0.4;
    border-width: 3px;
  }
  100% {
    width: 220vmax;
    height: 220vmax;
    margin-left: -110vmax;
    margin-top: -110vmax;
    opacity: 0;
    border-width: 2px;
  }
}

/* ============ Floating logo (no top bar) ============ */
#brand-logo-btn {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: none;
  border-radius: 999px;
  transition: transform 0.2s cubic-bezier(.5,1.5,.5,1);
}

#brand-logo {
  display: block;
  height: 64px;
  width: auto;
  transform: rotate(-2deg);
  filter: drop-shadow(0 6px 14px rgba(17, 17, 17, 0.28))
          drop-shadow(0 2px 4px rgba(17, 17, 17, 0.18));
  user-select: none;
  pointer-events: none; /* clicks go to the parent button */
  transition: transform 0.2s cubic-bezier(.5,1.5,.5,1);
}

@media (hover: hover) {
  #brand-logo-btn:hover #brand-logo {
    transform: rotate(-2deg) translateY(-2px) scale(1.04);
  }
}

#brand-logo-btn:active #brand-logo {
  transform: rotate(-2deg) translateY(1px) scale(0.98);
}

#brand-logo-btn[aria-expanded="true"] #brand-logo {
  transform: rotate(0deg) translateY(-2px) scale(1.02);
}

/* ============ Brand menu (toggle under the logo) ============ */
.brand-menu {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%) scale(0.9) translateY(-6px);
  min-width: 180px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  outline: 1px solid var(--parci-yellow);
  outline-offset: -5px;
  border-radius: 16px;
  box-shadow: 0 10px 24px var(--shadow-color);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transform-origin: top center;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(.5,1.5,.5,1);
}

.brand-menu[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1) translateY(0);
}

.brand-menu ul {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.brand-menu li {
  margin: 0;
}

.brand-menu-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 24px;
  background: none;
  border: none;
  outline: none;
  box-shadow: none;
  text-align: left;
  text-decoration: none;
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.12s ease;
  transform: none !important;
}

.brand-menu-item:hover,
.brand-menu-item:focus-visible {
  background: var(--parci-yellow);
}

/* Locale flag row at the bottom of the brand menu */
.brand-locale {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 24px 14px;
  border-top: 1px dashed rgba(17, 17, 17, 0.2);
  margin-top: 4px;
}

.locale-flag {
  width: 44px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.locale-flag:hover {
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 3px 7px var(--shadow-color);
  background: #faf7ea;
}

/* "Active" flag: ambient yellow + ink die-cut outline mirroring the
   checked radius chip. Set via a data-active-locale attribute written on
   the menu by main.js after i18n.apply(). */
.brand-menu[data-active-locale="en"] .locale-flag[data-locale="en"],
.brand-menu[data-active-locale="fr"] .locale-flag[data-locale="fr"] {
  background: var(--parci-yellow);
  box-shadow: 0 3px 7px var(--shadow-color);
}

/* ============ Buttons as pill stickers (modals, forms) ============ */
button {
  padding: 8px 18px;
  color: var(--ink);
  background-color: var(--parci-yellow);
  border: var(--sticker-border) solid var(--paper);
  border-radius: var(--sticker-pill);
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: 0 3px 7px var(--shadow-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

button:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 6px 14px var(--shadow-color);
}

button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 4px var(--shadow-color);
  background-color: var(--parci-yellow-deep);
}

button:focus-visible {
  outline: 3px solid var(--parci-yellow);
  outline-offset: 3px;
}

/* ============ Modal: paper card with yellow sticker tab ============ */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-color: rgba(17, 17, 17, 0.4);
  z-index: 1000;
  overflow-y: auto;
}

.modal[aria-hidden="false"] { display: block; }

.modal-dialog {
  background-color: var(--paper);
  margin: 6% auto 24px;
  padding: 36px 28px 28px;
  border-radius: var(--sticker-card);
  max-width: 600px;
  position: relative;
  box-shadow: 0 14px 36px var(--shadow-color), 0 2px 6px var(--shadow-color);
}

/* Yellow sticker "tab" that carries the title on UI chrome modals. The
   story view opts out of this treatment below so story titles get a clean
   typographic heading. */
.modal-dialog h2 {
  position: absolute;
  top: -16px;
  left: 24px;
  margin: 0;
  padding: 7px 18px;
  background-color: var(--parci-yellow);
  border: var(--sticker-border) solid var(--paper);
  border-radius: var(--sticker-pill);
  font-size: 1rem;
  font-weight: normal;
  color: var(--ink);
  box-shadow: 0 3px 7px var(--shadow-color);
  transform: rotate(-1.5deg);
  outline: 1px solid var(--ink);
  outline-offset: -5px;
}

/* Story view: honor the story. No sticker tab; a clean, well-set heading. */
#story-modal .modal-dialog {
  padding: 24px 28px 28px;
}

#story-modal .modal-dialog h2 {
  position: static;
  margin: 0 0 6px 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  transform: none;
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: normal;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.005em;
}

#story-modal #story-modal-author {
  margin: 0 0 18px 0;
  color: var(--ink);
  opacity: 0.7;
  font-family: "Alegreya", Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
}

#story-modal #story-modal-content {
  font-size: 1.05rem;
  line-height: 1.6;
}
#story-modal #story-modal-content p { margin: 0 0 0.8em; }
#story-modal #story-modal-content p:last-child { margin-bottom: 0; }
#story-modal #story-modal-content h2,
#story-modal #story-modal-content h3,
#story-modal #story-modal-content h4 {
  font-family: "Capriola", system-ui, sans-serif;
  margin: 1em 0 0.3em;
  line-height: 1.25;
}
#story-modal #story-modal-content h2 { font-size: 1.25rem; }
#story-modal #story-modal-content h3 { font-size: 1.1rem; }
#story-modal #story-modal-content h4 { font-size: 1rem; }
#story-modal #story-modal-content ul,
#story-modal #story-modal-content ol { margin: 0 0 0.8em 1.2em; padding: 0; }
#story-modal #story-modal-content li { margin: 0.2em 0; }
#story-modal #story-modal-content blockquote {
  margin: 0.6em 0;
  padding: 0.1em 0.9em;
  border-left: 3px solid var(--parci-yellow-deep);
  color: #444;
  font-style: italic;
}
#story-modal #story-modal-content code {
  background: #faf7ea;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}
#story-modal #story-modal-content a {
  color: var(--ink);
  border-bottom: 1px dashed currentColor;
  text-decoration: none;
}
#story-modal #story-modal-content a:hover { color: var(--parci-yellow-deep); }

/* Add-story modal: language flag button in the top-right, mirrors the
   popup badge style. Opens a small popover with the two language options. */
#add-story-modal .modal-dialog { position: relative; }
.story-lang-btn {
  position: absolute;
  top: 14px;
  right: 48px; /* leave room for the modal-close × */
  width: 40px;
  height: 32px;
  padding: 0;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 2px 5px var(--shadow-color);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.story-lang-btn:hover {
  background: #faf7ea;
  transform: translateY(-1px);
}
.story-lang-flag { display: block; pointer-events: none; }

.story-lang-popover {
  position: absolute;
  top: 54px;
  right: 48px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 8px 20px var(--shadow-color);
  z-index: 10;
  padding: 6px 0;
  min-width: 170px;
}
.story-lang-popover[hidden] { display: none; }
.story-lang-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  outline: none;
  text-align: left;
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: none;
  border-radius: 0;
  transform: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.story-lang-option:hover { background: var(--parci-yellow); }
.story-lang-option span { font-size: 18px; line-height: 1; }

/* No-GPS modal: no close button in the dialog markup because the user
   can't dismiss it without granting location (that's the whole point). */
#no-gps-modal .modal-dialog {
  text-align: center;
}
#no-gps-modal .form-actions {
  justify-content: center;
  margin-top: 20px;
}
#no-gps-modal .btn-primary {
  flex: 0 0 auto;
  padding: 10px 22px;
}

/* ============ Attestation modal (Codeberg #53) ============ */
/* The tag list is a stack of one-per-line labels. Each row is tap-sized
   (44px min-height), with the checkbox clearly visible on the left and
   enough gap to scan quickly. */
#attestation-modal .modal-dialog {
  max-width: 480px;
  padding: 28px 32px 24px;
}
#attestation-modal h2 {
  position: static;
  margin: 0 0 10px 0;
  padding: 0;
  background: none;
  color: var(--ink);
  border: none;
  transform: none;
  text-align: left;
}
#attestation-modal > .modal-dialog > p {
  color: #555;
  margin: 0 0 14px 0;
}
.attestation-tags {
  list-style: none;
  margin: 0 0 18px 0;
  padding: 10px 0;
  border-top: 1px solid #e5e0cf;
  border-bottom: 1px solid #e5e0cf;
}
.attestation-tags li { margin: 0; }
.attestation-tags label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  min-height: 36px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--ink);
}
.attestation-tags label:hover { background: #faf7ea; }
.attestation-tags input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--parci-yellow);
}
.attestation-legal {
  margin: 0 0 16px 0;
  font-size: 0.92rem;
  color: #555;
  line-height: 1.5;
}
.attestation-legal p { margin: 0 0 8px 0; }
.attestation-legal p:last-child { margin-bottom: 0; }
/* The I-understand row sits plain — no sticker border, no shadow — but
   with a prominent checkbox so the gating action is obvious. */
.attestation-accept {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 14px 0;
  cursor: pointer;
  font-size: 1rem;
  color: var(--ink);
}
.attestation-accept input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--parci-yellow);
}

/* ============ Doc modals (Help, About) ============ */
.modal-dialog--doc {
  padding: 28px 32px 32px;
}

.modal-dialog--doc h2 {
  position: static;
  margin: 0 0 14px 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  transform: none;
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 1.65rem;
  font-weight: normal;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.doc-body {
  font-family: "Alegreya", Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
}

.doc-body h3 {
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: normal;
  margin: 20px 0 6px 0;
  color: var(--ink);
}

.doc-body p {
  margin: 0 0 10px 0;
}

.doc-body ul {
  margin: 6px 0 12px 0;
  padding-left: 22px;
}

.doc-body li {
  margin-bottom: 6px;
}

.doc-body a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--parci-yellow);
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}

.doc-ellipsis {
  display: inline-block;
  padding: 0 10px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  font-family: "Capriola", system-ui, sans-serif;
  letter-spacing: 2px;
  line-height: 1.3;
}

/* Help "item": sample image on the left, text to its right, vertically
   centered. The .doc-sample is kept as a standalone block so the same
   markup renders cleanly if used without the row wrapper. */
.doc-item {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0 14px;
}
.doc-item .doc-sample {
  margin: 0;
  flex: 0 0 auto;
  justify-content: flex-start;
}
.doc-item p {
  margin: 0;
  flex: 1;
}

.doc-sample {
  display: flex;
  justify-content: flex-start;
  margin: 14px 0 10px;
}

/* Mini speech bubble sample (reuses the shape vocabulary from parci-bubble) */
.doc-sample-bubble {
  position: relative;
  min-width: 54px;
  height: 34px;
  padding: 0 14px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 4px 10px var(--shadow-color);
  color: var(--ink);
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-5deg);
}
.doc-sample-bubble span {
  display: block;
  transform: translateY(-4px);
  letter-spacing: 2px;
}
.doc-sample-bubble::before,
.doc-sample-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-style: solid;
}
.doc-sample-bubble::before {
  top: calc(100% - 1px);
  margin-left: -9px;
  border-width: 11px 9px 0 9px;
  border-color: var(--ink) transparent transparent transparent;
}
.doc-sample-bubble::after {
  top: calc(100% - 3px);
  margin-left: -6px;
  border-width: 9px 6px 0 6px;
  border-color: var(--paper) transparent transparent transparent;
}

/* Popup sample: mirrors the live leaflet-popup card styling */
.doc-sample-popup {
  display: inline-block;
  background: var(--paper);
  border-radius: var(--sticker-card);
  box-shadow: 0 10px 24px var(--shadow-color);
  padding: 14px 18px;
  font-family: "Alegreya", Georgia, serif;
  max-width: 280px;
  text-align: left;
}
.doc-sample-popup b {
  display: block;
  margin: 0 0 4px 0;
  font-family: "Capriola", system-ui, sans-serif;
  font-weight: normal;
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--ink);
}
.doc-sample-popup .parci-author {
  display: block;
  font-family: "Alegreya", Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink);
  opacity: 0.7;
  margin-bottom: 4px;
}
.doc-sample-popup .parci-distance {
  display: inline-block;
  padding: 1px 8px;
  background: var(--parci-yellow);
  border: 1.5px solid var(--paper);
  border-radius: var(--sticker-pill);
  outline: 1px solid var(--ink);
  outline-offset: -3px;
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.75rem;
  color: var(--ink);
}

.doc-markers {
  list-style: none !important;
  padding: 0 !important;
}

.doc-markers li {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.doc-markers img,
.doc-markers .doc-cluster-sample {
  flex: 0 0 28px;
}

.doc-links {
  list-style: none !important;
  padding: 0 !important;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  padding: 2px 8px;
  box-shadow: none;
  border-radius: 50%;
}

.modal-close:hover {
  transform: none;
  box-shadow: none;
  background: var(--parci-yellow);
}

/* ============ Mini-map inside add-story modal ============ */
.form-location {
  position: relative;
}

/* The "Exact spot" sticker overlaps the top edge of the mini-map by about
   half its height. Set via margin on the sibling + z-index on the label. */
.form-mini-label--map {
  position: relative;
  z-index: 2;
  margin-left: 14px;
  margin-bottom: -14px;
  display: inline-block;
}

#story-location-map {
  height: 220px;
  width: 100%;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: #f1efe9;
}

/* Mini-map tiles inherit the global desaturation filter (set on
   .leaflet-tile-pane) so they match the main map. */

.form-hint {
  margin: 6px 2px 0;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.7;
  font-family: "Alegreya", Georgia, serif;
  line-height: 1.35;
}

/* ============ Forms: label-as-sticker above plain input ============ */
.form-error {
  display: none;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--parci-yellow);
  border: 2px solid var(--ink);
  border-radius: 10px;
  color: var(--ink);
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.35;
  box-shadow: 0 3px 8px var(--shadow-color);
}

.form-error.visible {
  display: block;
}

.form-group {
  margin-bottom: 18px;
}

/* Small inline label used by compact rows (tags, signature, radius group) */
.form-mini-label {
  display: inline-block;
  padding: 3px 10px;
  background-color: var(--parci-yellow);
  border: 2px solid var(--paper);
  border-radius: var(--sticker-pill);
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--ink);
  box-shadow: 0 2px 4px var(--shadow-color);
  transform: rotate(-1deg);
  white-space: nowrap;
  line-height: 1.2;
  margin-bottom: 0;
}

/* Label + input on the same row (Tags, Signature) */
.form-group--inline-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-group--inline-row input {
  flex: 1;
  margin: 0;
}

/* Reading radius chips. One pill per option. The <label> wrapper has to
   kill the ambient .form-group label sticker styling, otherwise we get a
   yellow outer pill around each chip (the "double cartouche" bug). */
.form-radius {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.form-plain-label {
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--ink);
  opacity: 0.7;
  white-space: nowrap;
}
.radius-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* Specificity bump: `.form-group label` (defined later in this file)
   wraps the chip in a yellow sticker. We need a selector with higher
   specificity than that one to override. `.form-radius .radius-tags label`
   is 0,0,3,1 vs the ambient 0,0,1,1. */
.form-radius .radius-tags label {
  position: relative;
  cursor: pointer;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  transform: none;
  display: inline-block;
}
.radius-tags input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.radius-tags span {
  display: inline-block;
  padding: 5px 14px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--sticker-pill);
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--ink);
  transition: background 0.12s ease, transform 0.12s ease;
}
.radius-tags label:hover span {
  background: #faf7ea;
  transform: translateY(-1px);
}
.radius-tags input:checked + span {
  background: var(--parci-yellow);
}
.radius-tags input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--parci-yellow);
}

/* Story type chips: a single pill per option. The <label> is INVISIBLE
   (killed via higher specificity than .form-group label, which was adding
   a yellow outer sticker — the triple-cartouche bug). Only the inner
   <span> paints. The colored dot comes from ::before so the markup stays
   label > input + span. */
.form-type .type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.form-type .type-tags label { /* specificity 0,2,1 beats .form-group label (0,1,1) */
  position: relative;
  cursor: pointer;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  outline: none;
  transform: none;
  display: inline-block;
}
.form-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.form-type .type-tags span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--sticker-pill);
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--ink);
  transition: background 0.12s ease, transform 0.12s ease;
}
.form-type .type-tags span::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip-dot, #ccc);
  flex: 0 0 auto;
}
.form-type label[data-type="vecu"]        { --chip-dot: var(--type-vecu); }
.form-type label[data-type="fiction"]     { --chip-dot: var(--type-fiction); }
.form-type label[data-type="histoire"]    { --chip-dot: var(--type-histoire); }
.form-type label[data-type="observation"] { --chip-dot: var(--type-observation); }
.form-type label[data-type="poeme"]       { --chip-dot: var(--type-poeme); }
.form-type label[data-type="message"]     { --chip-dot: var(--type-message); }
.form-type .type-tags label:hover span {
  background: #faf7ea;
  transform: translateY(-1px);
}
.form-type input:checked + span {
  background: var(--parci-yellow);
}
.form-type input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--parci-yellow);
}

.parci-author-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}
.parci-author-link:hover { color: var(--parci-yellow-deep); }

/* Story-modal action buttons row: sticker-style pills, right-aligned */
#story-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.story-sticker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--paper);
  color: var(--ink);
  border: var(--sticker-border) solid var(--ink);
  border-radius: var(--sticker-pill);
  box-shadow: 2px 2px 0 var(--shadow-color);
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.12s ease;
}
.story-sticker-btn:hover { background: #faf7ea; transform: translateY(-1px); }
.story-sticker-btn:disabled { opacity: 0.6; cursor: wait; }
.story-sticker-icon { font-size: 1.1rem; line-height: 1; }

/* Icon-only bookmark toggle in the story-modal top-right (Codeberg #68
   follow-up). Sits to the LEFT of .modal-close and tracks the same
   top offset. Tapping flips the SVG path's fill between none (outline)
   and the Parci yellow (bookmarked); JS updates the aria-pressed +
   aria-label. */
.story-bookmark-toggle {
  position: absolute;
  top: 12px;
  right: 46px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}
.story-bookmark-toggle:hover { transform: scale(1.08); }
.story-bookmark-toggle:active { transform: scale(0.96); }
.story-bookmark-toggle .story-bookmark-icon {
  display: block;
  pointer-events: none;
}

/* Type color halo on map markers: colored disc under the star */
.parci-marker-wrap {
  position: relative;
  width: 36px;
  height: 36px;
}
.parci-marker--typed .parci-marker-wrap::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--type-color, transparent);
  opacity: 0.55;
  z-index: 0;
}
.parci-marker-wrap img {
  position: relative;
  z-index: 1;
}

/* Codeberg #68: author action buttons in the story view (Edit, Publish/Unpublish,
   Remove). Low-contrast neutral buttons until the author hovers; the Remove
   button goes muted-red because it's destructive. */
.story-action-btn {
  background: #f5f3ec;
  border: 1px solid #ddd7c3;
  color: #333;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  margin-right: 6px;
}
.story-action-btn:hover { background: #ebe6d4; }
.story-action-btn.is-danger { color: #8a2222; border-color: #e3b8b8; }
.story-action-btn.is-danger:hover { background: #f1dede; }

/* Codeberg #53: pending-review marker — the author's own quarantined
   story. Solid star (reusing the normal sticker asset) with a dashed
   outer ring so the author at a glance knows "this is yours and it's
   waiting on review". The ring sits above the type-color halo but
   below the star image. */
.parci-marker--pending .parci-marker-wrap::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px dashed #111;
  z-index: 2;
  pointer-events: none;
}

/* Title and content inputs: match the fonts and sizes used when reading. */
.story-title-input {
  font-family: "Capriola", system-ui, sans-serif !important;
  font-size: 1.5rem !important;
  padding: 10px 12px !important;
  line-height: 1.2 !important;
  letter-spacing: -0.005em;
}

.story-content-input {
  font-family: "Alegreya", Georgia, "Times New Roman", serif !important;
  font-size: 1.05rem !important;
  line-height: 1.6 !important;
  padding: 14px 14px !important;
  min-height: 180px;
}

/* Signature field: smaller, understated. Optional unless publishing. */
.form-signature input {
  font-family: "Alegreya", Georgia, serif !important;
  font-style: italic;
}

/* Save / Publish actions row */
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.form-actions .btn-primary {
  flex: 1;
}
.form-actions .btn-publish {
  background: var(--parci-yellow-deep);
}
.form-actions .btn-info {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  outline: none;
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 1rem;
  box-shadow: 0 2px 5px var(--shadow-color);
}
.form-actions .btn-info:hover {
  background: var(--parci-yellow);
  transform: translateY(-1px) scale(1.03);
}
.form-info {
  margin-top: 10px;
  padding: 10px 14px;
  background: #faf7ea;
  border: 1.5px dashed var(--ink);
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink);
  font-family: "Alegreya", Georgia, serif;
}
.form-info[hidden] {
  display: none;
}

.form-group label {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 12px;
  background-color: var(--parci-yellow);
  border: 2px solid var(--paper);
  border-radius: var(--sticker-pill);
  font-size: 0.85rem;
  color: var(--ink);
  box-shadow: 0 2px 5px var(--shadow-color);
  transform: rotate(-1deg);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  font-family: "Alegreya", Georgia, "Times New Roman", serif;
  font-size: 1rem;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background-color: var(--paper);
  color: var(--ink);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-style: dashed;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--parci-yellow);
}

/* ============ User menu ============ */
#user-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#user-menu-list li {
  margin-bottom: 12px;
}

#user-menu-list a {
  text-decoration: none;
  color: var(--ink);
  font-size: 1.05rem;
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--sticker-pill);
  transition: background-color 0.15s ease;
}

#user-menu-list a:hover {
  background-color: var(--parci-yellow);
}

/* ============ Map ============ */

#map {
  position: fixed;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #f1efe9;
}

/* Desaturate the basemap tiles without touching marker/overlay panes.
   Leaflet keeps tiles in .leaflet-tile-pane, markers in .leaflet-marker-pane,
   overlays in .leaflet-overlay-pane, so a filter on just the tile pane
   mutes the map without dulling our stickers. */
.leaflet-tile-pane {
  filter: saturate(0.55) brightness(1.04) contrast(0.96);
}

/* Our custom DivIcons for markers, clusters, avatar: strip default styling */
.parci-marker,
.parci-cluster,
.parci-avatar-icon {
  background: transparent !important;
  border: none !important;
}

.parci-marker img,
.parci-marker svg,
.parci-cluster svg {
  display: block;
  filter: drop-shadow(0 2px 4px var(--shadow-color));
  overflow: visible;
}

/* Seen (plain black star) is quieter: slightly smaller + faded */
.parci-marker--seen img {
  opacity: 0.55;
  transform: scale(0.85);
  transform-origin: center;
}

/* Placement pin (shown while composing a story): subtle pulse */
.parci-marker--placement img {
  animation: parci-pulse 1.6s ease-in-out infinite;
  transform-origin: center;
  cursor: grab;
}

.parci-marker--placement:active img {
  cursor: grabbing;
}

@keyframes parci-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Round disc cluster. The count is drawn as <text> inside the SVG so no
   extra DOM elements or absolute positioning are needed. */
.parci-cluster {
  display: block;
}

/* ============ User avatar cluster ============ */

.parci-avatar-cluster {
  position: relative;
  width: 96px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.parci-avatar-cluster .parci-avatar,
.parci-avatar-cluster .parci-bubble {
  pointer-events: auto;
}

/* Only the painted parts of the avatar SVG catch clicks, not the invisible
   square around the smiley. That lets any clusters sitting partly under the
   avatar remain clickable where they stick out. */
.parci-avatar svg {
  pointer-events: visiblePainted;
}
.parci-avatar {
  pointer-events: none;
}

.parci-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
  /* Stronger drop shadow so the sticker sits convincingly above the map */
  filter: drop-shadow(0 8px 14px rgba(17, 17, 17, 0.35))
          drop-shadow(0 3px 5px rgba(17, 17, 17, 0.22));
  transition: transform 0.15s ease, filter 0.15s ease;
}

/* Lifted state during a location update: the avatar rises above the page
   while its new coordinates slide in, then settles back when done. */
.parci-avatar-cluster.is-lifting .parci-avatar {
  transform: scale(1.18);
  filter: drop-shadow(0 18px 22px rgba(17, 17, 17, 0.38))
          drop-shadow(0 8px 10px rgba(17, 17, 17, 0.22));
}

.parci-avatar svg {
  width: 52px;
  height: 52px;
  display: block;
}

.parci-avatar:hover {
  transform: scale(1.05);
}

/* Speech bubble above the avatar: proper bubble (rounded rect + tail),
   white background, ink border. Hidden until the avatar is tapped. */
.parci-bubble {
  position: absolute;
  left: 50%;
  padding: 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 0 4px 10px var(--shadow-color);
  color: var(--ink);
  font-family: "Capriola", system-ui, sans-serif;
  cursor: pointer;
  opacity: 0;
  transform: translateX(-50%) scale(0.7) translateY(8px);
  transform-origin: bottom center;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.24s cubic-bezier(.5,1.5,.5,1);
}

.parci-bubble--add {
  top: 0;
  min-width: 54px;
  height: 34px;
  padding: 0 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
}

/* Profile bubble below the avatar (Codeberg #45). Same sticker vocabulary
   as parci-bubble--add but with the tail pointing UP toward the avatar. */
.parci-bubble--profile {
  bottom: 0;
  width: 44px;
  height: 34px;
  padding: 0;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform-origin: top center;
}
.parci-bubble--profile svg { display: block; }

.parci-bubble--profile::before,
.parci-bubble--profile::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-style: solid;
}
.parci-bubble--profile::before {
  bottom: calc(100% - 1px);
  margin-left: -9px;
  border-width: 0 9px 11px 9px;
  border-color: transparent transparent var(--ink) transparent;
}
.parci-bubble--profile::after {
  bottom: calc(100% - 3px);
  margin-left: -6px;
  border-width: 0 6px 9px 6px;
  border-color: transparent transparent var(--paper) transparent;
}

/* The open-state entry transform for the bottom bubble mirrors the add
   bubble but comes IN from above instead of below. */
.parci-avatar-cluster.open .parci-bubble--profile {
  transform: translateX(-50%) scale(1) translateY(0) rotate(4deg);
}
.parci-bubble--profile:hover {
  transform: translateX(-50%) scale(1.06) translateY(1px) rotate(4deg) !important;
}
.parci-bubble--profile {
  transform: translateX(-50%) scale(0.7) translateY(-8px);
}

.parci-bubble-text {
  display: block;
  transform: translateY(-4px);
  letter-spacing: 2px;
}

/* Speech bubble tail: an ink triangle (outer) with a paper triangle (inner),
   pointing down toward the avatar below. */
.parci-bubble--add::before,
.parci-bubble--add::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-style: solid;
}
.parci-bubble--add::before {
  top: calc(100% - 1px);
  margin-left: -9px;
  border-width: 11px 9px 0 9px;
  border-color: var(--ink) transparent transparent transparent;
}
.parci-bubble--add::after {
  top: calc(100% - 3px);
  margin-left: -6px;
  border-width: 9px 6px 0 6px;
  border-color: var(--paper) transparent transparent transparent;
}

.parci-avatar-cluster.open .parci-bubble {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1) translateY(0) rotate(-5deg);
}

.parci-bubble:hover {
  transform: translateX(-50%) scale(1.06) translateY(-1px) rotate(-5deg) !important;
}

/* Leaflet popups styled as paper cards */
.leaflet-popup-content-wrapper {
  background: var(--paper);
  border-radius: var(--sticker-card);
  box-shadow: 0 10px 24px var(--shadow-color);
  padding: 14px 18px;
  font-family: "Alegreya", Georgia, serif;
}

.leaflet-popup-content {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.45;
}

/* Story title in the popup: clean typography, same vocabulary as the story
   modal heading, no sticker chrome. */
.leaflet-popup-content b {
  display: block;
  margin: 0 0 4px 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  outline: none;
  transform: none;
  font-family: "Capriola", system-ui, sans-serif;
  font-weight: normal;
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--ink);
}

.leaflet-popup-content .parci-author {
  display: block;
  font-family: "Alegreya", Georgia, serif;
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink);
  opacity: 0.7;
  margin-bottom: 2px;
}

.leaflet-popup-content .parci-distance {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 8px;
  background: var(--parci-yellow);
  border: 1.5px solid var(--paper);
  border-radius: var(--sticker-pill);
  outline: 1px solid var(--ink);
  outline-offset: -3px;
  font-family: "Capriola", system-ui, sans-serif;
  font-size: 0.75rem;
  color: var(--ink);
}

/* Flag badge straddling the top-right corner of the popup. The center of
   the badge sits exactly on the corner (Codeberg #29). Pseudo-sticker
   treatment: paper fill, ink border, soft shadow, slight tilt. */
.leaflet-popup-content-wrapper {
  position: relative;
  overflow: visible;
}
.leaflet-popup-content .parci-lang-badge {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1;
  padding: 0;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 2px 5px var(--shadow-color);
  transform: rotate(-6deg);
  cursor: help;
  user-select: none;
  z-index: 2;
}

.leaflet-popup-tip {
  background: var(--paper);
  box-shadow: 0 4px 8px var(--shadow-color);
}

.leaflet-popup-close-button {
  /* Hidden: the button sat on top of the title. Click the map to close. */
  display: none !important;
}

/* "Public computer" checkbox under the OTC code input (Codeberg #62). The
   .form-check wrapper is a <label>, so without a specificity bump the
   ambient .form-group label (yellow sticker pill) swallows the whole row.
   Scope-override here keeps it looking like a plain checkbox row. */
#code-form .form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  transform: none;
  font-family: "Alegreya", Georgia, serif;
  font-size: 0.9rem;
  color: #555;
  cursor: pointer;
}
#code-form .form-check input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

/* Honeypot (Codeberg #65). NOT display:none — some bots skip
   display-none inputs. Push off-screen, zero size, no tab, aria-hidden
   on the wrapper. Humans never see it; bots that fill every input trip
   the server-side check. */
.login-honey {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
