/*
 * Base styles for public pages. Mobile first: the default rules target small
 * screens; wider layouts are added with min-width media queries (D-06, D-08).
 *
 * Themes only set the custom properties below and may decorate the documented
 * hooks: .theme-root, .event-hero, .hero-deco, .event-title, .event-card,
 * .choice, .choice__marker, .btn-submit, .notice.
 */

/* Tokens live on .theme-root (the body) so derived values follow theme overrides. */
.theme-root {
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font-body);
  --page-bg: #f4f5f7;
  --color-bg: #f4f5f7;
  --color-surface: #ffffff;
  --color-text: #1b1f24;
  --color-muted: #555e69;
  --color-border: #c9ced6;
  --color-primary: #1f5fbf;
  --color-on-primary: #ffffff;
  --color-error: #b3261e;
  --color-on-error: #ffffff;
  --color-success: #1e7a3c;
  --color-info: #1f5fbf;
  --color-focus: #ffbf47;
  --color-heading: var(--color-text);
  --input-bg: #ffffff;
  --input-text: var(--color-text);
  --choice-bg: var(--color-surface);
  --choice-border: var(--color-border);
  --choice-checked-bg: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface));
  --choice-checked-border: var(--color-primary);
  --choice-marker: var(--color-border);
  --choice-marker-checked: var(--color-primary);
  --radius: 0.75rem;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.06);
  --gap: 1rem;
  --tap: 2.75rem; /* 44px minimum touch target */
}

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

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

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

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
}

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

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

/* Layout */

.page {
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) 2rem max(1rem, env(safe-area-inset-left));
}

.event-hero {
  padding: 1rem 0 1.25rem;
  text-align: center;
}

.hero-deco:empty,
.hero-deco span {
  display: none;
}

.event-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  line-height: 1.15;
  color: var(--color-heading);
}

.event-subtitle {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  color: var(--color-muted);
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-muted);
}

.event-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1rem;
}

.event-description p:first-child {
  margin-top: 0;
}

.section-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--color-heading);
}

.form-group + .form-group,
.summary,
.payment-box {
  margin-top: 1.75rem;
}

.places {
  margin: 0 0 1rem;
}

/* Fields */

.field {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field__label {
  display: block;
  margin-bottom: 0.35rem;
  padding: 0;
  font-weight: 600;
}

.field__required {
  color: var(--color-error);
}

.field__optional {
  font-weight: 400;
  color: var(--color-muted);
  font-size: 0.9em;
}

.field__help {
  margin: 0 0 0.5rem;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.field__error {
  margin: 0 0 0.5rem;
  color: var(--color-error);
  font-weight: 600;
}

.input {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: max(1rem, 16px); /* prevents iOS zoom on focus */
  color: var(--input-text);
  background: var(--input-bg);
  border: 2px solid var(--color-border);
  border-radius: calc(var(--radius) * 0.6);
}

.input:focus-visible {
  border-color: var(--color-primary);
}

.field--invalid .input {
  border-color: var(--color-error);
}

.textarea {
  min-height: 6rem;
  resize: vertical;
}

.input--number {
  max-width: 10rem;
}

/* Choice pills (checkbox / radio). Themes restyle .choice__marker, e.g. as poker chips. */

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: var(--tap);
  max-width: 100%;
  padding: 0.45rem 1rem 0.45rem 0.6rem;
  background: var(--choice-bg);
  border: 2px solid var(--choice-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  user-select: none;
}

.choice__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.choice__marker {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--choice-marker);
  background: var(--color-surface);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.choice--checkbox .choice__marker {
  border-radius: 0.35rem;
}

.choice__input:checked + .choice__marker {
  background: var(--choice-marker-checked);
  border-color: var(--choice-marker-checked);
  box-shadow: inset 0 0 0 3px var(--color-surface);
}

.choice:has(.choice__input:checked) {
  background: var(--choice-checked-bg);
  border-color: var(--choice-checked-border);
}

.choice:has(.choice__input:focus-visible) {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

.choice__price {
  color: var(--color-muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Single checkboxes (consent, public listing) */

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: var(--tap);
  cursor: pointer;
}

.check__input {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.1rem 0 0;
  accent-color: var(--color-primary);
}

/* Honeypot (F-11) */

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.7rem 1.25rem;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--color-on-primary);
  background: var(--color-primary);
  border: 0;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.btn-submit {
  width: 100%;
  min-height: 3.25rem;
  font-size: 1.1rem;
}

.btn-pay {
  width: 100%;
}

.form-note {
  margin: 0 0 0.75rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* Notices */

.notice,
.error-summary {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border-left: 5px solid var(--color-info);
  border-radius: calc(var(--radius) * 0.5);
  background: color-mix(in srgb, var(--color-info) 8%, var(--color-surface));
}

.notice p:last-child {
  margin-bottom: 0;
}

.notice__title,
.error-summary__title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.notice--success {
  border-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 8%, var(--color-surface));
}

.error-summary {
  border-color: var(--color-error);
  background: color-mix(in srgb, var(--color-error) 7%, var(--color-surface));
}

.error-summary ul {
  margin: 0;
  padding-left: 1.2rem;
}

.error-summary a {
  color: var(--color-error);
  font-weight: 600;
}

/* Price and summary */

.price-info {
  margin: 0 0 0.5rem;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
}

.price-table th,
.price-table td {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  font-weight: 400;
}

.price-table td {
  text-align: right;
  white-space: nowrap;
  padding-left: 1rem;
}

.price-table tfoot th,
.price-table tfoot td {
  font-weight: 700;
  border-bottom: 0;
}

.summary-list {
  margin: 0;
}

.summary-list__row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.summary-list dt {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.summary-list dd {
  margin: 0;
}

/* Event list (home page) */

.event-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-list__link {
  display: flex;
  flex-direction: column;
  min-height: var(--tap);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
}

.event-list__title {
  font-weight: 700;
}

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

/* Footer */

.site-footer {
  padding: 0 1rem 2rem;
  text-align: center;
}

.site-footer nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--color-muted);
}

/* Wider screens */

@media (min-width: 600px) {
  .page {
    padding-top: 2rem;
  }

  .event-card {
    padding: 2rem;
  }

  .summary-list__row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) 2fr;
    gap: 1rem;
  }

  .btn-pay {
    width: auto;
  }
}

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

.bookmark-hint {
  margin: 1.25rem 0 0;
}

/* Secondary and destructive buttons */

.btn-secondary {
  color: var(--color-text);
  background: transparent;
  border: 2px solid var(--color-border);
}

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

.cancel-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.cancel-box {
  margin-top: 1.75rem;
}

/* Public participant list (L-01) */

.public-list {
  margin: 0 0 1.5rem;
}

.public-list__names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.public-list__name {
  padding: 0.2rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
}

.public-list__others {
  margin: 0.5rem 0 0;
  color: var(--color-muted);
}

@media (min-width: 600px) {
  .cancel-form {
    flex-direction: row;
  }
}

.preview-banner {
  margin: 0 0 1rem;
  padding: 0.6rem 1rem;
  text-align: center;
  font-weight: 700;
  color: #1b1f24;
  background: #ffbf47;
  border-radius: var(--radius);
}
