/* Form page (form.html) — spec/form.md
   Desktop default (Figma "NEXSHIFT desktop form page", 1440) + mobile @media (max-width: 767px)
   (Figma "NEXSHIFT mobile landing form", 390). Prefix: .formpage- / .form-
   Note: in Figma strokes are "inner alignment", so box sizes include the border; paddings below
   are therefore Figma padding minus the 1px border. */

.formpage {
  --form-navy: #052b5b;
  --form-slate: #64748b;
  --form-orange: #ff6b2c;
  --form-bg: #f5f7fa;
  --form-border: #c8d9ee;
  --form-badge-bg: #fff1e8;
  --form-footer-bg: #0f2a4a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--form-bg);
  font-family: var(--font-jp);
  color: var(--form-navy);
}

.formpage * {
  margin: 0;
}

/* ---------- Main section (Form section: pad 84/88/112/88, gap 48) ---------- */
.formpage-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding: 84px 88px 112px;
  background: var(--form-bg);
}

.formpage-heading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 1264px;
  text-align: center;
}

.formpage-title {
  font-weight: 700;
  font-size: 46px;
  line-height: 62px; /* 135% */
  letter-spacing: -0.005em;
  color: var(--form-navy);
}

.formpage-lead {
  font-weight: 400;
  font-size: 24px;
  line-height: 46px; /* 190% */
  color: var(--form-slate);
}

/* ---------- Card ---------- */
.form-card {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 687px;
  max-width: 100%;
  padding: 31px; /* 32 - 1px border */
  border: 1px solid var(--form-bg);
  border-radius: 24px;
  background: var(--form-bg);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.0784);
}

.form-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-intro__title {
  font-weight: 700;
  font-size: 24px;
  line-height: 29px;
  color: var(--form-navy);
}

.form-intro__note {
  font-weight: 400;
  font-size: 12px;
  line-height: 22px;
  color: var(--form-slate);
}

.form-notice {
  display: none; /* mobile only */
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.form-row > .form-field {
  flex: 1 1 0;
}

/* label row: label + required badge (+ optional note) */
.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 16px;
  font-weight: 700;
  font-size: 11px;
  line-height: var(--lh-text);
  color: var(--form-navy);
  white-space: nowrap;
}

.form-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 16px;
  padding: 1px 5px;
  border: 1px solid var(--form-orange);
  border-radius: 999px;
  background: var(--form-badge-bg);
  color: var(--form-orange);
  font-weight: 700;
  font-size: 10px;
  line-height: var(--lh-text);
}

.form-label__note {
  margin-left: 8px; /* label row gap 6 + 8 = 14 from badge */
  font-weight: 400;
  font-size: 12px;
  line-height: 22px;
  color: #000;
  white-space: nowrap;
}

.form-input {
  display: block;
  width: 100%;
  height: 56px;
  padding: 0 15px;
  border: 1px solid var(--form-border);
  border-radius: 12px;
  background: #fff;
  color: var(--form-navy);
  font-family: var(--font-jp);
  font-weight: 400;
  font-size: 14px;
  line-height: var(--lh-text);
  outline: none;
  box-shadow: none;
}

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

.form-input:focus {
  border-color: #1a56a0;
  box-shadow: 0 0 0 3px rgba(26, 86, 160, 0.15);
}

/* Select (desktop dropdown) */
.form-select {
  position: relative;
}

.form-select select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  color: var(--form-slate);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.form-select select option {
  color: var(--form-navy);
}

/* Mobile-only option list (radio cards); hidden on desktop */
.form-options {
  display: none;
  border: 0;
  padding: 0;
  min-width: 0;
}

.form-option {
  position: relative;
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 13px;
  border: 1px solid #b8d0ec;
  border-radius: 10px;
  background: #fff;
  font-weight: 400;
  font-size: 13px;
  line-height: var(--lh-text);
  color: var(--form-navy);
  cursor: pointer;
}

.form-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.form-option:has(input:checked) {
  border-color: var(--form-orange);
  background: var(--form-badge-bg);
}

.form-option:has(input:focus-visible) {
  box-shadow: 0 0 0 3px rgba(26, 86, 160, 0.2);
}

.form-hint {
  font-weight: 400;
  font-size: 11px;
  line-height: 13px;
  color: var(--form-slate);
}

/* Consent */
.form-consents {
  display: flex;
  gap: 16px;
}

.form-consent {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 400;
  font-size: 12px;
  line-height: 19px; /* 160% */
  color: var(--form-navy);
  cursor: pointer;
}

.form-check {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1px solid var(--form-border);
  border-radius: 6px;
  background: #fff center / 14px 14px no-repeat;
  cursor: pointer;
}

.form-check:checked {
  border-color: var(--form-orange);
  background-color: var(--form-orange);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}

.form-check:focus-visible {
  box-shadow: 0 0 0 3px rgba(26, 86, 160, 0.2);
}

.form-consent__req {
  font-weight: 700;
  color: var(--form-orange);
}

.form-consent__badge {
  display: none; /* mobile uses the pill badge */
}

.form-consent__link {
  color: inherit;
  text-decoration: none;
}

.form-consent__link:hover {
  text-decoration: underline;
}

/* Submit */
.form-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  height: 60px;
  padding: 0 28px;
  border: 0;
  border-radius: 10px;
  background: var(--form-orange);
  color: #fff;
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 15px;
  line-height: var(--lh-text);
  box-shadow: 0 8px 24px rgba(255, 107, 44, 0.251);
  cursor: pointer;
}

.form-submit:hover {
  filter: brightness(1.05);
}

.form-submit:focus-visible {
  outline: 3px solid rgba(26, 86, 160, 0.4);
  outline-offset: 2px;
}

.form-submit__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.form-reassurance {
  font-weight: 400;
  font-size: 10px;
  line-height: 12px;
  color: #4a6b8a;
}

.form-reassurance__sp {
  display: none;
}

/* Tablet / small desktop: keep the design but let it shrink */
@media (max-width: 1100px) and (min-width: 768px) {
  .formpage-main {
    padding-left: 40px;
    padding-right: 40px;
  }
}

/* ================= Mobile (frame 390 wide) ================= */
@media (max-width: 767px) {
  .formpage-main {
    align-items: stretch;
    gap: 24px;
    padding: 24px 20px 32px;
  }

  .formpage-heading {
    gap: 10px;
    max-width: none;
    text-align: left;
  }

  .formpage-title {
    text-align: center;
  }

  .formpage-title {
    font-size: 28px;
    line-height: 38px;
    letter-spacing: -0.005em;
  }

  .formpage-lead {
    font-size: 14px;
    line-height: 27px;
  }

  .formpage-lead br {
    display: none;
  }

  .form-card {
    width: 100%;
    gap: 24px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .form-intro,
  .form-hint {
    display: none;
  }

  .form-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px;
    border: 1px solid #b8d0ec;
    border-radius: 12px;
    background: #fff;
  }

  .form-notice__icon {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #fff2eb;
  }

  .form-notice__text {
    font-weight: 400;
    font-size: 11px;
    line-height: 18px;
    color: var(--form-slate);
  }

  .form-fields {
    gap: 16px;
  }

  .form-row {
    gap: 12px;
  }

  .form-row > .form-field {
    flex: 0 1 159px;
  }

  .form-field {
    gap: 8px;
  }

  .form-label {
    height: 15px;
  }

  .form-badge {
    height: 15px;
    font-size: 9px;
  }

  .form-label__note {
    margin-left: 9px;
  }

  .form-input {
    height: 52px;
    padding: 0 13px;
    border-color: #b8d0ec;
    border-radius: 10px;
    font-size: 13px;
  }

  .form-input::placeholder {
    color: #94a3b8;
  }

  .form-field--status {
    gap: 24px;
  }

  .form-select {
    display: none;
  }

  .form-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .form-consents {
    flex-direction: column;
    gap: 12px;
  }

  .form-consent {
    flex: none;
    gap: 12px;
    font-size: 11px;
    line-height: 18px;
    color: var(--form-slate);
  }

  .form-consent__text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    flex: 1;
    min-width: 0;
  }

  .form-check {
    border-color: #b8d0ec;
  }

  .form-consent__req {
    display: none;
  }

  .form-consent__badge {
    display: inline-flex;
    height: 15px;
    margin-right: 6px;
    font-size: 9px;
  }

  .form-consent__link {
    font-weight: 700;
    color: var(--form-navy);
  }

  .form-consent__tail {
    margin-left: 3px; /* Figma has a space between the bold link and "に同意する" */
  }

  .form-submit {
    box-shadow: 0 10px 30px rgba(5, 43, 91, 0.0784);
  }

  .form-reassurance__pc {
    display: none;
  }

  .form-reassurance__sp {
    display: inline;
  }

  .form-reassurance {
    text-align: center;
    color: var(--form-slate);
  }

}

/* very narrow phones (< 390): let the birth-date label row wrap instead of squeezing */
@media (max-width: 389px) {
  .form-label {
    height: auto;
    min-height: 15px;
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .form-label__note {
    margin-left: 0;
  }
}

/* Validation errors (client-side and Moodle errors look the same: red field + message) */
.form-field.is-invalid .form-input,
.form-field.is-invalid .form-option {
  border-color: #e5484d;
}

.form-consent.is-invalid .form-check {
  border-color: #e5484d;
}

.form-error {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: #e5484d;
}

.form-error[hidden] {
  display: none;
}

.form-consents + .form-error,
.form-error + .form-error {
  margin-top: -8px;
}

.form-error--general {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e5484d;
  border-radius: 10px;
  background: #fff5f5;
  font-size: 12px;
}

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

.form-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* v2: the requirement notice is mobile only. The age note sits next to the 生年月日 label on every size
   (a separate mobile-only copy was removed: it duplicated the label note, SP check 2026-10-27). */
@media (min-width: 768px) {
  .form-notice {
    display: none;
  }
}
