/* The events page, the same for every city; theme.css has each city's colours. */

/* What only Gemini found: the app's soft lavender (Theme.kt), the same for every city. */
:root {
  --gem-wash: #eee9fb;
  --gem-tag: #dfd7f7;
  --gem-ink: #5b4b9a;
  --gem-line: rgba(91, 75, 154, 0.26);
}

@media (prefers-color-scheme: dark) {
  :root {
    --gem-wash: #282338;
    --gem-tag: #3d3558;
    --gem-ink: #d3c8ff;
    --gem-line: rgba(211, 200, 255, 0.22);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-underline-offset: 0.18em;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.sprite {
  display: none;
}

/* A button's display would otherwise show it while it's hidden. */
[hidden] {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: currentColor;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

.skip {
  position: fixed;
  z-index: 50;
  top: 8px;
  left: 8px;
  padding: 8px 14px;
  color: var(--on-brand);
  background: var(--brand-strong);
  border-radius: 10px;
  transform: translateY(-160%);
}

.skip:focus {
  transform: none;
}

/* Header */

.top {
  background: var(--brand-strong);
  color: #fff;
}

/* Dark themes lighten the brand colours; the bar stays deep so its white text reads. */
@media (prefers-color-scheme: dark) {
  .top {
    background: var(--brand-deep);
    border-bottom: 1px solid var(--line);
  }
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
}

.get {
  padding: 7px 14px;
  color: var(--brand-deep);
  background: var(--accent);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.get:hover {
  filter: brightness(1.05);
}

/* Intro */

.intro {
  padding: 28px 0 8px;
}

.intro h1 {
  margin: 0 0 6px;
  font-size: clamp(1.7rem, 4.4vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.intro p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/*
 * A button whose words change while it's busy (app.js puts in data-busy, then data-idle again) is as wide
 * as the longer of the two, so nothing moves when they change. The two, invisible, span all four columns
 * and the outer two share what's left over, so the icon stays beside the words, in the middle.
 */
.button[data-busy] {
  display: inline-grid;
  grid-template-columns: 1fr auto auto 1fr;
  gap: 0;
}

.button[data-busy] > .icon {
  grid-area: 1 / 2;
  margin-inline-end: 8px;
}

.button[data-busy] > span {
  grid-area: 1 / 3;
}

.button[data-busy]::before,
.button[data-busy]::after {
  grid-area: 1 / 1 / 2 / -1;
  height: 0;
  padding-inline-start: 28px;
  visibility: hidden;
}

.button[data-busy]::before {
  content: attr(data-idle);
}

.button[data-busy]::after {
  content: attr(data-busy);
}

/* Search with Gemini: how far it's got, then what it found */

.gemini-status {
  display: grid;
  gap: 8px;
  max-width: 640px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--gem-line);
  border-radius: 16px;
  background: var(--gem-wash);
}

.intro .gemini-status p {
  max-width: none;
  color: var(--ink);
}

.gs-row,
.gs-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.intro .gemini-status .gs-text,
.intro .gemini-status .gs-head {
  color: var(--gem-ink);
  font-weight: 650;
}

.gs-head .icon {
  width: 18px;
  height: 18px;
}

.intro .gemini-status .gs-fine {
  color: var(--muted);
  font-size: 0.85rem;
}

.spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--gem-line);
  border-top-color: var(--gem-ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.gs-bar {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--gem-tag);
  color: var(--gem-ink);
  -webkit-appearance: none;
  appearance: none;
}

.gs-bar:not([value]) {
  display: none;
}

.gs-bar::-webkit-progress-bar {
  background: var(--gem-tag);
}

.gs-bar::-webkit-progress-value {
  background: var(--gem-ink);
  border-radius: 999px;
  transition: width 300ms ease;
}

.gs-bar::-moz-progress-bar {
  background: var(--gem-ink);
  border-radius: 999px;
}

.gs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Tabs, search and chips, kept in reach while scrolling */

.controls {
  position: sticky;
  z-index: 10;
  top: 0;
  margin: 0 -16px;
  padding: 12px 16px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}

.controls.stuck {
  border-bottom-color: var(--line);
}

.tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  background: var(--bg-deep);
  border-radius: 999px;
}

.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.tabs button[aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.count:not(:empty) {
  min-width: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.75rem;
  line-height: 20px;
  text-align: center;
}

.narrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.search {
  display: flex;
  flex: 1 1 260px;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--brand);
}

.search input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.chip[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--ink);
}

.notice {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 28%, var(--card));
}

/* The list */

.list {
  padding: 4px 0 40px;
}

.section-title {
  margin: 22px 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 12px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  content-visibility: auto;
  contain-intrinsic-size: auto 210px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.badge {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  width: 52px;
  padding: 6px 0 5px;
  border-radius: 12px;
  background: var(--bg-deep);
  line-height: 1.1;
}

.badge.soon {
  background: var(--brand);
  color: var(--on-brand);
}

.badge b {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}

.badge span {
  font-size: 1.45rem;
  font-weight: 750;
}

.card-main {
  flex: 1;
  min-width: 0;
}

.title {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  overflow-wrap: anywhere;
}

.title:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.new-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 6px 2px 0;
  border-radius: 50%;
  background: var(--new);
  vertical-align: middle;
}

.line {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.tag {
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--bg-deep);
  font-size: 0.78rem;
  font-weight: 600;
}

.tag.free {
  background: color-mix(in srgb, #2e9e5b 22%, var(--card));
}

.tag.new {
  background: color-mix(in srgb, var(--new) 20%, var(--card));
}

.tag.gemini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gem-tag);
  color: var(--gem-ink);
}

.tag.gemini .icon {
  width: 13px;
  height: 13px;
}

.card.gemini {
  background: var(--gem-wash);
  border-color: var(--gem-line);
}

.card.gemini .badge:not(.soon),
.card.gemini .tag:not(.free):not(.gemini) {
  background: color-mix(in srgb, var(--gem-tag) 70%, var(--card));
}

.more-dates {
  margin: 6px 0 0;
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 650;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  background: var(--bg-deep);
}

.icon-button .icon {
  width: 24px;
  height: 24px;
}

.star[aria-pressed="true"] {
  color: var(--star);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

/* Equal halves when they fit; "Add to calendar" keeps to one line, and on the narrowest phones they stack. */
.card-actions > * {
  flex: 1 1 0;
  min-width: max-content;
  padding-inline: 14px;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.button:hover {
  filter: brightness(1.08);
}

.button.tonal {
  background: var(--brand-soft);
  color: var(--ink);
}

.button.quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.button.big {
  min-width: min(100%, 260px);
  min-height: 54px;
  padding: 12px 28px;
  font-size: 1.06rem;
}

.button.quiet:hover {
  background: var(--bg-deep);
  filter: none;
}

.button.gemini {
  background: var(--gem-tag);
  border-color: var(--gem-line);
  color: var(--gem-ink);
}

.button.small {
  min-height: 36px;
  padding: 4px 14px;
  font-size: 0.88rem;
}

.button:disabled {
  cursor: default;
  opacity: 0.75;
  filter: none;
}

.spinning .icon {
  animation: spin 0.9s linear infinite;
}

.button.busy .icon {
  animation: pulse 1.4s ease-in-out infinite;
}

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

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.empty {
  margin: 40px auto;
  max-width: 46ch;
  color: var(--muted);
  text-align: center;
}

.empty .button {
  margin-top: 14px;
}

/* Sheets: a bottom sheet on phones, a centred dialog on wider screens */

.sheet {
  width: min(100%, 600px);
  max-width: 100%;
  max-height: min(92dvh, 900px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.25);
}

.sheet[open] {
  animation: rise 180ms ease-out;
}

.sheet::backdrop {
  background: rgba(8, 18, 22, 0.55);
}

.sheet-body {
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
}

@media (min-width: 700px) {
  .sheet {
    margin: auto;
    border-radius: 24px;
  }

  .sheet.small {
    width: min(100%, 480px);
  }
}

@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet h2 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.photo {
  position: relative;
  margin: -20px -20px 16px;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: var(--bg-deep);
}

.photo img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.photo figcaption {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
}

.info {
  display: grid;
  gap: 8px;
  margin: 14px 0 4px;
  padding: 0;
  list-style: none;
}

.info li {
  display: flex;
  gap: 12px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.info .icon {
  margin-top: 2px;
  color: var(--brand);
}

.visit {
  display: flex;
  justify-content: center;
  margin: 18px 0 10px;
}

.about {
  margin: 12px 0 4px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.about.clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-weight: 650;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}

.actions .button {
  flex: 1 1 auto;
  min-height: 42px;
  padding: 6px 14px;
  font-size: 0.92rem;
}

.dates {
  margin-top: 14px;
}

.dates h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.date-chips button {
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  font-size: 0.88rem;
}

.date-chips button[aria-current="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  font-weight: 650;
}

.listed,
.fine {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.report {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.report .icon {
  width: 16px;
  height: 16px;
}

.gemini-note {
  display: flex;
  gap: 10px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--gem-line);
  border-radius: 12px;
  background: var(--gem-wash);
  font-size: 0.9rem;
}

.gemini-note .icon {
  margin-top: 1px;
  color: var(--gem-ink);
}

/* Add to calendar */

.add-what {
  margin: 4px 0 14px;
  color: var(--muted);
}

.add-list {
  display: grid;
  gap: 8px;
}

.add-option {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  text-decoration: none;
}

.add-option:hover {
  background: var(--bg-deep);
}

.add-option .icon {
  width: 26px;
  height: 26px;
}

.add-option span {
  display: grid;
  flex: 1;
}

.add-option small {
  color: var(--muted);
}

.add-option.apple .icon {
  color: var(--ink);
}

.add-option.google .icon {
  color: #1a73e8;
}

.add-option.outlook .icon,
.add-option.office .icon {
  color: #0f6cbd;
}

.add-option.file .icon {
  color: var(--muted);
}

/* Filters */

fieldset {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 6px;
  font-weight: 750;
}

.checks {
  display: grid;
  gap: 2px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 4px;
  border-radius: 10px;
  cursor: pointer;
}

.check:hover {
  background: var(--bg-deep);
}

.check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--brand);
}

.check small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* The Gemini key */

.key-lead {
  margin: 10px 0 0;
}

.wash-sample {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--gem-line);
  border-radius: 14px;
  background: var(--gem-wash);
  font-size: 0.9rem;
}

.wash-sample .tag {
  flex: none;
  margin-top: 1px;
}

.wash-sample p {
  margin: 0;
}

.steps {
  display: grid;
  gap: 14px;
  margin: 18px 0 8px;
  padding-left: 22px;
}

.steps li::marker {
  color: var(--gem-ink);
  font-weight: 750;
}

.steps p {
  margin: 0;
}

.steps .button {
  margin-top: 8px;
}

.steps label {
  display: block;
  margin-bottom: 8px;
}

.key-input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
}

.key-input:focus {
  border-color: var(--gem-ink);
  outline: 3px solid var(--gem-line);
  outline-offset: 0;
}

.key-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, #d93025 14%, var(--card));
  font-size: 0.9rem;
}

/* Footer */

.foot {
  padding: 26px 0 calc(34px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.foot p {
  max-width: 75ch;
}

.foot summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 650;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

@media (max-width: 520px) {
  .get {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  /* Side by side when they fit, a row each when they don't, as the chips below. */
  .intro-actions .button {
    flex: 1 1 auto;
    padding-inline: 13px;
  }

  .tabs {
    width: 100%;
  }

  .tabs button {
    flex: 1;
    justify-content: center;
    padding: 6px 8px;
  }

  .narrow .search {
    flex-basis: 100%;
  }

  .narrow .chip {
    flex: 1;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet[open] {
    animation: none;
  }

  .spinning .icon,
  .button.busy .icon,
  .spinner,
  .gs-bar::-webkit-progress-value {
    animation: none;
    transition: none;
  }
}
