/* PBCRun site styles — mobile-first, WCAG-oriented contrast */

:root {
  --bg: #faf8f4;
  --ink: #1f1c1a;
  --muted: #4a4540; /* ≥4.5:1 on bg for body text */
  --gold: #8a6b28; /* darker gold for small text / links */
  --gold-bright: #b8923f; /* decorative larger accents */
  --line: #d4cdc0;
  --card: #ffffff;
  --placeholder: #5c574f;
  --error: #9b2c2c;
  --ok: #1f5c38;
  --focus: #1f1c1a;
  --focus-ring: #8a6b28;
  --touch: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: Inter, "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", "Noto Sans Arabic", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
}

html[dir="rtl"] body {
  font-family: "Noto Sans Arabic", Inter, system-ui, sans-serif;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 1000;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  border-radius: 4px;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Focus visible for all interactive controls */
:focus {
  outline: none;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

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

.top {
  padding-top: max(0.65rem, var(--safe-top));
}

.lang-bar {
  width: min(100% - 1rem, 42rem);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.25rem 0.5rem;
}

.lang-bar button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.lang-bar button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.lang-bar button[aria-pressed="true"] {
  color: #fff;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}

.page {
  flex: 1;
  width: min(100% - 1.5rem, 28rem);
  margin: 0 auto;
  padding: 1rem 0 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.wordmark {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.35rem, 5vw, 1.55rem);
  letter-spacing: 0.06em;
  color: var(--gold);
}

.route {
  width: min(100%, 11rem);
  height: 2rem;
  margin: 0.85rem 0 1rem;
  color: var(--gold-bright);
}

.eyebrow {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

html[lang="ja"] .eyebrow,
html[lang="zh-Hans"] .eyebrow,
html[lang="ko"] .eyebrow,
html[lang="ar"] .eyebrow {
  letter-spacing: 0.06em;
}

h1 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", serif;
  font-weight: 500;
  font-size: clamp(1.85rem, 7.2vw, 2.55rem);
  line-height: 1.2;
  color: var(--ink);
  max-width: 18ch;
}

h1 .to {
  font-style: italic;
  font-weight: 400;
}

h1 .place {
  color: var(--gold);
  font-style: italic;
  font-weight: 500;
}

html[lang="ja"] h1 .to,
html[lang="ja"] h1 .place,
html[lang="zh-Hans"] h1 .to,
html[lang="zh-Hans"] h1 .place,
html[lang="ko"] h1 .to,
html[lang="ko"] h1 .place,
html[lang="ar"] h1 .to,
html[lang="ar"] h1 .place {
  font-style: normal;
}

.countdown {
  margin: 1.5rem 0 0;
  width: 100%;
}

.countdown-row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 0.25rem;
  flex-wrap: nowrap;
}

.cd-unit {
  min-width: 3rem;
  flex: 1 1 3rem;
  max-width: 4.5rem;
}

.cd-value {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.65rem, 7vw, 2.2rem);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cd-label {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
}

.cd-sep {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
  color: var(--gold);
  padding-top: 0.2rem;
  opacity: 0.9;
  user-select: none;
}

.countdown-caption {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.card {
  width: 100%;
  margin-top: 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem 1.1rem 1.15rem;
  text-align: start;
  box-shadow: 0 1px 0 rgba(31, 28, 26, 0.04);
}

.card-title {
  margin: 0 0 1rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.35rem, 5vw, 1.55rem);
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}

.field {
  margin-bottom: 1rem;
}

.field-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.optional {
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
}

.card input[type="email"],
.card input[type="text"],
.card select {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 1rem; /* prevents iOS zoom */
  color: var(--ink);
  outline: none;
  appearance: none;
}

.card select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238a6b28' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}

html[dir="rtl"] .card select {
  background-position: left 0.85rem center;
  padding-right: 0.75rem;
  padding-left: 2.25rem;
}

.card input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.card input:focus,
.card select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(138, 107, 40, 0.25);
}

.consent-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin: 0.35rem 0 0.25rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
}

.consent-row input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  margin-top: 0.15rem;
  accent-color: var(--gold);
  flex-shrink: 0;
  cursor: pointer;
}

.consent-row label {
  cursor: pointer;
  color: var(--muted);
}

.consent-row .inline-link,
.inline-link {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: inline;
  margin-inline-start: 0.2rem;
}

.consent-row .inline-link:hover,
.inline-link:hover {
  color: var(--ink);
}

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

.card button[type="submit"] {
  width: 100%;
  min-height: var(--touch);
  margin-top: 1.15rem;
  appearance: none;
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", "Noto Sans Arabic", serif;
  font-size: 1.2rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

html[lang="ja"] .card button[type="submit"],
html[lang="zh-Hans"] .card button[type="submit"],
html[lang="ko"] .card button[type="submit"],
html[lang="ar"] .card button[type="submit"] {
  font-style: normal;
  font-family: inherit;
  font-weight: 600;
}

.card button[type="submit"]:hover:not(:disabled) {
  background: var(--gold);
  color: #fff;
}

.card button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hint {
  margin: 0.85rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.status {
  margin: 0.55rem 0 0;
  min-height: 1.25rem;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.4;
  font-weight: 500;
}

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

.status.ok {
  color: var(--ok);
}

.card.is-success #enter-fields,
.card.is-success #request-fields {
  display: none !important;
}

.is-hidden,
[hidden] {
  display: none !important;
}

.toggle-wrap {
  margin: 1.1rem 0 0;
  text-align: center;
}

.text-btn {
  appearance: none;
  border: 0;
  background: none;
  color: var(--gold);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  min-height: var(--touch);
  padding: 0.35rem 0.25rem;
}

.text-btn:hover {
  color: var(--ink);
}

#invite-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.success {
  display: none;
  text-align: center;
  padding: 0.75rem 0.25rem;
}

.card.is-success .success {
  display: block;
}

.success-msg {
  margin: 0;
  color: var(--ink);
  font-family: "Cormorant Garamond", Georgia, "Noto Sans JP", "Noto Sans SC", "Noto Sans KR", "Noto Sans Arabic", serif;
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .success-msg {
    white-space: normal;
  }
}

.success .toggle-wrap {
  margin-top: 1rem;
}

.site-footer {
  width: min(100% - 1.5rem, 36rem);
  margin: 0 auto 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.footer-links {
  margin-top: 0.75rem !important;
}

.footer-links a {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0.35rem 0.25rem;
}

.footer-links a:hover {
  color: var(--ink);
}

/* Privacy page */
.privacy-page .privacy-main {
  flex: 1;
  width: min(100% - 1.5rem, 40rem);
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.privacy-page .wordmark {
  text-align: center;
}

.privacy-page .eyebrow {
  text-align: center;
  margin-top: 0.75rem;
}

.privacy-meta {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.35rem 0 1rem;
}

.privacy-back-wrap {
  text-align: center;
  margin: 0 0 1.25rem;
}

.back-link {
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  display: inline-flex;
  min-height: var(--touch);
  align-items: center;
}

.privacy-article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem 1.15rem 1.5rem;
  text-align: start;
}

.privacy-article h1 {
  font-size: clamp(1.5rem, 5vw, 1.85rem);
  max-width: none;
  margin: 0 0 1rem;
  text-align: start;
}

.privacy-article h2 {
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.35rem 0 0.45rem;
  color: var(--ink);
}

.privacy-article p {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.privacy-article p.lead {
  color: var(--ink);
  font-size: 1rem;
}

@media (min-width: 480px) {
  .page {
    width: min(100% - 2rem, 28rem);
    padding-top: 1.35rem;
  }

  .card {
    padding: 1.5rem 1.35rem 1.35rem;
  }

  .privacy-article {
    padding: 1.75rem 1.75rem 2rem;
  }
}
