:root {
  --bg: #f6f4ee;
  --card-bg: #fffefb;
  --text: #182420;
  --text-dim: #647169;
  --border: #e3ddcd;
  --accent: #0f6b64;
  --accent-2: #189c8e;
  --accent-warm: #e0762f;
  --rising: #1a9c6a;
  --falling: #c9581a;
  --shadow: 0 1px 2px rgba(24, 36, 32, 0.05), 0 10px 28px rgba(24, 36, 32, 0.07);
  --radius: 20px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* --header-h and --cat-nav-full-h are measured and set by js/category-nav.js */
  --header-h: 72px;
  --cat-nav-compact-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1a1a;
    --card-bg: #102524;
    --text: #eaf3f0;
    --text-dim: #8fada5;
    --border: #1d3b38;
    --accent: #36cbbb;
    --accent-2: #7fe6d8;
    --accent-warm: #f0a35e;
    --rising: #3ecf8e;
    --falling: #f0925a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  background-image: radial-gradient(900px 480px at 50% -12%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* ---- Splash / initial load screen ---- */
/* Shows the full Mill Town badge (icons/badge.svg; the header/favicon use
   its NL monogram, icons/icon.svg) so the loading state and the app icon
   read as the same brand. */

.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: var(--bg);
  transition: opacity 0.5s ease;
}

.splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.splash-scene {
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-mark {
  display: block;
  width: 168px;
  height: 168px;
  filter: drop-shadow(0 10px 24px color-mix(in srgb, var(--accent) 30%, transparent));
  animation:
    splash-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both,
    splash-bob 3.2s ease-in-out 0.6s infinite;
}

@keyframes splash-in {
  from { opacity: 0; transform: scale(0.86); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes splash-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-mark { animation: none; }
}

.splash-text {
  text-align: center;
  padding: 0 20px;
}

.splash-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.splash-sub {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.splash-dots {
  display: inline-flex;
  margin-left: 4px;
  vertical-align: middle;
}

.splash-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 2px;
  border-radius: 50%;
  background: var(--accent);
  animation: splash-dot 1.2s ease-in-out infinite;
}

.splash-dots span:nth-child(2) { animation-delay: 0.15s; }
.splash-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes splash-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.app-header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 6px;
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-header-clock {
  flex: 0 0 auto;
  padding-top: 4px;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.app-header-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.app-header-text {
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.app-header-tagline {
  margin: 2px 0 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- Category nav ---- */
/* Full-size tiles under the header that scroll away normally; once they're
   past, .is-compact turns the same nav into a one-row sticky bar directly
   under the sticky header. See js/category-nav.js. */

.cat-nav {
  position: sticky;
  /* Full size: only "sticks" at the instant it hands over to the compact bar
     (its bottom edge level with the compact bar's), never before. */
  top: calc(var(--header-h) + var(--cat-nav-compact-h) - var(--cat-nav-full-h, 100vh));
  z-index: 40;
}

.cat-nav[hidden] {
  display: none;
}

.cat-nav-list {
  position: relative;
  list-style: none;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 480px) {
  .cat-nav-list {
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  }
}

@media (min-width: 640px) {
  .cat-nav-list {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 16px 24px 0;
  }
}

.cat-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 68px;
  height: 100%;
  padding: 8px 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.cat-nav-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.cat-nav-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
  .cat-nav-link:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    transform: translateY(-1px);
  }
}

.cat-nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cat-nav-link[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.cat-nav.is-compact {
  top: var(--header-h);
  height: var(--cat-nav-compact-h);
  /* Keep occupying the full-size height in the page flow, so switching
     modes never shifts the content below. */
  margin-bottom: calc(var(--cat-nav-full-h, var(--cat-nav-compact-h)) - var(--cat-nav-compact-h));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 16px rgba(24, 36, 32, 0.08);
}

.cat-nav.is-compact .cat-nav-list {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding-top: 0;
  padding-bottom: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.cat-nav.is-compact .cat-nav-list::-webkit-scrollbar {
  display: none;
}

.cat-nav.is-compact .cat-nav-list > li {
  flex: 0 0 auto;
}

.cat-nav.is-compact .cat-nav-link {
  flex-direction: row;
  gap: 6px;
  height: auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  box-shadow: none;
  font-size: 0.85rem;
  white-space: nowrap;
}

.cat-nav.is-compact .cat-nav-icon {
  font-size: 1.05rem;
}

/* Slightly tighter pills on wider screens so the whole set fits in one row
   at typical desktop widths (it still scrolls sideways if it doesn't). */
@media (min-width: 640px) {
  .cat-nav.is-compact .cat-nav-list {
    gap: 4px;
  }

  .cat-nav.is-compact .cat-nav-link {
    gap: 3px;
    padding: 0 9px;
    font-size: 0.78rem;
  }

  .cat-nav.is-compact .cat-nav-icon {
    font-size: 0.95rem;
  }
}

.cat-nav.is-compact .cat-nav-label {
  display: block;
}

/* Drag-to-reorder for the full-size tiles (js/category-nav.js). */
.cat-nav-link {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.cat-nav-list > li {
  position: relative;
}

.cat-nav-list > li.is-dragging {
  z-index: 2;
  pointer-events: none;
}

.cat-nav-list > li.is-dragging .cat-nav-link {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(24, 36, 32, 0.22);
  transform: scale(1.06);
  cursor: grabbing;
}

.cat-nav.is-reordering,
.cat-nav.is-reordering * {
  cursor: grabbing;
}

.cat-nav-tools {
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 16px 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.cat-nav-tools[hidden],
.cat-nav-reset[hidden],
.cat-nav.is-compact .cat-nav-tools {
  display: none;
}

.cat-nav-reset {
  padding: 2px 4px;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  cursor: pointer;
}

.cat-nav-reset:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (min-width: 640px) {
  .cat-nav-tools {
    padding: 6px 24px 0;
  }
}

.cat-nav-sentinel {
  position: relative;
  top: calc(-1 * (var(--header-h) + var(--cat-nav-compact-h)));
  height: 1px;
  margin-bottom: -1px;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .cat-nav.is-compact .cat-nav-list {
    animation: cat-nav-in 0.18s ease-out;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cat-nav-link {
    transition: none;
  }
}

@keyframes cat-nav-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.tile-grid > .tile {
  /* Section titles land just below the header + compact category bar. */
  scroll-margin-top: calc(var(--header-h) + var(--cat-nav-compact-h) + 12px);
}

.tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 16px calc(28px + env(safe-area-inset-bottom));
}

@media (min-width: 480px) {
  .tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (min-width: 640px) {
  .tile-grid {
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    padding: 16px 24px calc(28px + env(safe-area-inset-bottom));
  }
}

.tile {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

@media (hover: hover) and (pointer: fine) {
  .tile:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    box-shadow: 0 4px 10px rgba(16, 32, 28, 0.08), 0 18px 34px rgba(16, 32, 28, 0.12);
  }
}

.tile-body {
  min-width: 0;
  min-height: 40px;
}

.tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.tile-header-text {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
  flex: 1;
}

.tile-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  min-width: 0;
}

.tile-header .tile-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
  min-width: 0;
  text-align: right;
}

.tile-move-controls {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 2px;
}

.tile-move-up,
.tile-move-down {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tile-move-up:hover:not(:disabled),
.tile-move-down:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text-dim) 14%, transparent);
  color: var(--text);
}

.tile-move-up:disabled,
.tile-move-down:disabled {
  opacity: 0.3;
  cursor: default;
}

.tile-error {
  color: var(--falling);
  font-size: 0.9rem;
  padding: 8px 0;
}

.tile-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 0;
}

.skeleton-row {
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--text-dim) 10%, transparent) 25%,
    color-mix(in srgb, var(--text-dim) 18%, transparent) 37%,
    color-mix(in srgb, var(--text-dim) 10%, transparent) 63%
  );
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-row { animation: none; }
}

.retry-btn {
  margin-top: 8px;
  min-height: 40px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.retry-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.app-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 0 calc(24px + env(safe-area-inset-bottom));
}

.footer-link {
  display: inline-block;
  padding: 4px 2px;
  color: var(--text-dim);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-coffee {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.8;
}

.footer-credit {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.7;
}

/* ---- Shared day-nav pager (Weather, Happening Today) ---- */

.day-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 12px;
}

.day-label {
  font-size: 0.85rem;
  font-weight: 650;
  min-width: 8em;
  text-align: center;
}

.day-prev,
.day-next {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.day-prev:active,
.day-next:active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.day-prev:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---- Shared stat-tile layout (Tide Clock, Weather) ---- */
/* Both tiles share the same "icon/dial + big number + two-stat grid" shape,
   so the layout lives here once; tile-specific bits (the tide dial, the
   weather emoji, rising/falling color) stay in each tile's own section. */

.stat-tile-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stat-top {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.stat-now {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-big {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}

.stat-big small {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 2px;
}

.stat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.stat-box {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 12px;
  padding: 8px 10px;
}

.stat-box .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  font-weight: 650;
}

.stat-box .value {
  font-size: 0.98rem;
  font-weight: 700;
  margin-top: 2px;
}

.stat-updated {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: right;
}

/* ---- Tide clock tile ---- */

.tide-dial-wrap {
  flex: 0 0 auto;
  width: 132px;
  height: 132px;
}

.tide-dial-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tide-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 650;
  margin-top: 4px;
}

.tide-state.rising { color: var(--rising); }
.tide-state.falling { color: var(--falling); }

.tide-state .arrow {
  font-size: 1rem;
}

.stat-box .sub {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 1px;
}

.tide-graph {
  width: 100%;
  height: 72px;
  display: block;
}

/* ---- Weather tile ---- */

.wx-icon {
  flex: 0 0 auto;
  width: 66px;
  font-size: 3rem;
  line-height: 1;
  text-align: center;
}

.wx-high {
  color: var(--text);
}

.wx-low {
  color: var(--text-dim);
  font-size: 1.4rem;
  margin-left: 8px;
}

.wx-desc {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ---- Things To Do tiles ---- */

.ttd-empty {
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 4px 0;
}

.ttd-tile-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ttd-show-all {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ttd-show-all:active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.ttd-venue {
  display: block;
  margin: 0 -8px;
  width: calc(100% + 16px);
  padding: 6px 8px 14px;
  border-bottom: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .ttd-venue:hover {
    background: color-mix(in srgb, var(--text-dim) 6%, transparent);
  }
}

.ttd-venue:active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.ttd-venue:last-child {
  padding-bottom: 6px;
  border-bottom: none;
}

.ttd-venue-name {
  font-size: 0.95rem;
  font-weight: 650;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Venue name in Happening Today: jumps to the venue's row in its category. */
.ttd-venue-link {
  all: unset;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
  /* A button is an atomic inline box, so the parent's ellipsis can't reach
     its text - truncate long names here instead. */
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
.ttd-venue-link:hover,
.ttd-venue-link:focus-visible {
  text-decoration-color: currentColor;
}
.ttd-venue-link:focus-visible {
  outline: 2px solid var(--accent, currentColor);
  outline-offset: 2px;
  border-radius: 3px;
}
@media (hover: none) {
  .ttd-venue-link { text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); }
}

/* Brief highlight on a category row revealed from Happening Today. */
@keyframes ttd-row-highlight {
  0%, 35% { box-shadow: inset 0 0 0 2px var(--accent, #2a7); background-color: color-mix(in srgb, var(--accent, #2a7) 12%, transparent); }
  100% { box-shadow: inset 0 0 0 2px transparent; background-color: transparent; }
}
.ttd-crow-item.is-highlight {
  animation: ttd-row-highlight 1.8s ease-out;
  border-radius: 10px;
}
@media (prefers-reduced-motion: reduce) {
  .ttd-crow-item.is-highlight { animation-duration: 0.01s; outline: 2px solid var(--accent, #2a7); }
}

/* Town, small subtle line under the venue name (Happening Today). */
.ttd-venue-town {
  margin-top: 1px;
  font-size: 0.72rem;
  line-height: 1.2;
  color: var(--text-dim);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Venue name (left) + status pill (right), top line. */
.ttd-venue-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

/* Event name (and Add to calendar), second line. */
.ttd-venue-hours {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.ttd-status {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
}

.ttd-status.open {
  color: var(--rising);
  background: color-mix(in srgb, var(--rising) 15%, transparent);
}

.ttd-status.closed {
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text-dim) 12%, transparent);
}

.ttd-status.opening-soon,
.ttd-status.closing-soon {
  color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 15%, transparent);
}

/* Golf's "Tee Time" pill - an action, not a status, so it gets the neutral
   accent color rather than any of the open/closed semantic ones above. */
.ttd-status.tee-time {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  text-decoration: none;
}

a.ttd-status.tee-time:hover,
a.ttd-status.tee-time:active {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

/* "Reservation" pill - an action like Tee Time, same accent styling. */
.ttd-status.reservation {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  text-decoration: none;
}

a.ttd-status.reservation:hover,
a.ttd-status.reservation:active {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.ttd-reservation-pill {
  color: var(--accent);
  font-weight: 650;
}

/* Movie theaters: "Showtimes" link pill (in place of open/closed, since
   theaters don't post fixed hours) - same action styling as Tee Time. */
.ttd-status.showtimes {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  text-decoration: none;
}

a.ttd-status.showtimes:hover,
a.ttd-status.showtimes:active {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

/* One-line "Now showing: A, B, C +N more" on a theater's tile row. The
   titles shrink and ellipsize; the label and "+N more" never get cut. */
.ttd-now-showing {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

/* Venue modal: the full "Now showing" list. */
.ttd-now-showing-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ttd-now-showing-list li {
  font-size: 0.84rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-dim) 10%, transparent);
  color: var(--text);
}

.ttd-now-showing-times {
  display: inline-block;
  margin: 0 0 14px;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--accent);
  text-decoration: none;
}

.ttd-now-showing-times:hover {
  text-decoration: underline;
}

.ttd-doordash-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ff3008;
  font-weight: 650;
}

.ttd-doordash-detail svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.ttd-toast-detail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ff4c00;
  font-weight: 650;
}

.ttd-toast-detail svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.ttd-venue-countdown {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--accent-warm);
  margin-top: 2px;
}

/* "Starts in" is good news (something's coming up), not urgency like
   "Ends in" - same green as the "Open now" pill (--rising) rather than
   the warm/urgent color used for closing-soon and ends-in. */
.ttd-venue-countdown.starts {
  color: var(--rising);
}

/* Same quiet accent button as .ttd-show-all, sized to sit beside an event. */
.ttd-add-cal {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 3px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ttd-add-cal:active {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .ttd-add-cal:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
  }
}

.ttd-venue-hours .ttd-add-cal {
  margin-left: auto;
}

/* ---- Venue details modal ---- */

body.ttd-modal-lock {
  overflow: hidden;
}

.ttd-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1);
  padding: 0;
}

@media (min-width: 640px) {
  .ttd-modal-backdrop {
    align-items: center;
    padding: 20px;
  }
}

.ttd-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.ttd-modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  transform: translateY(16px) scale(0.99);
  transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1);
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  outline: none;
}

@media (min-width: 640px) {
  .ttd-modal {
    border-radius: var(--radius);
    transform: scale(0.97);
  }
}

.ttd-modal-backdrop.open .ttd-modal {
  transform: none;
}

.ttd-modal-subtitle.open {
  color: var(--rising);
}

.ttd-modal-subtitle.closed {
  color: var(--text-dim);
}

.ttd-modal-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.ttd-modal-close:hover {
  background: color-mix(in srgb, var(--text-dim) 14%, transparent);
  color: var(--text);
}

.ttd-detail-desc {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.ttd-detail-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
}

.ttd-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 0.88rem;
}

.ttd-detail-row:last-child {
  border-bottom: none;
}

.ttd-detail-row:hover {
  color: var(--accent);
}

.ttd-detail-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
}

.ttd-detail-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin: 0 0 8px;
}

.ttd-hours-table {
  margin-bottom: 8px;
}

.ttd-hours-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  padding: 5px 0;
  color: var(--text-dim);
}

.ttd-hours-row.today {
  color: var(--text);
  font-weight: 650;
}

.ttd-detail-event {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--text-dim) 6%, transparent);
}

.ttd-detail-event.today {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.ttd-detail-event-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ttd-detail-event-head .ttd-add-cal {
  margin-top: 1px;
}

.ttd-detail-event-name {
  font-size: 0.9rem;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ttd-today-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 1px 7px;
}

.ttd-detail-event-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ---- Suggest a Place tile ---- */

.suggest-form {
  display: flex;
  flex-direction: column;
}

.suggest-form label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
  margin: 10px 0 4px;
}

.suggest-form label:first-child {
  margin-top: 0;
}

.suggest-form input[type="text"],
.suggest-form select,
.suggest-form textarea {
  width: 100%;
  font-size: 0.95rem;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}

.suggest-form textarea {
  min-height: 64px;
  resize: vertical;
}

.suggest-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.suggest-msg {
  min-height: 1.2em;
  font-size: 0.85rem;
  margin-top: 10px;
}

.suggest-msg.success {
  color: var(--rising);
  font-weight: 650;
}

.suggest-msg.error {
  color: var(--falling);
  font-weight: 650;
}

.suggest-submit {
  margin-top: 4px;
  width: 100%;
}

/* ===== Compact venue rows (layout option 1) =====
   One line per venue in the category tiles; tap to expand in place.
   Happening Today keeps its own .ttd-venue rows. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ttd-tile-content.ttd-compact {
  gap: 0;
  margin: 0 -8px;
}

.ttd-crow-item {
  border-bottom: 1px solid var(--border);
}

.ttd-crow-item:last-child {
  border-bottom: none;
}

.ttd-crow {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 10px 8px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .ttd-crow:hover {
    background: color-mix(in srgb, var(--text-dim) 6%, transparent);
  }
}

.ttd-crow:focus-visible,
.ttd-xp-details:focus-visible,
.ttd-act:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ttd-crow-item {
  transition: background-color 0.22s cubic-bezier(0.2, 0, 0, 1);
}

/* While a row's ghost panel is collapsing, keep the open-row tint so the
   background fades with it instead of vanishing first. */
.ttd-crow-item.is-closing,
.ttd-crow-item.is-open {
  background: color-mix(in srgb, var(--accent) 6%, var(--card-bg));
  border-radius: 14px;
}

.ttd-crow-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-dim) 45%, transparent);
}

.ttd-crow-dot.open { background: var(--rising); }
.ttd-crow-dot.closing { background: var(--rising); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-warm) 70%, transparent); }
.ttd-crow-dot.later { background: var(--accent-warm); }

.ttd-crow-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ttd-crow-flag {
  flex: 0 0 auto;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 2px 6px;
  border-radius: 6px;
}

.ttd-crow-flag.deal {
  color: var(--accent-warm);
  background: color-mix(in srgb, var(--accent-warm) 14%, transparent);
}

.ttd-crow-hours {
  flex: 0 0 auto;
  font-size: 0.82rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.ttd-crow-hours.closing { color: var(--accent-warm); font-weight: 650; }

/* Compact rows: name on top, town on a small line below (golf: stats line, then town). */
.ttd-crow-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ttd-crow-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ttd-crow-chev {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.ttd-crow-chev svg { width: 18px; height: 18px; }

.ttd-crow[aria-expanded="true"] .ttd-crow-chev {
  transform: rotate(180deg);
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .ttd-crow-chev,
  .ttd-crow-item,
  .ttd-modal-backdrop,
  .ttd-modal { transition: none; }
}

.ttd-xp {
  padding: 0 10px 14px 26px;
}

.ttd-xp-hours {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -2px 0 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dim);
}

.ttd-xp-desc {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ttd-acts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.ttd-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 60px;
  padding: 8px 2px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.ttd-act svg { width: 20px; height: 20px; }
.ttd-act span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ttd-act.primary { background: color-mix(in srgb, var(--accent) 12%, var(--card-bg)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.ttd-act.doordash { color: #ff3008; }
.ttd-act.toast { color: #ff4c00; }

.ttd-act:active { background: color-mix(in srgb, var(--accent) 10%, var(--card-bg)); }

@media (hover: hover) and (pointer: fine) {
  .ttd-act:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
}

.ttd-xp-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 0 0 6px;
}

.ttd-xp-events {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ttd-xp-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.ttd-xp-event-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ttd-xp-event-name {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--accent);
}

.ttd-xp-event-time {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.ttd-xp .ttd-add-cal {
  background: var(--card-bg);
  min-height: 32px;
}

.ttd-now-showing-list li.more {
  background: transparent;
  color: var(--text-dim);
  font-weight: 650;
}

.ttd-xp .ttd-now-showing-list {
  margin-bottom: 12px;
}

.ttd-xp-details {
  display: block;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

/* ---- Legend (collapsed <details> under Suggest a Place) ---- */
.site-legend { max-width: 1100px; margin: 0 auto 16px; padding: 0 16px; }
.site-legend > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 18px; font-weight: 700; color: var(--accent); }
.site-legend > summary::-webkit-details-marker { display: none; }
.site-legend > summary::after { content: "▾"; transition: transform 220ms; }
.site-legend[open] > summary { border-radius: var(--radius) var(--radius) 0 0; }
.site-legend[open] > summary::after { transform: rotate(180deg); }
.lg-body { background: var(--card-bg); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 4px 18px 16px; font-size: 0.86rem; }
.lg-body h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 14px 0 6px; }
.lg-body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lg-body li { display: flex; align-items: center; gap: 10px; }
.lg-body li > :first-child { flex: 0 0 auto; }
.lg-icons { grid-template-columns: 1fr 1fr; }
.lg-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; color: var(--accent); }
.lg-ic svg { width: 18px; height: 18px; }
.lg-ic.dd { color: #ff3008; } .lg-ic.toast { color: #ff4c00; }
.lg-none { width: 9px; text-align: center; color: var(--text-dim); }
.lg-txt { font-weight: 650; font-size: 0.8rem; } .lg-start { color: var(--rising); } .lg-end { color: var(--accent-warm); }
.lg-body .ttd-status { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.lg-body .ttd-add-cal { padding: 3px 8px; font-size: 0.72rem; color: var(--accent); }
@media (min-width: 640px) { .site-legend { padding: 0 24px; } }
@media (prefers-reduced-motion: reduce) { .site-legend > summary::after { transition: none; } }

/* Favorites: star toggle in the expanded row, and a small filled star
   before favorite names in lists. Gold reads on both light and dark. */
.ttd-fav { font: inherit; font-size: 0.72rem; font-weight: inherit; cursor: pointer; }
.ttd-fav svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.ttd-fav.is-fav { color: #c98a00; background: color-mix(in srgb, #f5b400 14%, var(--card-bg)); border-color: color-mix(in srgb, #f5b400 45%, var(--border)); }
.ttd-fav.is-fav svg { fill: #f5b400; stroke: #c98a00; }
.fav-star { display: inline-flex; vertical-align: -0.1em; margin-right: 4px; }
.fav-star svg { width: 0.9em; height: 0.9em; fill: #f5b400; stroke: #c98a00; stroke-width: 1.5; stroke-linejoin: round; }
@media (prefers-color-scheme: dark) {
  .ttd-fav.is-fav { color: #ffc93c; }
  .ttd-fav.is-fav svg, .fav-star svg { fill: #ffc93c; stroke: #ffc93c; }
}
.lg-fav { width: 22px; justify-content: center; margin: 0; } .lg-fav svg { width: 18px; height: 18px; }

/* Search box (js/search.js) */
.site-search { max-width: 1100px; margin: 12px auto 0; padding: 0 16px; }
.site-search-field { position: relative; display: flex; align-items: center; }
.site-search-icon { position: absolute; left: 14px; color: var(--text-dim); pointer-events: none; }
.site-search-input {
  width: 100%; box-sizing: border-box; padding: 12px 40px 12px 40px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow); -webkit-appearance: none; appearance: none;
}
.site-search-input:focus { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.site-search-clear {
  position: absolute; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-dim); font-size: 22px; line-height: 1; cursor: pointer;
}
.site-search-results {
  list-style: none; margin: 8px 0 0; padding: 4px; background: var(--card-bg);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
.site-search-results[hidden] { display: none; }
.site-search-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.site-search-item:hover, .site-search-item:focus-visible { background: rgba(24, 156, 142, 0.12); }
.site-search-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-search-cat { color: var(--text-dim); font-size: 0.85em; white-space: nowrap; }
.site-search-empty { padding: 10px 12px; color: var(--text-dim); }

/* "New" pill for events added in the last 7 days */
.ttd-new-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--accent-warm);
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
}

/* The New section lists every recently added event, so names and times wrap
   instead of ellipsizing, and a keyboard focus ring is visible on the row. */
.ttd-new-list { overflow-wrap: anywhere; }
.ttd-new-list .ttd-venue-name,
.ttd-new-list .ttd-venue-link,
.ttd-new-list .ttd-venue-town {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.ttd-new-list .ttd-venue:focus-visible {
  outline: 2px solid var(--accent, currentColor);
  outline-offset: 2px;
}
