:root {
  --bg: #f8f6ef;
  --text: #142f2a;
  --btn: #0b302b;
  --accent: #437c66;
  --muted: #60716b;
  --border: #d5ded3;
  --card: #ffffff;
  --focus: #1b6fd6;
  --radius: 18px;
  --serif: Georgia, "Times New Roman", "Noto Serif Tamil", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101a18; --text: #eef3ee; --btn: #437c66; --accent: #7fb49d;
    --muted: #a9b9b2; --border: #2c3f3a; --card: #17231f;
  }
}

:root[data-theme="dark"] {
  --bg: #101a18; --text: #eef3ee; --btn: #437c66; --accent: #7fb49d;
  --muted: #a9b9b2; --border: #2c3f3a; --card: #17231f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-wrap: anywhere;
}

:lang(ta) { line-height: 1.8; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }

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

.skip-link {
  position: absolute; left: 16px; top: -48px;
  background: var(--btn); color: #fff;
  padding: 10px 14px; border-radius: 8px; z-index: 10;
}
.skip-link:focus { top: 8px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.nav a, .nav-pending {
  color: var(--text); text-decoration: none; padding: 10px 2px; min-height: 44px;
  display: inline-flex; align-items: center; font-size: 0.95rem;
}
.nav a:hover { color: var(--accent); }
.nav-pending { color: var(--muted); }

h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 700; margin-top: 40px; }
.card-title { font-size: 1.25rem; margin: 0 0 6px; }

.eyebrow { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 60ch; }
.hero { padding-top: 48px; padding-bottom: 28px; } /* not shorthand: keep the 16px side gutter from .wrap */
.page-head { padding-top: 12px; }

.search { position: relative; margin-top: 20px; max-width: 720px; }
.search-row { display: flex; gap: 10px; align-items: stretch; }
.search input {
  width: 100%; flex: 1 1 0; min-width: 0; min-height: 56px; padding: 14px 18px; font: inherit; font-size: 1.05rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text);
}
.search-submit { min-height: 56px; padding: 0 26px; flex: 0 0 auto; }
.search-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(20, 47, 42, 0.12); z-index: 6;
}
.search-list[hidden] { display: none; }
.search-list li a {
  display: flex; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px;
  padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none;
}
.search-list li[aria-selected="true"] a { background: var(--bg); }
.search-meta { color: var(--muted); font-size: 0.85rem; }
.status { color: var(--muted); font-size: 0.95rem; margin: 10px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 10px 18px; border-radius: 999px; background: var(--btn); color: #fff;
  text-decoration: none; font-weight: 600; border: 0; font: inherit; cursor: pointer;
}
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }

.nav .chip { margin-left: 8px; }
.chip {
  display: inline-block; font-size: 0.78rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); background: var(--card);
}

.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 640px) and (max-width: 959px) { .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
.plain-list { list-style: none; padding: 0; margin: 24px 0 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-link { color: var(--text); text-decoration: none; display: inline-flex; flex-direction: column; justify-content: center; min-height: 44px; }
.card-link:hover .card-title { color: var(--accent); }
.place-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
/* Cards in a grid share a row height, and their footers line up at the bottom. Chip and Save share the first line; the map and booking links take the second line. */
.grid > .card { display: flex; flex-direction: column; }
.grid > .card > .place-row { margin-top: auto; padding-top: 10px; }
.grid > .card .place-row > a.btn { flex: 1 1 100%; text-align: center; order: 2; }
.grid > .card .place-row > .fav-btn { order: 1; }

.crumbs { font-size: 0.88rem; color: var(--muted); padding: 16px 0 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; }

.notice { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px 18px; color: var(--muted); background: var(--card); margin-top: 24px; }
.notice h2 { font-size: 1.2rem; margin-top: 0; }
.notice p:last-child { margin-bottom: 0; }

.facts { margin: 0; }
.facts dt { font-weight: 600; margin-top: 8px; }
.facts dd { margin: 0 0 4px 0; color: var(--muted); }

.back-link { margin-top: 24px; }

.site-footer { margin-top: 56px; border-top: 1px solid var(--border); padding: 28px 0 40px; color: var(--muted); font-size: 0.92rem; }
.site-footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.site-footer a { color: var(--text); display: inline-flex; align-items: center; min-height: 44px; }

section { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* 360px and 390px phones: no horizontal overflow, full-width buttons */
@media (max-width: 420px) {
  h1 { font-size: 1.9rem; }
  .btn { width: 100%; }
  .search-submit { width: auto; }
  .search input { font-size: 16px; }
}

/* Wide admin tables scroll inside their own box, so the page itself never scrolls sideways */
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th, .table-wrap td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.table-wrap td, .table-wrap th { min-width: 6rem; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 16px 0; }
.filters label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filters .field { min-width: 0; max-width: 100%; }
.snapshot { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.report-form .field { display: block; width: 100%; max-width: 100%; }
.admin-main { padding-bottom: 40px; }

/* Place photos: fixed 4:3 frames so the page does not jump while images load */
.photo-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.photo { margin: 0; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); height: auto; }
.photo figcaption { margin-top: 6px; font-size: 0.85rem; }

/* Form fields: shared styling for every form (login, register, report, admin editors) */
.field {
  display: block; width: 100%; max-width: 560px; min-height: 44px; padding: 10px 12px;
  font: inherit; font-size: 1rem; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 10px;
}
textarea.field { min-height: 110px; resize: vertical; }
select.field { min-height: 44px; }
.field:focus { border-color: var(--accent); }
form label { display: block; margin-bottom: 4px; color: var(--text); }
form p { margin: 0 0 16px; }
.report-form { max-width: 560px; }
.report-form .field { max-width: 100%; }
form br { display: none; }

/* Admin header: navigation links on one side, signed-in user and sign-out on the other */
.admin-user { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.admin-user form { margin: 0; }
.btn.small { min-height: 34px; padding: 6px 14px; font-size: 0.9rem; width: auto; }
.site-header .nav { row-gap: 2px; }

/* Photo on a place card (district page) */
.card-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); height: auto; margin-bottom: 10px; }
.card-photo-link { display: block; border-radius: 12px; }
.lightbox { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface, #fff); color: var(--text); }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.75); }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.lightbox-figure { margin: 0; text-align: center; }
.lightbox-img { display: block; max-width: 100%; max-height: calc(100vh - 220px); margin: 0 auto; border-radius: 12px; object-fit: contain; }
.lightbox-caption { margin-top: 10px; text-align: left; }
.lightbox-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
@media (max-width: 480px) { .lightbox { padding: 12px; } .lightbox-nav .btn { flex: 1; } }
.card-photo-link:hover .card-photo { opacity: 0.92; }
.card-photo-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-credit { font-size: 0.8rem; margin: 0 0 10px; }

/* Activity cards: labels and values sit in two aligned columns, and titles reserve two lines so the rows line up. */
.activity-facts { display: grid; grid-template-columns: minmax(7rem, 9rem) 1fr; gap: 6px 12px; margin: 12px 0; font-size: 0.95rem; }
.activity-facts dt { font-weight: 600; }
.activity-facts dd { margin: 0; }
.activity-card .card-title { min-height: 2.6em; }

/* Places near you, search paging and the district fallback. Rows wrap on narrow screens. */
.near-controls, .pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0; }
.near-controls .field, .near-fallback .field { width: auto; max-width: 100%; }
.near-fallback { margin-top: 16px; }
.pagination .status { width: 100%; margin: 0; }

/* .btn sets display, which would otherwise override the hidden attribute after the player starts. */
.video-play[hidden] { display: none; }

/* Home hero with a licensed photo (home.php). Colours come from the tokens above. */
.hero-photo { position: relative; background: var(--btn); color: #fff; }
/* Hero slider: slides stack in the same box and cross-fade. The credit sits inside each slide, so it fades with its photo. */
.hero-slides { position: relative; height: clamp(260px, 42vw, 460px); }
.hero-slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 0.8s ease; }
.hero-slide.is-active { opacity: 1; }
.hero-slide > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero-nav { position: absolute; top: 40%; transform: translateY(-50%); z-index: 2; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55); background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.hero-nav:hover, .hero-nav:focus-visible { background: rgba(0, 0, 0, 0.6); }
.hero-prev { left: 12px; }
.hero-next { right: 12px; }
.hero-dots { position: absolute; top: 14px; left: 16px; z-index: 2; display: flex; gap: 6px; }
.hero-dot { width: 11px; height: 11px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid #fff; background: rgba(255, 255, 255, 0.35); }
.hero-dot.is-active { background: #fff; }
@media (prefers-reduced-motion: reduce) { .hero-slide { transition: none; } }
.hero-photo-body { position: absolute; left: 0; right: 0; bottom: 0; padding-top: 24px; padding-bottom: 28px;
  background: linear-gradient(180deg, rgba(11, 48, 43, 0) 0%, rgba(11, 48, 43, 0.88) 70%); }
.hero-photo .eyebrow { color: #e7efe9; }
.hero-photo h1 { color: #fff; font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: 8px; }
.hero-photo .lead { color: #e7efe9; margin-bottom: 0; }
.hero-credit { position: absolute; right: 12px; top: 12px; margin: 0; font-size: 0.75rem; color: #fff;
  background: rgba(0, 0, 0, 0.4); padding: 2px 8px; border-radius: 6px; }
.hero-credit a { color: #fff; }
.search-wide { max-width: 1040px; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.search-wide > label { flex: 1 1 100%; }
.search-wide .search-row { flex: 1 1 360px; }
.search-filters { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 380px; }
.search-filters .search-filter { flex: 1 1 170px; display: flex; flex-direction: column; gap: 4px; }
.search-filters .search-filter label { font-size: 0.85rem; color: var(--muted); }
.search-wide .status { flex: 1 1 100%; }
@media (max-width: 640px) {
  .hero-photo-body { padding-top: 16px; padding-bottom: 18px; }
  .hero-credit { top: auto; bottom: 8px; right: 8px; }
}

/* Keep the search box clear of the sticky header when the page scrolls to it (suggestions must stay tappable). */
#dest-search { scroll-margin-top: 96px; }
html { scroll-padding-top: 96px; }
@media (max-width: 640px) {
  .hero-slides { height: 190px; }
  .hero { padding-top: 16px; }
}

/* Home page upgrade (home.php). Tokens only; no new colours. */
.hero-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; }
.hero-stats li { background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28); color: #fff;
  border-radius: 999px; padding: 6px 14px; font-size: 0.9rem; backdrop-filter: blur(2px); }
.hero-stats strong { font-family: var(--serif); font-size: 1.05rem; }
.hero-lift { margin-top: -28px; position: relative; z-index: 3; padding-top: 0; }
.search-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 22px;
  box-shadow: 0 18px 40px rgba(20, 47, 42, 0.12); }
.section-lede { color: var(--muted); margin: -4px 0 18px; max-width: 62ch; }
section.wrap > h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-top: 8px; }
section.wrap + section.wrap { margin-top: 48px; }
.district-card { padding: 16px; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.district-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(20, 47, 42, 0.12); }
.district-card .card-photo { border-radius: 12px; }
.district-card .status:last-child { margin-bottom: 0; }
.recent-grid .card { border-left: 4px solid var(--accent); }
.recent-grid .eyebrow { color: var(--accent); }
.coverage-section .notice { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px;
  background: var(--card); border: 1px solid var(--border); padding: 20px; }
.coverage-section .notice p { margin: 0; padding: 14px 16px; background: var(--bg); border-radius: 14px; color: var(--text); }
.coverage-section .notice p.status { color: var(--muted); }
@media (max-width: 640px) {
  .hero-lift { margin-top: -20px; }
  .search-card { padding: 16px; border-radius: 16px; }
  .hero-stats li { font-size: 0.82rem; padding: 5px 11px; }
}
.search-wide .status:empty { display: none; }
