/* ============================================================================
   Korean Heritage — Trip Planner · base layout + design tokens
   ----------------------------------------------------------------------------
   Aesthetic: "Hanji & Celadon". Warm mulberry-paper neutrals, a muted Goryeo
   celadon jade as the primary accent, a soft dancheong persimmon as the warm
   accent, and deep sumuk ink for text. Editorial serif display + humanist body.
   Feature modules (map/cards/voting/itinerary) inherit everything from these
   :root tokens. Only CSS is touched here; JS sets semantic cluster colors inline.
   ========================================================================== */

:root {
  /* --- hanji paper neutrals --- */
  --bg: #f4efe6;            /* warm mulberry-paper ground */
  --bg-2: #ece4d6;          /* slightly deeper paper, for wells/strips */
  --surface: #fcfaf4;       /* card / panel paper */
  --surface-raised: #ffffff;
  --line: #e0d6c4;          /* hairline on paper */
  --line-soft: #ebe3d4;

  /* --- sumuk ink text --- */
  --ink: #23201b;           /* near-black warm ink */
  --ink-2: #4a443b;         /* secondary ink */
  --muted: #8a8072;         /* faded ink / captions */

  /* --- celadon jade (primary accent) --- */
  --accent: #2f6b5e;        /* deep celadon */
  --accent-strong: #245549; /* pressed celadon */
  --accent-2: #3d8b78;      /* bright celadon, for focus/hover glints */
  --accent-wash: #e6efe9;   /* faint celadon tint for fills */

  /* --- dancheong persimmon (warm accent) --- */
  --warm: #c2603d;          /* muted cinnabar/persimmon */
  --warm-wash: #f6e7dd;
  --gold: #b88a2e;          /* dancheong ochre, for stars/wants */

  /* --- shape + motion --- */
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(35, 32, 27, .06);
  --shadow: 0 1px 2px rgba(35, 32, 27, .05), 0 8px 22px -8px rgba(35, 32, 27, .14);
  --shadow-lg: 0 4px 10px rgba(35, 32, 27, .07), 0 18px 40px -14px rgba(35, 32, 27, .22);
  --ring: 0 0 0 3px rgba(61, 139, 120, .28);
  --ease: cubic-bezier(.4, .14, .3, 1);
  --topbar-h: 66px;

  /* --- type --- */
  --font-body: "Helvetica Neue", "Apple SD Gothic Neo", "Noto Sans KR",
               "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Palatino",
                  "URW Palladio L", Georgia, "Times New Roman", "Noto Serif KR", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* full-height flex column so the map view can fill whatever space the
     (variable-height) header + filter bar leave — works on phone + desktop. */
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  /* layered hanji atmosphere: warm radial glows + a faint fibre grain */
  background-image:
    radial-gradient(120% 80% at 0% 0%, rgba(61, 139, 120, .06), transparent 60%),
    radial-gradient(120% 80% at 100% 0%, rgba(194, 96, 61, .05), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============================ topbar ====================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
  height: var(--topbar-h);
  padding: 0 20px;
  background: rgba(252, 250, 244, .86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fdfaf2;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), var(--shadow-sm);
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  letter-spacing: .01em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* view tabs */
.views {
  margin-left: auto;
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}
.views button {
  border: none;
  background: transparent;
  color: var(--ink-2);
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .01em;
  transition: color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.views button:hover { color: var(--ink); }
.views button.active {
  background: var(--surface-raised);
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
}

.member-bar { display: flex; align-items: center; gap: 8px; flex: none; }

/* ============================ filter bar ================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: none;
  padding: 11px 20px;
  background: rgba(236, 228, 214, .55);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: var(--topbar-h);
  z-index: 900;
  backdrop-filter: saturate(130%) blur(6px);
  -webkit-backdrop-filter: saturate(130%) blur(6px);
}

/* ============================ views ======================================= */
/* main fills the space left under the header/filter; the active map view
   stretches to fill it, while scrolling content views grow past it. */
main {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }
#view-map { overflow: hidden; }
#map {
  flex: 1 1 auto;
  min-height: 360px;
  width: 100%;
  background: var(--bg-2);
}
.cards {
  display: grid;
  gap: 16px;
  padding: 20px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}
#view-itinerary { padding: 22px 20px 48px; }

/* ============================ shared bits ================================= */
.placeholder {
  grid-column: 1 / -1;
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  text-align: center;
  padding: 56px 16px;
}

/* toast / connection status pill */
.status {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fbf7ee;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  animation: status-rise .32s var(--ease);
}
/* the JS toggles the `hidden` attribute; keep it authoritative over our display */
.status[hidden] { display: none; }
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(61, 139, 120, .25);
}
.status.sticky {
  background: #7a3a1f;
  color: #fdeede;
}
.status.sticky::before {
  background: var(--warm);
  box-shadow: 0 0 0 3px rgba(194, 96, 61, .3);
  animation: status-pulse 1.4s var(--ease) infinite;
}
@keyframes status-rise {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}

/* ============================ responsive ================================== */
/* tablet: keep the topbar single-row but tighten */
@media (max-width: 860px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .topbar h1 { font-size: 17px; }
}

/* phone: stack the topbar into a tidy two-row header */
@media (max-width: 680px) {
  :root { --topbar-h: 56px; }
  .topbar {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--topbar-h);
    padding: 9px 14px;
    gap: 10px 12px;
    row-gap: 10px;
  }
  .brand { order: 1; flex: 1 1 auto; }
  .member-bar { order: 2; margin-left: auto; }
  .views {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
  }
  .views button { flex: 1 1 0; padding: 8px 6px; }

  .subtitle {
    white-space: normal;
    font-size: 11px;
    line-height: 1.3;
  }
  .topbar h1 { font-size: 17px; }
  .brand-mark { width: 38px; height: 38px; font-size: 17px; }

  .filter-bar {
    position: static;
    padding: 10px 14px;
    gap: 7px;
  }

  /* map fills the leftover viewport via the body flex column (no fixed calc) */
  .cards { padding: 14px; gap: 13px; grid-template-columns: 1fr; }
  #view-itinerary { padding: 16px 13px 40px; }
}

@media (max-width: 400px) {
  .topbar h1 { font-size: 15.5px; }
}

/* respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ====== module styles appended below (map/cards/voting/itinerary) ====== */
