/* WWW '26 — visual kinship with nobodies-collective/art-grants.
   Warm cream palette, terracotta accent, Inter (self-hosted, offline), hairlines. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/Inter-latin.woff2") format("woff2");
}

:root {
  --bg: #faf5ee;
  --bg-alt: #f2ebe0;
  --card: #fffdf9;
  --card-semi: rgba(255, 253, 249, 0.92);
  --text: #2c2418;
  --muted: #6b5e50;
  --border: #e4ddd4;
  --border-strong: #d8cfc2;
  --accent: #c2703e;
  --accent-dark: #a85d32;
  --accent-soft: #f0e2d5;
  --star: #c2703e;
  --heart: #c2453e;

  --radius-xs: 2px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --pad: 14px;
  --tab-h: 58px;

  /* category colors — warm-friendly, used for grid columns + tags */
  --cat-heal: #5b8a6b;
  --cat-chill: #6a7a9c;
  --cat-adult: #b3573f;
  --cat-work: #a06a2e;
  --cat-food: #6f8a4a;
  --cat-party: #a8557e;
  --cat-kids: #c08a2c;
  --cat-other: #6b5e50;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
html, body { margin: 0; padding: 0; scrollbar-width: none; }
::-webkit-scrollbar { display: none; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0.01em;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg-alt); color: var(--text);
  padding: calc(env(safe-area-inset-top) + 10px) var(--pad) 10px;
  border-bottom: 1px solid var(--border);
}
.topbar-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.topbar h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.topbar h1 span { color: var(--accent); font-weight: 400; }
.topbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ghost-btn {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 11px; font-size: 12.5px; font-weight: 400; cursor: pointer; letter-spacing: 0.02em;
}
.ghost-btn:active, .ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

.filters { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
#search, .barrio-select {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 16px; background: var(--card); color: var(--text);
  font-family: inherit; letter-spacing: 0.01em; font-weight: 300;
}
#search::placeholder { color: var(--muted); }
.barrio-select {
  font-size: 14px; font-weight: 400; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b5e50' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

.pills, .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.pills::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.pill, .chip {
  flex: 0 0 auto; border: 1px solid var(--border-strong); background: transparent;
  color: var(--text); border-radius: var(--radius-sm); padding: 6px 11px; font-size: 13px;
  font-weight: 400; cursor: pointer; white-space: nowrap; min-height: 38px; letter-spacing: 0.02em;
  opacity: 0.55;
}
.pill.active, .chip.active { background: var(--text); color: var(--bg); border-color: var(--text); opacity: 1; }
.chip .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

.toggles { display: flex; gap: 14px; flex-wrap: wrap; }
.toggle { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 5px; cursor: pointer; min-height: 32px; letter-spacing: 0.01em; }
.toggle input { width: 15px; height: 15px; accent-color: var(--accent); }

/* ---------- List ---------- */
.list { padding: var(--pad); display: flex; flex-direction: column; gap: 8px; max-width: 680px; margin: 0 auto; }
.loading, .empty { text-align: center; color: var(--muted); padding: 40px 20px; opacity: 0.7; }

.day-head {
  position: sticky; top: 0; z-index: 5;
  font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); background: var(--bg);
  padding: 10px 2px 4px; border-bottom: 1px solid var(--border); margin: 8px 0 2px;
}

/* ---------- Card ---------- */
.card {
  background: var(--card-semi); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 12px 13px 11px; cursor: pointer; transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--border-strong); }
.card.foryou { border-left: 3px solid var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: 0.01em; line-height: 1.3; }
.card-title .fystar { color: var(--star); margin-right: 4px; }
.heart {
  flex: 0 0 auto; font-size: 21px; line-height: 1; background: none; border: none; cursor: pointer;
  color: var(--border-strong); min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center; margin: -8px -8px -8px 0;
}
.heart.on { color: var(--heart); }
.meta { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 7px; font-size: 12.5px; color: var(--muted); align-items: center; letter-spacing: 0.01em; }
.meta .camp { color: var(--text); font-weight: 400; }
.tag {
  font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text); padding: 2px 7px; border-radius: var(--radius-xs);
  border: 1px solid var(--tagc, var(--border)); background: transparent;
}
.tag .tdot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle; background: var(--tagc); }
.reason {
  margin-top: 7px; font-size: 12.5px; color: var(--accent-dark); font-style: italic;
  letter-spacing: 0.01em;
}
.reason .fystar { font-style: normal; }
.days-line { font-size: 12px; color: var(--muted); margin-top: 4px; }
.desc { margin-top: 9px; font-size: 13.5px; color: var(--text); white-space: pre-wrap; display: none; line-height: 1.55; letter-spacing: 0.01em; }
.card.open .desc { display: block; }
.card.open { border-color: var(--border-strong); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: var(--bg-alt); border-top: 1px solid var(--border);
}
.tab {
  flex: 1; background: none; border: none; color: var(--muted);
  font-size: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; padding: 6px 0; opacity: 0.6; font-family: inherit;
}
.tab span { font-size: 10px; font-weight: 400; letter-spacing: 0.02em; }
.tab.active, .tab[aria-selected="true"] { color: var(--accent); opacity: 1; }

@media (min-width: 700px) and (max-width: 999px) {
  .topbar { padding-left: max(var(--pad), calc((100vw - 680px) / 2)); padding-right: max(var(--pad), calc((100vw - 680px) / 2)); }
}

/* ---------- Desktop timetable grid ---------- */
@media (min-width: 1000px) {
  .list.grid-mode { max-width: none; padding: 0; }
  .gridwrap { overflow: auto; border-top: 1px solid var(--border); background: var(--bg); }
  .ggrid { display: grid; min-width: 100%; grid-auto-rows: minmax(3.2rem, auto); font-size: 12px; }
  .gcell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 3px 5px; min-width: 0; }
  .ghead {
    position: sticky; top: 0; z-index: 4; background: var(--bg-alt); color: var(--text);
    font-weight: 500; text-align: center; padding: 8px 4px; letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border); box-shadow: inset 0 -2px 0 var(--c, transparent);
  }
  .gtime {
    position: sticky; left: 0; z-index: 3; background: var(--bg-alt); color: var(--muted);
    font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 500; font-size: 12px;
    text-align: center; display: flex; align-items: center; justify-content: center;
  }
  .gcorner { position: sticky; top: 0; left: 0; z-index: 6; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
  .gbody { background: var(--card); display: flex; flex-direction: column; gap: 3px; }
  .chip-ev {
    display: block; width: 100%; text-align: left; border: 1px solid var(--border); background: var(--bg);
    color: var(--text); border-radius: var(--radius-xs); padding: 3px 5px; font-size: 11.5px; cursor: pointer;
    line-height: 1.3; overflow: hidden; font-family: inherit; font-weight: 300;
  }
  .chip-ev:hover { border-color: var(--border-strong); }
  .chip-ev.on { border-left: 2px solid var(--accent); }
  .chip-ev .cet { font-family: ui-monospace, Menlo, monospace; font-weight: 500; margin-right: 4px; color: var(--muted); }
  .chip-ev .cst { color: var(--star); font-weight: 600; margin-right: 2px; }
  .chip-ev.fav .cet::after { content: " ♥"; color: var(--heart); }
  .list:not(.grid-mode) { max-width: 720px; }
}

/* ---------- Detail modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(44, 36, 24, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal-card { max-width: 520px; width: 100%; max-height: 85vh; overflow: auto; }
.modal-card .card { cursor: default; }
.modal-close {
  position: absolute; top: 14px; right: 16px; z-index: 51; font-size: 24px; line-height: 1;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 50%;
  width: 40px; height: 40px; cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
