/* Kalimera guide kit, v1 (2026-10-20): the shared look of every client guide and map.
   One component set for villa guides and boat maps; each client only sets its own tokens
   (--brand, --brand-ink, --accent, --display) so the guide carries the client's brand, not ours.
   Master copy lives in guide-kit/. Run guide-kit/sync.sh after editing to copy it into each product.

   Principles (taste + Apple): five type sizes, size-specific tracking, surfaces separated by tone
   (no hairlines), shadows only on what floats, a translucent material over maps, press feedback
   on touch-down, springs for anything you can drag, dark mode and reduced motion/transparency. */

:root {
  /* client tokens (overridden per client from the data file) */
  --brand: #3f6f73;
  --brand-ink: #ffffff;          /* text on --brand */
  --accent: #b9824a;
  --display: ui-serif, "New York", Georgia, serif;
  --text: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* neutrals: warm, a step apart */
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #ece9e2;
  --ink: #1f1e1a;
  --ink-soft: #66625a;
  --danger: #c4302b;
  --warn: #e39a1b;
  --ok: #2e7d4f;
  --material: rgba(250, 249, 246, .78);
  --material-solid: #faf9f6;
  --float-shadow: 0 10px 30px rgba(20, 18, 14, .16);

  /* type: five sizes */
  --fs-cap: 13px;
  --fs-sec: 15px;
  --fs-body: 17px;
  --fs-title: 22px;
  --fs-large: 32px;

  --r: 16px;            /* surfaces */
  --r-btn: 14px;        /* buttons */
  --gap: 16px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121210; --surface: #1d1c19; --surface-2: #2a2925; --ink: #f3f1ea; --ink-soft: #aaa59a;
    --material: rgba(29, 28, 25, .74); --material-solid: #1d1c19; --float-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-body)/1.47 var(--text); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 2px; }

.k-large { font: 600 var(--fs-large)/1.08 var(--display); letter-spacing: -.02em; margin: 0; text-wrap: balance; }
.k-title { font: 600 var(--fs-title)/1.2 var(--display); letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.k-head { font: 600 var(--fs-body)/1.3 var(--text); margin: 0; }
.k-sec { font-size: var(--fs-sec); line-height: 1.45; color: var(--ink-soft); }
.k-cap { font-size: var(--fs-cap); line-height: 1.35; color: var(--ink-soft); letter-spacing: .01em; }
.k-section { font: 600 var(--fs-sec)/1.3 var(--text); color: var(--ink-soft); margin: 28px 4px 8px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- material bars ---------- */
.k-material {
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
@media (prefers-reduced-transparency: reduce) { .k-material { background: var(--material-solid); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .k-material { background: var(--material-solid); } }

.k-tabbar {
  position: fixed; z-index: 1100; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.k-tab { border: 0; background: none; text-decoration: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); transition: transform 120ms var(--ease); }
.k-tab svg { width: 25px; height: 25px; }
.k-tab:active { transform: scale(.92); }
.k-tab.active { color: var(--brand); }
.k-tab.sos, .k-tab.sos.active { color: var(--danger); }
.k-tab[hidden] { display: none; }

/* ---------- surfaces & grouped rows ---------- */
.k-card { background: var(--surface); border-radius: var(--r); padding: 16px; }
.k-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; border-radius: var(--r); overflow: hidden; margin: 0; padding: 0; list-style: none; }
.k-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 12px 16px;
  background: var(--surface); border: 0; text-align: start; text-decoration: none; color: inherit;
  transition: background-color 120ms ease;
}
button.k-row:active, a.k-row:active { background: var(--surface-2); }
.k-row .ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.k-row .ic svg { width: 20px; height: 20px; }
.k-row .ic.solid { color: #fff; background: var(--brand); }
.k-row .ic.danger { color: #fff; background: var(--danger); }
.k-row .main { flex: 1; min-width: 0; }
.k-row .main b { display: block; font-weight: 600; font-size: var(--fs-body); line-height: 1.3; }
.k-row .main small { display: block; font-size: var(--fs-sec); color: var(--ink-soft); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-row .main small.wrap { white-space: normal; }
.k-row .end { flex: none; font-size: var(--fs-sec); color: var(--ink-soft); font-variant-numeric: tabular-nums; text-align: end; }
.k-row .chev { flex: none; width: 8px; height: 8px; border-right: 2px solid var(--ink-soft); border-top: 2px solid var(--ink-soft); transform: rotate(45deg); opacity: .6; margin-inline-end: 2px; }
.k-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* ---------- buttons ---------- */
.k-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 18px;
  border: 0; border-radius: var(--r-btn); font: 600 var(--fs-body)/1.2 var(--text); text-decoration: none; text-align: center;
  background: var(--brand); color: var(--brand-ink); transition: transform 120ms var(--ease), filter 120ms ease;
}
.k-btn:active { transform: scale(.97); filter: brightness(.94); }
.k-btn.tonal { background: color-mix(in srgb, var(--brand) 13%, var(--surface)); color: var(--brand); }
.k-btn.plain { background: var(--surface-2); color: var(--ink); }
.k-btn.danger { background: var(--danger); color: #fff; }
.k-btn.small { min-height: 38px; padding: 8px 14px; font-size: var(--fs-sec); border-radius: 11px; }
.k-btn svg { width: 20px; height: 20px; flex: none; }
.k-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin: 16px 0; }
.k-btns.stack { grid-auto-flow: row; }
@media (prefers-color-scheme: dark) {
  .k-row .ic, .empty .ic { background: color-mix(in srgb, var(--brand) 30%, var(--surface)); color: color-mix(in srgb, var(--brand) 45%, #fff); }
}
@media (prefers-color-scheme: dark) { .k-btn.tonal { background: color-mix(in srgb, var(--brand) 26%, var(--surface)); color: color-mix(in srgb, var(--brand) 55%, #fff); } }

.k-round { width: 48px; height: 48px; border-radius: 50%; border: 0; color: var(--ink); display: grid; place-items: center; box-shadow: var(--float-shadow); transition: transform 120ms var(--ease); }
.k-round:active { transform: scale(.92); }
.k-round.on { color: #fff; background: var(--brand); }
.k-round svg { width: 22px; height: 22px; }

.k-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.k-chips::-webkit-scrollbar { display: none; }
.k-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 7px 14px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: var(--fs-sec); font-weight: 600; transition: transform 120ms var(--ease); }
.k-chip:active { transform: scale(.95); }
.k-chip.on { background: var(--ink); color: var(--bg); }
.k-chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.k-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.k-tag { background: var(--surface-2); border-radius: 999px; padding: 4px 11px; font-size: var(--fs-sec); }

.k-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 4px; }
.k-stat { background: var(--surface-2); border-radius: 14px; padding: 10px 14px; border: 0; text-align: start; }
.k-stat small { display: block; font-size: var(--fs-cap); color: var(--ink-soft); }
.k-stat strong { font-size: var(--fs-title); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- bottom sheet (driven by kit.js) ---------- */
.k-sheet {
  position: fixed; z-index: 1001; left: 0; right: 0; bottom: 0; height: var(--sheet-h, 85vh);
  display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 34px rgba(0, 0, 0, .18); transform: translate3d(0, 110%, 0); will-change: transform;
  visibility: hidden;
}
.k-sheet.live { visibility: visible; }
.k-sheet-grab { flex: none; touch-action: none; cursor: grab; padding: 8px 0 2px; }
.k-sheet-handle { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-2); margin: 0 auto; }
@media (prefers-color-scheme: dark) { .k-sheet-handle { background: #4a4842; } }
.k-sheet-close { position: absolute; inset-inline-end: 12px; top: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink-soft); display: grid; place-items: center; z-index: 2; transition: transform 120ms var(--ease); }
.k-sheet-close:active { transform: scale(.9); }
.k-sheet-close svg { width: 14px; height: 14px; }
.k-sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(20px + var(--safe-b)); -webkit-overflow-scrolling: touch; max-height: var(--sheet-visible, none); }
.k-sheet-body > :first-child { margin-top: 0; }
.k-sheet .k-title { margin: 4px 44px 6px 0; }
.k-photo { margin: 0 -16px 14px; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); border-radius: 22px 22px 0 0; margin-top: -14px; }
.k-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.k-kind { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-cap); font-weight: 600; color: var(--ink-soft); }
.k-kind .dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- toast ---------- */
.k-toast {
  position: fixed; z-index: 2000; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  transform: translate(-50%, 16px) scale(.96); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 18px; font-weight: 600; font-size: var(--fs-sec); color: var(--ink);
  box-shadow: var(--float-shadow); transition: opacity 200ms ease, transform 260ms var(--ease); max-width: calc(100vw - 32px); text-align: center;
}
/* inside a sheet, grouped rows and cards sit one tone below the sheet */
.k-sheet .k-row, .k-sheet .k-card { background: var(--bg); }
.k-sheet button.k-row:active, .k-sheet a.k-row:active { background: var(--surface-2); }
.k-toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- map pins ---------- */
.k-pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 5px; transform: rotate(-45deg); display: grid; place-items: center;
  border: 2.5px solid #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, .32); transition: transform 220ms var(--ease);
}
.k-pin svg { transform: rotate(45deg); width: 16px; height: 16px; color: #fff; }
.k-pin.dot { width: 22px; height: 22px; border-radius: 50%; transform: none; border-width: 2px; }
.k-pin.dot svg { transform: none; width: 12px; height: 12px; }
.k-pin.sel { transform: rotate(-45deg) scale(1.3); box-shadow: 0 0 0 4px color-mix(in srgb, #fff 55%, transparent), 0 6px 16px rgba(0, 0, 0, .4); }
.k-pin.dot.sel { transform: scale(1.45); }
.k-label { background: var(--material-solid); color: var(--ink); border: 0; border-radius: 8px; padding: 2px 7px; font: 600 12px/1.3 var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .22); white-space: nowrap; }
.k-label::before { display: none; }
.k-me { width: 20px; height: 20px; border-radius: 50%; background: #1d8fe0; border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(29, 143, 224, .22), 0 2px 8px rgba(0, 0, 0, .4); }
.leaflet-control-attribution { font-size: 9px; }
.leaflet-control-zoom { display: none; }

/* ---------- small print ---------- */
.k-madeby { display: block; text-align: center; margin: 28px 0 6px; font: 400 12px/1 var(--text); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); text-decoration: none; opacity: .7; }

@media (prefers-reduced-motion: reduce) {
  .k-tab, .k-btn, .k-round, .k-chip, .k-pin, .k-sheet-close { transition: none; }
  .k-toast { transition: opacity 200ms ease; transform: translate(-50%, 0); }
}
