/* =====================================================
   trial.css — 無料体験申し込みフォーム (/trial/)
   -----------------------------------------------------
   1. Page scope        — hide the circular LINE CTAs
   2. .trial-hero       — compact editorial header on cream
   3. .trial-user       — LINE-verified identity card
   4. .trial-form-card  — application form (fields, chips, states)
   5. .trial-thanks     — post-submit success panel
   6. .trial-error-hero — error/guide states (mirrors 404 rhythm)
   ===================================================== */

/* =====================
   1. PAGE SCOPE
   The visitor is already mid-funnel (they arrived from the official
   LINE account), so the sticky "book via LINE" bar would cover the
   submit button only to restart the same journey — hide it here.
   ===================== */
.page-trial .mobile-sticky-cta { display: none; }
/* visibility, not display: .header-cta carries the `margin-left:auto` that
   anchors the ≤1023px header (layout.css), so removing the box slides the
   hamburger up against the logo. visibility:hidden already takes the link
   out of hit-testing and the tab order, and layout.css's own
   `display:none` at ≤520px still wins there. */
.page-trial .header-cta { visibility: hidden; }

/* =====================
   2. TRIAL HERO — compact cream header (legal/404 hero rhythm)
   ===================== */
.trial-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: calc(var(--header-h) + var(--sp-xl)) 0 var(--sp-lg);
  background-color: var(--bg-cream);
  text-align: center;
}
/* Same mobile step the content heroes take (legal.css, about.css, course.css) */
@media (max-width: 767px) {
  .trial-hero { padding-top: calc(var(--header-h) + var(--sp-lg)); }
}
/* Subtle dotted gold texture (same recipe as legal-hero) */
.trial-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(245, 158, 11, 0.10) 1px, transparent 1.2px);
  background-size: 28px 28px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.trial-hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--w-narrow);
}


.trial-hero-title {
  font-size: var(--fs-display);
  font-weight: var(--fw-head);
  line-height: var(--lh-display);
  text-wrap: balance;
  word-break: auto-phrase;
  margin-bottom: 1rem;
}
.trial-hero-title-em {
  font-style: normal;
  color: var(--primary);
}
.trial-hero-sub {
  font-size: var(--fs-body);
  line-height: 2;
  color: var(--text-light);
}
.trial-hero-break { display: none; }
@media (max-width: 560px) {
  .trial-hero-break { display: inline; }
}

/* =====================
   3. IDENTITY CARD — replaces the old "本人ですか?" overlay
   ===================== */
.trial-section {
  background: var(--bg-cream);
  padding-top: var(--sp-md);
}
.trial-container { max-width: var(--w-narrow); }   /* hero, form and states share one column */

.trial-user {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  background: var(--bg-white);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin-bottom: var(--sp-md);
}
.trial-user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-warm);
}
.trial-user-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-warm);
  color: var(--text-muted);
}
.trial-user-body { min-width: 0; }
.trial-user-name {
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.trial-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-caption);
  font-weight: 700;
  color: #00B900;            /* LINE brand green — matches the old badge */
}
.trial-user-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00B900;
  flex-shrink: 0;
}
.trial-user-note {
  flex-basis: 100%;
  font-size: var(--fs-caption);
  line-height: 1.7;
  color: var(--text-muted);
}

/* =====================
   4. FORM CARD
   ===================== */
.trial-form-card {
  background: var(--bg-white);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.trial-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem 1.25rem;
}
.trial-field { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .trial-field-half { grid-column: span 1; }
}

/* Section headings — the legacy form's wizard steps become in-page groups */
.trial-form-heading {
  grid-column: 1 / -1;
  font-size: var(--fs-h3);
  font-weight: 800;
  line-height: 1.5;
  padding: 0.35rem 0 0.6rem;
  border-bottom: 2px solid var(--border-warm);
  position: relative;
}
.trial-form-heading::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 3.5rem;
  height: 2px;
  background: var(--primary);
}
.trial-form-heading:not(:first-child) { margin-top: var(--sp-md); }

.trial-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-body-md);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
/* 必須 / 任意 chips */
.trial-req,
.trial-opt {
  flex-shrink: 0;
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  line-height: 1;
  padding: 0.28em 0.7em;
  border-radius: var(--r-full);
}
.trial-req { background: var(--accent); color: #fff; }
.trial-opt { background: var(--bg-warm); color: var(--text-muted); border: 1px solid var(--border-warm); }

.trial-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--font-ja);
  font-size: var(--fs-body-lg);            /* ≥16px stops iOS zoom-on-focus */
  line-height: 1.5;
  color: var(--text-main);
  background: var(--bg-white);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-sm);
  padding: 0.7rem 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;   /* keeps iOS date inputs inside the card */
  min-height: 48px;
}
.trial-input::placeholder { color: var(--text-muted); opacity: 0.8; }
.trial-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.16);
}
.trial-input[aria-invalid="true"] {
  border-color: #E5484D;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.12);
}
.trial-textarea {
  resize: vertical;
  min-height: 8.5em;
}

/* Selects share .trial-input chrome + a custom chevron */
.trial-select-wrap { position: relative; }
.trial-select { padding-right: 2.4rem; cursor: pointer; }
.trial-select-wrap:has([data-locked]) { opacity: 0.45; cursor: not-allowed; }
.trial-select-wrap::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

/* ---- Pill choice groups (course, school type, start times) ----
   Radio/checkbox stays in the a11y tree; the label is the visible pill. */
.trial-choice { border: 0; padding: 0; margin: 0; min-width: 0; }
.trial-choice legend { padding: 0; }
.trial-choice-group {
  display: grid;
  grid-template-columns: repeat(var(--choice-cols, 2), minmax(0, 1fr));
  gap: 0.6rem;
}
/* Cap at three, not two: the 学校区分 group has exactly three options and
   folding it to two leaves a dangling half-width empty cell. */
@media (max-width: 480px) {
  .trial-choice-group { grid-template-columns: repeat(min(var(--choice-cols, 2), 3), minmax(0, 1fr)); }
}
.trial-pill { display: block; }
.trial-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.trial-pill label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.55rem 0.6rem;
  background: var(--bg-white);
  border: 1.5px solid var(--border-warm);
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition),
              color var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.trial-pill label:hover { border-color: var(--primary); }
.trial-pill input:focus-visible + label {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.16);
}
.trial-pill input:checked + label {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 174, 239, 0.25);
}

/* ---- Schedule blocks (第1〜第3希望: date + start-time multi-select) ---- */
.trial-schedules-note { margin: -0.25rem 0 0.9rem; }
.trial-schedule {
  border: 1px solid var(--border-warm);
  border-radius: var(--r-md);
  background: var(--bg-warm);
  padding: 1.1rem 1.15rem 1.25rem;
  margin: 0 0 1rem;
  min-width: 0;
}
.trial-schedule:last-child { margin-bottom: 0; }
.trial-schedule-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-body);
  font-weight: 800;
  color: var(--primary-dark);
  padding: 0 0.25rem;
}
.trial-sublabel {
  display: block;
  font-size: var(--fs-body-sm);
  font-weight: 700;
  color: var(--text-light);
  margin: 0.6rem 0 0.4rem;
}
.trial-schedule .trial-input { background: var(--bg-white); }
.trial-times-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}
@media (max-width: 480px) {
  .trial-times-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.trial-pill-time label {
  min-height: 42px;
  padding: 0.4rem 0.3rem;
  font-size: var(--fs-body-md);
  font-weight: 700;
  font-feature-settings: 'tnum';
}

.trial-field-note {
  margin-top: 0.4rem;
  font-size: var(--fs-caption);
  line-height: 1.7;
  color: var(--text-muted);
}
.trial-field-error {
  margin-top: 0.4rem;
  font-size: var(--fs-caption);
  font-weight: 700;
  color: #E5484D;
}

/* Consent row */
.trial-field-consent {
  margin-top: 0.25rem;
  text-align: center;
}
.trial-consent-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: var(--fs-body-md);
  line-height: 1.7;
  text-align: left;
}
.trial-consent-box {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.2rem;
  accent-color: var(--primary);
  cursor: pointer;
}
.trial-consent-text {
  word-break: auto-phrase;   /* 「同 / 意」「しま / す」 were splitting on phones */
  text-wrap: pretty;
}
.trial-consent-text a {
  white-space: nowrap;   /* each document name wraps whole */
  color: var(--ink-sky);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.trial-consent-text .trial-req { margin-left: 0.4rem; }

/* Honeypot — moved far off-screen, not display:none, so naive bots
   still believe it is a fillable field. */
.trial-hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Submit */
.trial-submit {
  margin-top: var(--sp-md);
  position: relative;
}
.trial-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}
/* Busy spinner sits left of the label while the request is in flight */
.trial-submit.is-busy .trial-submit-label::before {
  content: '';
  display: inline-block;
  vertical-align: -0.18em;
  width: 1em;
  height: 1em;
  margin-right: 0.55em;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: trial-spin 0.8s linear infinite;
}
@keyframes trial-spin { to { transform: rotate(360deg); } }

.trial-form-note {
  margin-top: 0.9rem;
  text-align: center;
  font-size: var(--fs-caption);
  color: var(--text-muted);
}

/* Server/network error banner at the top of the card */
.trial-alert {
  background: #FDECEC;
  border: 1px solid #F5B5B8;
  color: #C0353A;
  font-size: var(--fs-body-md);
  font-weight: 700;
  line-height: 1.8;
  border-radius: var(--r-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: var(--sp-md);
}
/* The way round a failed send (js/trial.js shows it): the site resets
   link underlines, so put it back — in the banner it must read as a link. */
.trial-alert-line {
  margin-top: 0.5rem;
}
.trial-alert-line a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* =====================
   5. THANKS PANEL
   ===================== */
.trial-thanks {
  background: var(--bg-white);
  border: 1px solid var(--border-warm);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
  outline: none;
}
.trial-thanks-icon {
  display: inline-flex;
  color: var(--primary);
  margin-bottom: 1.25rem;
}
.trial-thanks-title {
  font-size: var(--fs-h1);
  font-weight: var(--fw-head);
  line-height: var(--lh-h1);
  text-wrap: balance;
  word-break: auto-phrase;
  margin-bottom: 1rem;
}
.trial-thanks-text {
  font-size: var(--fs-body);
  line-height: 2.1;
  color: var(--text-light);
}
.trial-thanks-text em {
  font-style: normal;
  font-weight: 700;
  color: var(--primary);
}
.trial-thanks-redirect {
  margin-top: 1.75rem;
  font-size: var(--fs-body-md);
  font-weight: 700;
  color: var(--text-muted);
}
/* min-width reserves room so the line does not jitter as 5→4→3; aligning
   right keeps that slack on the left instead of opening a 0.42em gap
   between the numeral and 「秒後」. */
.trial-thanks-count {
  display: inline-block;
  min-width: 1.4em;
  text-align: right;
  font-size: var(--fs-h2);
  font-weight: 800;
  color: var(--primary);
}
.trial-thanks-fallback {
  margin-top: 1.75rem;
}
.trial-thanks-fallback-text {
  font-size: var(--fs-body-md);
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

/* =====================
   6. ERROR / GUIDE HERO
   The same object as 404.php's apology hero, so it now carries the same
   numbers: 680px measure, the same title clamp, 1rem/2 desc capped at
   34rem, content-driven height with symmetric padding, and the wash that
   fades the dot texture out at the footer seam. Previously the two had
   drifted on all five.
   ===================== */
.trial-error-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: calc(var(--header-h) + var(--sp-xl)) 0 var(--sp-xl);
  background-color: var(--bg-cream);
  text-align: center;
}
@media (max-width: 767px) {
  .trial-error-hero { padding: calc(var(--header-h) + var(--sp-lg)) 0 var(--sp-lg); }
}
.trial-error-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(245, 158, 11, 0.10) 1px, transparent 1.2px);
  background-size: 28px 28px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
/* Paints over ::before, so the dots fade out toward the footer seam */
.trial-error-hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 35%;
  background: linear-gradient(180deg, transparent 0%, var(--bg-cream) 100%);
  pointer-events: none;
  z-index: 0;
}
.trial-error-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--w-narrow);
  margin-inline: auto;
}
.trial-error-mark {
  display: flex;
  justify-content: center;
  color: var(--primary);
  opacity: 0.45;
  margin-bottom: 1.5rem;
}
.trial-error-title {
  font-size: var(--fs-display);
  font-weight: var(--fw-head);
  line-height: var(--lh-display);
  text-wrap: balance;
  word-break: auto-phrase;
  margin-bottom: 1.25rem;
}
.trial-error-desc {
  max-width: 36rem;
  margin: 0 auto 2.25rem;
  font-size: var(--fs-body-lg);
  line-height: 2;
  color: var(--text-light);
}
.trial-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
@media (max-width: 560px) {
  .trial-error-actions { flex-direction: column; }
  .trial-error-actions .btn { width: 100%; }
}
