/* Layout and structure only. All colour/type comes from theme variables.
   ID hooks are wrapped in :where() so theme stylesheets can override them. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 1rem;
  line-height: 1.55;
  overflow-x: hidden;
  position: relative;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

#fx-canvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, var(--bg), var(--bg-2));
}
.site-header, main, footer { position: relative; z-index: 1; }

.site-header {
  display: flex; flex-direction: column; align-items: center;
  gap: .75rem; padding: 1.5rem 1rem 1rem; text-align: center;
}
.hero-art { width: min(300px, 78vw); line-height: 0; }
.hero-art svg { width: 100%; height: auto; display: block; }
:where(#group-name) {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 3.75rem);
  line-height: 1.1;
  color: var(--accent);
  text-shadow: var(--title-glow);
  overflow-wrap: anywhere;
}
.toolbar { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.toolbar button {
  min-height: 44px; padding: .5rem 1rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: .9rem; cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.toolbar button:hover { border-color: var(--accent); transform: translateY(-1px); }
.toolbar button[aria-pressed="true"] { border-color: var(--accent-2); color: var(--accent-2); }

button:focus-visible, a:focus-visible, textarea:focus-visible,
.type-opt input:focus-visible + span {
  outline: 3px solid var(--accent-2); outline-offset: 2px;
}

main {
  width: 100%; max-width: 760px; margin: 0 auto;
  padding: 0 1rem 2rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}

/* Gathering */
.gathering {
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  text-align: center; padding: 1.5rem 1rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.gathering .label {
  margin: 0; font-size: .8rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--text-dim);
}
#next-date {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5vw, 1.9rem);
  color: var(--accent-2);
}
#countdown {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem; width: 100%; max-width: 420px;
}
#countdown.is-hidden { display: none; }
#countdown .unit {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: .6rem .25rem; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
}
#countdown .num {
  font-family: var(--font-display); font-size: clamp(1.4rem, 7vw, 2.2rem);
  line-height: 1.1; color: var(--accent); font-variant-numeric: tabular-nums;
}
#countdown .lbl { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; }
.badge {
  display: inline-block; padding: .3rem .9rem; border-radius: 999px;
  background: var(--accent-3); color: var(--btn-text);
  font-size: .85rem; font-weight: 600; letter-spacing: .03em;
}
#location, #notes { margin: 0; max-width: 60ch; overflow-wrap: anywhere; }
#location { font-weight: 600; }
#notes { color: var(--text-dim); white-space: pre-line; }

/* Flavor text */
.flavor { margin: 0; padding: 0 1rem; text-align: center; }
.flavor blockquote {
  margin: 0 auto; max-width: 46ch; white-space: pre-line;
  font-style: italic; font-size: 1.05rem; color: var(--text-dim);
}
.flavor blockquote::before, .flavor blockquote::after { content: "\2014"; display: block; opacity: .5; font-style: normal; }

/* Agenda */
.agenda {
  display: flex; flex-direction: column; gap: 1rem;
}
.agenda h2 {
  margin: 0; font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 2rem); color: var(--accent);
}
#add-form {
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.type-picker { display: flex; gap: .5rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.type-opt { flex: 1; position: relative; cursor: pointer; }
.type-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.type-opt span {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .4rem .75rem;
  background: var(--surface-2); color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-weight: 600; transition: background .15s, color .15s, border-color .15s;
}
.type-opt input:checked + span {
  background: var(--accent); color: var(--btn-text); border-color: var(--accent);
}
:where(#add-text) {
  width: 100%; min-height: 96px; resize: vertical; padding: .75rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: 1rem; /* >=16px avoids iOS zoom */
}
:where(#add-text)::placeholder { color: var(--text-dim); opacity: .8; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.char-counter { font-size: .85rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.char-counter.near-limit { color: var(--accent-2); font-weight: 600; }
.btn-primary {
  min-height: 44px; padding: .55rem 1.25rem;
  background: var(--btn-bg); color: var(--btn-text);
  border: 0; border-radius: var(--radius);
  font-family: var(--font-display); font-size: 1rem; cursor: pointer;
  transition: transform .15s, filter .15s;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
#form-msg { margin: 0; min-height: 1.4em; font-size: .95rem; color: var(--accent-3); }
#form-msg.error { color: var(--accent-2); font-weight: 600; }

#agenda-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.card {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; gap: .35rem .75rem; align-items: start;
  padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-topic { background: var(--card-bg-topic); }
.card-fact { background: var(--card-bg-fact); }
.card-type {
  grid-column: 1; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-3); font-weight: 700;
}
.card-text { grid-column: 1; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.card .vote {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 56px; min-height: 56px; padding: .35rem .6rem; gap: .1rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; cursor: pointer; transition: transform .15s, background .15s, border-color .15s;
}
.card .vote::before { content: "\25B2"; font-size: .8rem; line-height: 1; }
.card .vote:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .vote:active { transform: scale(.95); }
.card .vote[aria-pressed="true"] { background: var(--accent); color: var(--btn-text); border-color: var(--accent); }
.card .vote-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.top-tag { display: inline-block; margin-left: .6em; }
.top-tag::before { content: var(--top-label, "\2605  Top pick"); }
.theme-name { opacity: .75; }
#empty-msg { text-align: center; color: var(--text-dim); padding: 1.5rem 0; margin: 0; }

footer {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  text-align: center; padding: 1.5rem 1rem 2rem; color: var(--text-dim);
}
footer a { color: var(--text-dim); display: inline-block; padding: .75rem 1rem; }
footer a:hover { color: var(--accent); }

@media (min-width: 640px) {
  .site-header { padding-top: 2.5rem; }
  .gathering { padding: 2rem; }
  .card { padding: 1.1rem 1.25rem; }
}
@media (min-width: 1024px) {
  main { max-width: 820px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
