/* ============================================================
   GaijinCall — landing page
   Palette is deliberately indigo-forward, not red-forward: red
   appears exactly twice, styled as an actual hanko (seal) mark,
   never as a general UI accent. Three type roles: Shippori Mincho
   for display, Zen Kaku Gothic New for body/UI, JetBrains Mono for
   data (the "ticket", form labels, footer meta).
   ============================================================ */

:root {
  --paper: #f2ede0;
  --paper-dim: #e9e2d1;
  --ink: #1a2b3d;
  --ink-deep: #0f1c28;
  --ink-soft: #5c6b7a;
  --seal: #c1432a;
  --seal-deep: #9c3320;

  --display: "Shippori Mincho", serif;
  --body: "Zen Kaku Gothic New", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

a { color: inherit; }

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

h1, h2 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink-deep);
  margin: 0;
}

h2 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem);
  line-height: 1.3;
}

p { margin: 0.9em 0 0; max-width: 62ch; }

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 10px;
  padding: 20px clamp(20px, 5vw, 64px);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--ink-deep);
}

.seal {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--seal);
  display: inline-block;
  transform: scale(0);
  animation: stamp 0.5s cubic-bezier(.2, 1.6, .4, 1) 0.3s forwards;
}

@keyframes stamp {
  0% { transform: scale(2.2); opacity: 0; }
  60% { transform: scale(0.85); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.header-cta {
  font-family: var(--mono);
  font-size: 0.82rem;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang-select {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-soft);
  padding: 2px 2px 4px;
  cursor: pointer;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(40px, 8vw, 96px) clamp(20px, 5vw, 64px) clamp(64px, 10vw, 120px);
}

.hero-kanji {
  position: absolute;
  top: -6vw;
  right: -4vw;
  font-family: var(--display);
  font-size: min(46vw, 640px);
  line-height: 1;
  color: var(--ink);
  opacity: 0.045;
  pointer-events: none;
  user-select: none;
}

.hero-vertical {
  position: absolute;
  top: clamp(90px, 14vw, 160px);
  right: clamp(28px, 6vw, 88px);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.35em;
  color: var(--ink-soft);
}

.hero-content { position: relative; max-width: 620px; }

.hero h1 {
  font-size: clamp(2.1rem, 1.5rem + 3vw, 3.4rem);
  line-height: 1.22;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--ink);
  max-width: 54ch;
}

/* ---------- signup form (shared: hero + footer CTA) ---------- */

.signup-form {
  display: flex;
  gap: 10px;
  margin-top: 2rem;
  max-width: 460px;
  flex-wrap: wrap;
}

.signup-input {
  flex: 1 1 220px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 13px 15px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
}

.signup-input::placeholder { color: var(--ink-soft); }

.signup-button {
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 22px;
  border: 1px solid var(--ink-deep);
  border-radius: 3px;
  background: var(--ink-deep);
  color: var(--paper);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.1s ease;
}

.signup-button:hover { background: var(--ink); }
.signup-button:active { transform: translateY(1px); }

.signup-button:disabled { opacity: 0.6; cursor: default; }

.signup-note {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 10px;
}

.signup-note[data-state="success"] { color: var(--seal-deep); }
.signup-note[data-state="error"] { color: var(--seal-deep); }

/* ---------- generic section scaffolding ---------- */

.section {
  padding: clamp(56px, 9vw, 108px) clamp(20px, 5vw, 64px);
  border-top: 1px solid var(--paper-dim);
}

.section-text h2 + p { margin-top: 0.7em; }
.section-text p { color: var(--ink-soft); }

/* ---------- how it works ---------- */

.how-it-works {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}

.ticket {
  background: var(--paper);
  border-top: 2px dashed var(--ink-soft);
  border-bottom: 2px dashed var(--ink-soft);
  padding: 8px 0;
}

.ticket-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.ticket-row:last-child { border-bottom: none; }

.ticket-label {
  color: var(--ink-soft);
  flex: 0 0 auto;
  white-space: nowrap;
}

.ticket-label span[lang="ja"] { color: var(--ink); }

.ticket-value {
  text-align: right;
  color: var(--ink-deep);
}

/* ---------- live + summary ---------- */

.live-summary {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
}

.live-summary-text h2:not(:first-child) { margin-top: 2.2rem; }

.live-demo {
  background: var(--ink-deep);
  border-radius: 6px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--paper);
  align-self: flex-start;
  margin-bottom: 4px;
}

.live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--seal);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.bubble {
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 10px 13px;
  border-radius: 8px;
  max-width: 88%;
  color: var(--paper);
}

.bubble-en {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 0.73rem;
  color: #b9c3cc;
}

.bubble-agent {
  background: #24384c;
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.bubble-them {
  background: #1a2b3d;
  align-self: flex-end;
  border: 1px solid #33475c;
  border-bottom-right-radius: 2px;
}

.summary-card {
  margin-top: 1.6rem;
  border: 1px solid var(--paper-dim);
  border-radius: 4px;
  padding: 4px 18px;
}

.summary-row {
  padding: 13px 0;
  border-bottom: 1px solid var(--paper-dim);
  font-size: 0.92rem;
}

.summary-row:last-child { border-bottom: none; }

.summary-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

/* ---------- who it's for ---------- */

.who-for h2 { max-width: 20ch; }

.who-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  max-width: 640px;
}

.who-list li {
  padding: 22px 0;
  border-top: 1px solid var(--paper-dim);
  font-size: 1rem;
  color: var(--ink);
}

.who-list li:last-child { border-bottom: 1px solid var(--paper-dim); }

/* ---------- final signup section ---------- */

.signup-section { position: relative; max-width: 640px; }

.stamp-mark {
  width: 52px;
  height: 52px;
  border: 2px solid var(--seal);
  border-radius: 50%;
  margin-bottom: 22px;
  transform: rotate(-8deg);
  position: relative;
}

.stamp-mark::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--seal);
  opacity: 0.9;
}

/* ---------- footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  padding: 32px clamp(20px, 5vw, 64px) 48px;
  border-top: 1px solid var(--paper-dim);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.wordmark.small { font-size: 0.95rem; }
.seal.small { animation: none; transform: scale(1); }

.footer-taglines {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-tagline { font-family: var(--mono); font-size: 0.8rem; }
.footer-tagline-translated { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-soft); }

.footer-copyright {
  font-family: var(--mono);
  font-size: 0.78rem;
  margin-left: auto;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .how-it-works,
  .live-summary {
    grid-template-columns: 1fr;
  }

  .hero-vertical { display: none; }

  .hero-kanji {
    font-size: 70vw;
    top: -10vw;
    right: -18vw;
    opacity: 0.05;
  }

  .footer-copyright { margin-left: 0; }
}

@media (max-width: 480px) {
  /* Once the header wraps, let the actions group span the full second row
     instead of staying squeezed against the right edge under the wordmark. */
  .header-actions { width: 100%; justify-content: space-between; }

  .signup-form { flex-direction: column; }
  /* flex-basis follows the main axis, which flips to vertical in column
     mode — without this override, the input's "220px" basis becomes a
     220px *height* instead of a width, rendering a huge square box. */
  .signup-input { flex: 0 0 auto; width: 100%; }
  .signup-button { width: 100%; }
  .ticket-row { flex-direction: column; gap: 4px; }
  .ticket-value { text-align: left; }
}
