/* WA-Chain Edu waitlist. Tokens follow WA-Site (WA-Edu DESIGN.md):
   washi-white ground, ink text, one water-blue accent. Fonts are served
   from this site — no third-party font requests. */

@font-face {
  font-family: 'Source Sans 3';
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Sans 3';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/source-serif-4-latin-600-normal.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --bg-page: #f8f9f8;
  --bg-surface: #ffffff;
  --bg-subtle: #eff2f1;
  --text: #161c1e;
  --text-secondary: #566265;
  --border: #c8d0cf;
  --border-subtle: #e1e6e5;
  --border-strong: #a1acab;
  --accent-subtle: #dfeaee;
  --accent: #2f6478;
  --accent-hover: #255262;
  --accent-text: #1c404d;
  --on-accent: #ffffff;
  --err: #b04a3b;
  --err-subtle: #f5e1dd;
  --ok: #4a7a54;
  --focus: #2f6478;

  --serif: 'Source Serif 4', Georgia, 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --sans: 'Source Sans 3', system-ui, 'Hiragino Sans', 'Yu Gothic UI', 'Noto Sans JP', sans-serif;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-border: 0 0 0 1px rgb(22 28 30 / 0.08), 0 1px 2px rgb(22 28 30 / 0.04), 0 4px 12px rgb(22 28 30 / 0.04);
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-page: #121617;
    --bg-surface: #191f21;
    --bg-subtle: #1f2628;
    --text: #e8ecea;
    --text-secondary: #a4aeae;
    --border: #34403f;
    --border-subtle: #263032;
    --border-strong: #4a5859;
    --accent-subtle: #1a2f38;
    --accent: #3a7a90;
    --accent-hover: #4a8ba1;
    --accent-text: #8fbccb;
    --err: #e08a7c;
    --err-subtle: #3a211d;
    --ok: #8cba95;
    --focus: #8fbccb;
    --shadow-border: 0 0 0 1px rgb(255 255 255 / 0.08), 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 12px rgb(0 0 0 / 0.2);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
}

:lang(ja) body,
html:lang(ja) body {
  line-height: 1.8;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 600;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  line-height: 1.15;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--accent-text);
  text-underline-offset: 0.18em;
}

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

.tnum {
  font-variant-numeric: tabular-nums;
}

.container {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.narrow {
  max-width: 38rem;
}

/* ── Header / footer ───────────────────────────────────────── */

.site-header {
  padding-block: 1rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.125rem;
}

.brand img {
  border-radius: 999px;
}

.lang-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
}

.lang-switch button {
  min-height: 2.25rem;
  padding: 0 0.875rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  touch-action: manipulation;
}

.lang-switch button[aria-pressed='true'] {
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-weight: 600;
}

.site-footer {
  margin-top: auto;
  padding-block: 2rem calc(2rem + env(safe-area-inset-bottom));
  font-size: 0.875rem;
  color: var(--text-secondary);
}

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

/* ── Intro ─────────────────────────────────────────────────── */

main {
  padding-block: clamp(1.5rem, 5vw, 4rem) 2rem;
}

#intro {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.release {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-weight: 600;
}

.countdown:not(:empty) {
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent-text);
  font-size: 0.875rem;
}

/* ── Card + form ───────────────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-border);
  padding: clamp(1.25rem, 4vw, 2rem);
}

form {
  display: grid;
  gap: 1.25rem;
}

.field {
  display: grid;
  gap: 0.375rem;
}

.field label {
  font-weight: 600;
}

.field-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: -0.25rem;
}

input[type='text'],
input[type='email'],
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-surface);
  color: var(--text);
  font: inherit;
  font-size: max(1rem, 16px); /* no zoom-on-focus on iOS */
  touch-action: manipulation;
}

select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 55%, calc(100% - 0.9rem) 55%;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

input:hover,
select:hover {
  border-color: var(--text-secondary);
}

[aria-invalid='true'] {
  border-color: var(--err) !important;
}

.field-error,
.form-error {
  color: var(--err);
  font-size: 0.875rem;
  font-weight: 600;
}

.form-error {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--err-subtle);
}

.purpose {
  padding: 0.875rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9375rem;
}

.check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: start;
}

.check input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
  touch-action: manipulation;
}

.check + .field-error {
  margin-top: -0.75rem;
  padding-left: 2rem;
}

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

.turnstile:empty {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms var(--ease-out), background-color 120ms var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-strong);
  color: var(--accent-text);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--accent-hover);
  }
  .btn-secondary:hover {
    background: var(--bg-subtle);
  }
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* ── Done ──────────────────────────────────────────────────── */

.done {
  display: grid;
  gap: 1rem;
  justify-items: start;
  animation: fade 200ms var(--ease-out);
}

.done:focus {
  outline: none;
}

.done .position {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.375rem;
  line-height: 1.3;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .done {
    animation-name: fade-only;
  }
  @keyframes fade-only {
    from {
      opacity: 0;
    }
  }
  .btn {
    transition: none;
  }
  .btn:active {
    transform: none;
  }
}

/* ── Privacy page ──────────────────────────────────────────── */

.prose {
  display: grid;
  gap: 1rem;
  max-width: 65ch;
}

.prose h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin-top: 1rem;
}

.prose ul {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.375rem;
}

.prose .meta {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.table-wrap {
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

[hidden] {
  display: none !important;
}

.back {
  margin-top: 2rem;
}

.nowrap {
  white-space: nowrap;
}

/* Japanese headings: break between words, never inside a katakana run. */
:lang(ja) h1,
:lang(ja) h2 {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* The logo mark is dark ink; give it a washi-white disc on dark pages. */
@media (prefers-color-scheme: dark) {
  .brand img {
    background: #f8f9f8;
  }
}

a.brand {
  color: inherit;
  text-decoration: none;
}

/* ── Early access additions ────────────────────────────────── */

.promises {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.375rem;
}

.promises li {
  position: relative;
  padding-left: 1.5rem;
}

.promises li::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 0.55em;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--accent);
}

fieldset.interests {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

fieldset.interests legend {
  padding: 0;
  font-weight: 600;
}

.interest-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.5rem 1rem;
  margin-top: 0.25rem;
}

.interest-list label {
  font-weight: 400;
}
