/* ==========================================================================
   Event schedule: one stylesheet for every page.
   Neutral demo theme. Brand colours live only in the :root tokens below
   (the original branded theme is parked in branding/theme/styles.css).
   ========================================================================== */

:root {
  --bg: #f4f4f9;
  --panel: #ffffff;
  --brand: #0f4c5c;
  --brand-hover: #0b3a47;
  --brand-soft: #e6f1f3;
  --brand-soft-hover: #d3e7eb;
  --accent: #5fb3c4;
  --accent-text: #0e6272;
  --text: #1f2937;
  --muted: #5b6270;
  --line: #e2e2ec;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --danger-soft-hover: #fecaca;
  --success: #15803d;
  --radius-sm: 10px;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 76, 92, 0.08);
  --shadow-lift: 0 14px 34px rgba(15, 76, 92, 0.14);
  --on-brand: #ffffff;
  --surface-2: #fafafd;
  --chip: #f3f4f6;
  --chip-hover: #e5e7eb;
  --line-strong: #c9c9d9;
  --input-line: #d4d4e0;
  --input-line-hover: #b9b9cc;
  --placeholder: #7a8090;
  --backdrop: rgba(15, 23, 42, 0.5);
  color-scheme: light;
}

/* Dark theme. Applies when chosen with the header toggle (data-theme="dark", kept in
   a cookie), or when the device prefers dark and nothing has been chosen yet.
   The two blocks hold the same values; CSS cannot share them between the selectors. */
:root[data-theme='dark'] {
  --bg: #0f1419;
  --panel: #182028;
  --brand: #6cc3d3;
  --brand-hover: #8fd3df;
  --brand-soft: #1d3a42;
  --brand-soft-hover: #24505b;
  --accent: #5fb3c4;
  --accent-text: #7fcbd9;
  --text: #e5e9ee;
  --muted: #9aa4b1;
  --line: #2b3540;
  --danger: #f87171;
  --danger-soft: #3b1d1f;
  --danger-soft-hover: #4c2326;
  --success: #4ade80;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 14px 34px rgba(0, 0, 0, 0.5);
  --on-brand: #0b1f26;
  --surface-2: #1e2730;
  --chip: #25303a;
  --chip-hover: #2f3b47;
  --line-strong: #45515d;
  --input-line: #36424e;
  --input-line-hover: #4a5764;
  --placeholder: #7d8794;
  --backdrop: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f1419;
    --panel: #182028;
    --brand: #6cc3d3;
    --brand-hover: #8fd3df;
    --brand-soft: #1d3a42;
    --brand-soft-hover: #24505b;
    --accent: #5fb3c4;
    --accent-text: #7fcbd9;
    --text: #e5e9ee;
    --muted: #9aa4b1;
    --line: #2b3540;
    --danger: #f87171;
    --danger-soft: #3b1d1f;
    --danger-soft-hover: #4c2326;
    --success: #4ade80;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 14px 34px rgba(0, 0, 0, 0.5);
    --on-brand: #0b1f26;
    --surface-2: #1e2730;
    --chip: #25303a;
    --chip-hover: #2f3b47;
    --line-strong: #45515d;
    --input-line: #36424e;
    --input-line-hover: #4a5764;
    --placeholder: #7d8794;
    --backdrop: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* Venue colours. One set of variables per venue, consumed by cards and chips. */
.venue-main-stage { --venue: #16a34a; }
.venue-marquee    { --venue: #9333ea; }
.venue-carpark    { --venue: #d97706; }
.venue-other      { --venue: #6b7280; }

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
}

/* Main site: plain background so content is the focus. */
.app-screen {
  background-color: var(--bg);
}

/* Login, 404 and error: a quiet gradient behind a single card. */
.standalone-screen {
  background-color: #0b3a47;
  background-image: linear-gradient(160deg, #0f4c5c 0%, #0b2f3a 100%);
  background-attachment: fixed;
}

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
}

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

h1, h2, h3 {
  line-height: 1.2;
  color: var(--text);
}

h2 {
  font-size: 1.25rem;
}

/* ---------- Page frame ---------- */

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.page > main {
  flex: 1 0 auto;
}

.page-disclaimer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
}

.page-disclaimer p {
  margin: 0 auto;
  max-width: 70ch;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.standalone-screen .page-disclaimer p {
  border-top: 0;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
}

/* ---------- Header ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0 24px;
}

.site-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-name {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--brand);
}

.brand-tagline {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--text);
}

.nav-link:hover {
  text-decoration: none;
  background: var(--brand-soft);
}

.nav-link[aria-current='page'] {
  color: var(--brand);
  background: var(--brand-soft);
}

/* Light/dark toggle: shows the moon in light mode and the sun in dark mode. */
.theme-toggle {
  order: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
}

.theme-toggle .icon-sun,
.theme-toggle[data-current='dark'] .icon-moon {
  display: none;
}

.theme-toggle[data-current='dark'] .icon-sun {
  display: block;
}

/* Menu button: only shown on small screens (see Small screens). */
.menu-toggle {
  order: 2;
  display: none;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: pointer;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  margin: 0 auto;
  border-radius: 1px;
  background: var(--text);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

.menu-open .menu-icon { background: transparent; }
.menu-open .menu-icon::before { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-icon::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-secondary {
  background: var(--brand-soft);
  color: var(--brand);
}

.btn-secondary:hover {
  background: var(--brand-soft-hover);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--panel);
  border-color: var(--line-strong);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft-hover);
}

.btn-block {
  width: 100%;
}

/* ---------- Surfaces ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px 24px;
  margin-bottom: 20px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  color: var(--brand);
}

.hero p {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.6;
}

.hero p + .btn {
  margin-top: 14px;
}

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  --tone: #0891b2;
  border: 1px solid color-mix(in srgb, var(--tone) 40%, var(--panel));
  background: color-mix(in srgb, var(--tone) 12%, var(--panel));
  color: var(--text);
}

.alert.error {
  --tone: #dc2626;
  color: color-mix(in srgb, var(--tone) 65%, var(--text));
}

.alert.success {
  --tone: #16a34a;
  color: color-mix(in srgb, var(--tone) 65%, var(--text));
}

.muted-note {
  margin: 0;
  color: var(--muted);
}

.empty-state {
  padding: 20px 0;
  color: var(--muted);
  font-weight: 700;
}

.empty-state p {
  margin: 0 0 12px;
}

/* ---------- Forms ---------- */

.form-grid {
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-line);
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--panel);
  accent-color: var(--brand);
}

input:hover, textarea:hover, select:hover {
  border-color: var(--input-line-hover);
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline-offset: 0;
  border-color: var(--brand);
}

::placeholder {
  color: var(--placeholder);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.field-hint {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

.field-hint a {
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.field-hint.field-error {
  color: var(--danger);
  font-weight: 600;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.form-grid + .form-actions {
  margin-top: 16px;
}

/* A text field and its button on one line (e.g. reset a user's password). */
.field-with-button {
  display: flex;
  flex: 1 1 280px;
  gap: 8px;
}

.field-with-button input[type='text'] {
  flex: 1 1 auto;
  min-width: 0;
}

.field-with-button .btn {
  flex: 0 0 auto;
}

/* Cards stacked straight inside a page (Users, Import preview) need a gap. */
main > .card + .card,
main > .alert + .card {
  margin-top: 16px;
}

.staff-assignment {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.staff-assignment legend {
  padding: 0 6px;
  font-weight: 700;
}

.staff-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.staff-option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

/* ---------- Schedule filters ---------- */

.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;
}

/* Search, venue and day tabs stay pinned while scrolling the list. */
.schedule-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 10px;
  margin: 0 -16px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.schedule-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.schedule-filters input {
  flex: 1 1 auto;
  min-width: 0;
}

.schedule-filters select {
  flex: 0 0 auto;
  width: auto;
}

.clear-link {
  flex: 0 0 auto;
  padding: 10px 4px;
  font-weight: 700;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}

.search-form label {
  flex: 1 1 220px;
}

.day-tabs {
  position: relative;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.day-tabs::-webkit-scrollbar {
  display: none;
}

.day-tab {
  flex: 1 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.day-tab:hover {
  text-decoration: none;
  border-color: var(--brand);
}

.day-tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

/* ---------- Events ---------- */

.day-group {
  margin-top: 20px;
  scroll-margin-top: 120px;
}

.day-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--muted);
}

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

/* One tappable row per event. */
.event-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.event-row:hover {
  text-decoration: none;
  box-shadow: var(--shadow-lift);
}

.event-time {
  flex: 0 0 4.2rem;
  display: grid;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.event-time strong {
  font-size: 1.05rem;
}

.event-time span {
  font-size: 0.8rem;
  color: var(--muted);
}

.event-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.event-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
}

.event-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

.event-sub .venue-chip {
  font-weight: 700;
}

.event-row .countdown {
  font-size: 0.8rem;
}

.event-chevron {
  flex: 0 0 auto;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin: 0;
  font-size: 0.95rem;
}

.event-meta > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.event-meta dt {
  color: var(--muted);
}

.event-meta dt::after {
  content: ':';
}

.event-meta dd {
  margin: 0;
  font-weight: 700;
}

.venue-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: color-mix(in srgb, var(--venue, var(--text)) 70%, var(--text));
}

.venue-chip::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--venue, var(--muted));
}

.event-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.tag-icon {
  font-size: 0.85rem;
  line-height: 1;
}

/* Each tag is one hue, tinted against the panel and text so it works in both themes. */
.tag {
  --tone: #6b7280;
  background: color-mix(in srgb, var(--tone) 15%, var(--panel));
  border-color: color-mix(in srgb, var(--tone) 45%, var(--panel));
  color: color-mix(in srgb, var(--tone) 60%, var(--text));
}

.tag-red { --tone: #dc2626; }
.tag-green { --tone: #16a34a; }
.tag-orange { --tone: #ea580c; }
.tag-purple { --tone: #9333ea; }
.tag-blue { --tone: #2563eb; }
.tag-cyan { --tone: #0891b2; }
.tag-neutral { --tone: #6b7280; }

.countdown {
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--accent-text);
}

.countdown.is-live {
  color: var(--success);
}

.countdown.is-finished {
  color: var(--muted);
}

/* ---------- Event details pop-up ---------- */

/* Centred modal on desktop; becomes a bottom sheet on phones (see Small screens). */
.event-sheet {
  width: min(560px, calc(100% - 32px));
  max-height: min(85vh, 760px);
  max-height: min(85dvh, 760px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}

.event-sheet[open] {
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.18s ease-out;
}

.event-sheet::backdrop {
  background: var(--backdrop);
}

html:has(.event-sheet[open]) {
  overflow: hidden;
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.sheet-grip {
  display: none;
}

.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--chip);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.sheet-close:hover {
  background: var(--chip-hover);
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 20px 24px;
  display: grid;
  gap: 16px;
}

.sheet-head {
  display: grid;
  gap: 10px;
  padding-right: 44px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

/* ---------- Event detail ---------- */

.detail-layout {
  display: grid;
  gap: 16px;
  align-content: start;
}

.back-link {
  justify-self: start;
  font-weight: 700;
}

.detail-box {
  display: grid;
  gap: 16px;
  max-width: 640px;
  padding: 24px 22px;
}

.detail-box h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.details-section h3 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.event-description {
  max-width: 70ch;
  margin: 0;
  white-space: pre-line;
  line-height: 1.6;
}

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

.person {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.person-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
}

.person-role {
  color: var(--muted);
  font-size: 0.9rem;
}

.person-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-btn {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.contact-btn:hover {
  text-decoration: none;
  background: var(--brand-soft-hover);
}

.inline-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

/* ---------- Admin ---------- */

.admin-layout {
  display: grid;
  gap: 20px;
  align-items: start;
}

.admin-stack {
  display: grid;
  gap: 20px;
}

.admin-box {
  padding: 24px 22px;
}

.admin-box h2 {
  margin: 0 0 16px;
}

.admin-box > .muted-note {
  margin-bottom: 16px;
}

.admin-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.admin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.admin-item.is-editing {
  outline: 1px solid var(--brand);
  border-color: var(--brand);
  background: var(--panel);
}

.admin-item strong {
  display: block;
  margin-bottom: 2px;
}

.admin-item small {
  color: var(--muted);
}

.admin-item .actions {
  flex-shrink: 0;
}

.admin-item form {
  margin: 0;
}

.event-title,
.admin-item strong,
.detail-box h1 {
  overflow-wrap: anywhere;
}

@media (min-width: 960px) {
  .admin-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }

  #event-form {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
}

/* ---------- Standalone screens: login, 404, error ---------- */

.standalone-screen .page {
  justify-content: center;
}

.standalone-screen .page > main {
  flex: 0 0 auto;
}

.standalone-box {
  width: 100%;
  max-width: 480px;
  margin: auto auto 0;
  padding: 32px 28px;
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  backdrop-filter: blur(6px);
  text-align: center;
}

.standalone-box h1 {
  margin: 0;
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  color: var(--brand);
}

.standalone-box p {
  color: var(--muted);
  line-height: 1.6;
}

.standalone-box form {
  margin-top: 8px;
  text-align: left;
}

.standalone-logo {
  display: block;
  width: 80px;
  height: auto;
  margin: 0 auto 12px;
}

.standalone-tagline {
  margin: 4px 0 16px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.standalone-box .standalone-tagline {
  color: var(--accent-text);
}

.status-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.status-box .status-code {
  margin: 12px 0 0;
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 800;
  line-height: 1;
  color: var(--brand);
  letter-spacing: 0.05em;
}

.status-box h1 {
  margin: 8px 0 12px;
}

.status-path code {
  display: inline-block;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--chip);
  color: var(--text);
  overflow-wrap: anywhere;
}

.status-actions {
  margin-top: 20px;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .event-row {
    transition: none;
  }

  .event-sheet[open] {
    animation: none;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  /* Fixed backgrounds are janky on mobile browsers. */
  .app-screen,
  .standalone-screen {
    background-attachment: scroll;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding-bottom: 16px;
  }

  .topbar.has-menu .menu-toggle {
    display: block;
  }

  .site-logo {
    width: 40px;
    height: 40px;
  }

  .brand-name {
    font-size: 1.3rem;
  }

  .brand-tagline {
    font-size: 0.72rem;
  }

  /* Nav collapses behind the menu button; opens as a panel under the header. */
  .topbar {
    position: relative;
  }

  .topbar:not(.has-menu) .actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar.has-menu .actions {
    display: none;
  }

  .topbar.menu-open .actions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 20;
    display: grid;
    gap: 4px;
    margin-top: -8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow-lift);
  }

  .topbar.menu-open .nav-link,
  .topbar.menu-open .inline-form,
  .topbar.menu-open .btn-ghost {
    width: 100%;
    padding: 12px 14px;
    text-align: left;
  }

  .hero,
  .admin-box,
  .detail-box {
    padding: 20px 16px;
  }

  .standalone-box {
    padding: 24px 18px;
  }

  /* Bottom sheet: full width, slides up from the bottom edge. */
  .event-sheet {
    width: 100%;
    max-width: none;
    max-height: 88vh;
    max-height: 88dvh;
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .event-sheet[open] {
    animation-name: sheet-up;
  }

  @keyframes sheet-up {
    from { transform: translateY(100%); }
    to { transform: none; }
  }

  .sheet-grip {
    display: block;
    flex: 0 0 auto;
    width: 40px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 2px;
    background: var(--line-strong);
  }

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

  .event-row {
    gap: 12px;
    padding: 12px;
  }

  .event-time {
    flex-basis: 3.6rem;
  }

  .event-chevron {
    display: none;
  }

  /* 16px stops iOS Safari zooming the page when a field is focused */
  input, textarea, select {
    font-size: 1rem;
  }

  .admin-item {
    display: block;
  }

  .admin-item .actions,
  .admin-item > form {
    margin-top: 10px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
