/* ==========================================================================
   Temia — Authentication module (sign in, register, forgot password)
   --------------------------------------------------------------------------
   Everything is scoped under .ta-auth and prefixed "ta-" so it cannot leak
   into, or be affected by, the rest of the product UI.

   Contents
   1. Tokens (mapped 1:1 to the Figma paint styles)
   2. Base / reset (scoped)
   3. Icons, links, logo
   4. Split layout: brand panel + form panel
   5. Card
   6. Form controls: field, input, message, checkbox, button, divider
   7. Card variants: status tile, summary
   8. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
.ta-auth {
  /* Secondary (navy) */
  --ta-navy-100: #0d306f;
  --ta-navy-80: #3d598c;
  --ta-navy-40: #9eacc5;
  --ta-navy-20: #cfd6e2;
  --ta-navy-10: #e7eaf1;
  --ta-navy-5: #f3f5f8;
  /* Primary (blue) */
  --ta-blue-100: #0b4cc5;
  --ta-blue-80: #3c70d1;
  --ta-blue-10: #e7edf9;
  /* Tertiary */
  --ta-gold-100: #f4b000;
  /* Shade */
  --ta-shade-80: #3f4347;
  --ta-shade-60: #6f7275;
  --ta-shade-40: #9fa1a3;
  --ta-shade-20: #cfd0d1;
  --ta-shade-10: #e7e7e8;
  --ta-white: #ffffff;
  /* Indicate */
  --ta-red: #cb2b00;
  --ta-green: #008368;

  --ta-font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ta-radius: 4px;
  --ta-card-width: 420px;
}

/* 2. Base ------------------------------------------------------------------ */
body.ta-auth-page {
  margin: 0;
  background: #f3f5f8;
}

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

.ta-auth {
  font-family: var(--ta-font);
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  color: var(--ta-shade-80);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* :where() keeps this reset at zero specificity so component rules always win */
:where(.ta-auth) :where(h1, h2, p, ul, dl, dd) {
  margin: 0;
  padding: 0;
}

.ta-auth ul {
  list-style: none;
}

.ta-auth [hidden] {
  display: none !important;
}

.ta-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 3. Icons, links, logo ---------------------------------------------------- */
.ta-icon {
  flex: none;
  display: block;
  width: 16px;
  height: 16px;
  overflow: visible;
}

.ta-link {
  color: var(--ta-blue-80);
  text-decoration: none;
  cursor: pointer;
  border-radius: 2px;
}

.ta-link:hover {
  text-decoration: underline;
}

.ta-link:focus-visible,
.ta-btn:focus-visible,
.ta-input__toggle:focus-visible {
  outline: 2px solid var(--ta-blue-80);
  outline-offset: 2px;
}

button.ta-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
}

.ta-logo {
  display: block;
  width: 92px;
  height: 24px;
}

/* 4. Split layout ---------------------------------------------------------- */
.ta-split {
  display: grid;
  grid-template-columns: 44% minmax(0, 1fr); /* 845 / 1920 */
  min-height: 100vh;
  background: var(--ta-navy-5);
}

.ta-brand {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 48px 56px;
  background: var(--ta-navy-100);
  color: var(--ta-white);
}

.ta-brand__head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ta-brand__tagline,
.ta-brand__foot {
  color: var(--ta-navy-40);
}

.ta-brand__foot {
  font-size: 12px;
  line-height: 18px;
}

.ta-brand__body {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.ta-brand__pitch {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
}

.ta-brand__title {
  font-size: 26px;
  line-height: 36px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--ta-white);
}

.ta-brand__text {
  font-size: 13px;
  line-height: 22px;
  color: var(--ta-navy-20);
}

.ta-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 460px;
}

.ta-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ta-feature__tile {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--ta-radius);
  background: rgba(255, 255, 255, 0.1);
  color: var(--ta-white);
}

.ta-feature__tile .ta-icon {
  width: 20px;
  height: 20px;
}

.ta-feature__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ta-feature__title {
  font-size: 13px;
  line-height: 20px;
  font-weight: 500;
  color: var(--ta-white);
}

.ta-feature__text {
  font-size: 12px;
  line-height: 18px;
  color: var(--ta-navy-20);
}

.ta-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 40px 24px;
}

/* 5. Card ------------------------------------------------------------------ */
.ta-card {
  width: 100%;
  max-width: var(--ta-card-width);
  padding: 31px 27px; /* 32 / 28 in Figma, minus the 1px inside border */
  background: var(--ta-white);
  border: 1px solid var(--ta-shade-10);
  border-radius: var(--ta-radius);
}

.ta-card__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 24px;
}

.ta-card__head--status {
  gap: 16px;
}

.ta-card__titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.ta-card__title {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  color: var(--ta-navy-100);
}

.ta-card__subtitle {
  font-size: 13px;
  line-height: 20px;
  color: var(--ta-shade-60);
  overflow-wrap: anywhere;
}

.ta-card__foot {
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--ta-shade-60);
}

.ta-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 4px 12px;
  border-radius: 48px;
  background: var(--ta-navy-10);
  color: var(--ta-navy-100);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ta-chip .ta-icon {
  width: 14px;
  height: 14px;
}

.ta-chip--associate {
  background: var(--ta-blue-10);
  color: var(--ta-blue-100);
}

/* 6. Form controls --------------------------------------------------------- */
.ta-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ta-form--compact {
  gap: 16px;
}

.ta-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ta-field__label {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ta-shade-80);
}

.ta-field__req {
  color: var(--ta-red);
}

.ta-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  margin-bottom: 4px;
  padding: 0 6px 0 12px;
  background: var(--ta-white);
  border: 1px solid var(--ta-shade-20);
  border-radius: var(--ta-radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ta-input:focus-within {
  border-color: var(--ta-navy-80);
  box-shadow: 0 0 0 3px rgba(61, 89, 140, 0.16);
}

.ta-input__control {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  line-height: 20px;
  color: var(--ta-shade-80);
}

.ta-input__control::placeholder {
  color: var(--ta-shade-40);
  opacity: 1;
}

/* The lead icon follows the input in the DOM so it can react to the input's
   state; "order" puts it back on the left. */
.ta-input__icon {
  order: -1;
  color: var(--ta-shade-40);
}

.ta-input__control:not(:placeholder-shown) ~ .ta-input__icon {
  color: var(--ta-shade-80);
}

.ta-input__toggle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--ta-radius);
  background: transparent;
  color: var(--ta-shade-80);
  cursor: pointer;
}

.ta-input__toggle:hover {
  background: var(--ta-navy-5);
}

.ta-input__toggle[aria-pressed="true"] {
  color: var(--ta-blue-80);
}

.ta-field.is-invalid .ta-input {
  border-color: var(--ta-red);
}

.ta-field.is-invalid .ta-input:focus-within {
  box-shadow: 0 0 0 3px rgba(203, 43, 0, 0.14);
}

/* Field / form message (error, helper, success) */
.ta-msg {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 18px;
  color: var(--ta-shade-60);
}

.ta-msg__icon {
  width: 14px;
  height: 14px;
  margin-top: 2px;
}

.ta-msg__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ta-msg--error {
  color: var(--ta-red);
}

.ta-msg--success {
  color: var(--ta-green);
}

.ta-msg--form {
  margin-top: 0;
}

/* Checkbox */
.ta-check {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ta-shade-80);
  cursor: pointer;
}

.ta-check--multiline {
  display: flex;
  line-height: 18px;
}

.ta-check--multiline .ta-check__box {
  margin-top: 1px;
}

.ta-check__input {
  position: absolute;
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ta-check__box {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--ta-white);
  border: 1px solid var(--ta-shade-20);
  border-radius: 3px;
  color: var(--ta-white);
}

.ta-check__box .ta-icon {
  width: 12px;
  height: 12px;
  visibility: hidden;
}

.ta-check__input:checked + .ta-check__box {
  background: var(--ta-navy-80);
  border-color: var(--ta-navy-80);
}

.ta-check__input:checked + .ta-check__box .ta-icon {
  visibility: visible;
}

.ta-check__input:focus-visible + .ta-check__box {
  outline: 2px solid var(--ta-blue-80);
  outline-offset: 2px;
}

.ta-check.is-invalid .ta-check__box {
  border-color: var(--ta-red);
}

.ta-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  line-height: 16px;
}

/* Buttons */
.ta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--ta-radius);
  font-family: inherit;
  font-size: 13px;
  line-height: 20px;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ta-btn--primary {
  background: var(--ta-navy-80);
  border-color: var(--ta-navy-80);
  color: var(--ta-white);
}

.ta-btn--primary:hover {
  background: var(--ta-navy-100);
  border-color: var(--ta-navy-100);
}

.ta-btn--secondary {
  background: var(--ta-white);
  border-color: var(--ta-shade-20);
  color: var(--ta-shade-80);
}

.ta-btn--secondary .ta-icon {
  color: var(--ta-shade-60);
}

.ta-btn--secondary:hover {
  background: var(--ta-navy-5);
}

.ta-btn[disabled],
.ta-btn[aria-busy="true"] {
  opacity: 0.65;
  cursor: progress;
}

/* "or" divider */
.ta-or {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ta-shade-40);
}

.ta-or::before,
.ta-or::after {
  content: "";
  flex: 1 1 0;
  height: 1px;
  background: var(--ta-shade-10);
}

/* 7. Card variants ---------------------------------------------------------- */
.ta-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0, 131, 104, 0.1);
  color: var(--ta-green);
}

.ta-status .ta-icon {
  width: 24px;
  height: 24px;
}

.ta-status--info {
  background: var(--ta-blue-10);
  color: var(--ta-blue-100);
}

.ta-status--error {
  background: rgba(203, 43, 0, 0.1);
  color: var(--ta-red);
}

.ta-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--ta-radius);
  background: var(--ta-navy-5);
  font-size: 12px;
  line-height: 18px;
}

.ta-summary__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ta-summary__key {
  flex: none;
  color: var(--ta-shade-60);
}

.ta-summary__value {
  min-width: 0;
  font-weight: 500;
  color: var(--ta-navy-100);
  text-align: right;
  overflow-wrap: anywhere;
}

/* 8. Responsive ------------------------------------------------------------ */

/* Laptop */
@media (max-width: 1280px) {
  .ta-brand {
    padding: 40px;
  }
}

/* Tablet: brand panel becomes a compact band above the form */
@media (max-width: 960px) {
  .ta-split {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .ta-brand {
    position: static;
    height: auto;
    min-height: 0;
    gap: 24px;
    padding: 28px 32px 32px;
  }

  .ta-brand__body {
    gap: 0;
  }

  .ta-brand__pitch {
    max-width: 560px;
  }

  .ta-features,
  .ta-brand__foot {
    display: none;
  }

  .ta-panel {
    align-items: flex-start;
    padding: 32px 24px 48px;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .ta-brand {
    gap: 16px;
    padding: 20px 20px 24px;
  }

  .ta-brand__title {
    font-size: 20px;
    line-height: 28px;
  }

  .ta-brand__title br {
    display: none;
  }

  .ta-brand__text {
    display: none;
  }

  .ta-panel {
    padding: 20px 16px 40px;
  }

  .ta-card {
    padding: 23px 19px;
  }

  /* 16px inputs stop iOS Safari zooming the page on focus */
  .ta-input__control {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .ta-options {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ta-auth * {
    transition: none !important;
  }
}

/* 9. Added for the app: self-hosted Poppins, language switch, Japanese type ---- */

/* Same files the rest of the app uses (no request leaves the server) */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-400-normal.woff2") format("woff2"),
       url("../assets/fonts/poppins-latin-400-normal.woff") format("woff");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-500-normal.woff2") format("woff2"),
       url("../assets/fonts/poppins-latin-500-normal.woff") format("woff");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-600-normal.woff2") format("woff2"),
       url("../assets/fonts/poppins-latin-600-normal.woff") format("woff");
}

/* Japanese text falls back to the system's Japanese fonts after Poppins */
html[lang="ja"] .ta-auth {
  --ta-font: "Poppins", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
}

/* EN / 日本語 switch, top right of the form panel */
.ta-panel {
  position: relative;
}

.ta-lang {
  position: absolute;
  top: 20px;
  right: 24px;
  display: inline-flex;
  overflow: hidden;
  background: var(--ta-white);
  border: 1px solid var(--ta-shade-20);
  border-radius: var(--ta-radius);
}

.ta-lang__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ta-lang__btn {
  padding: 4px 12px;
  font-size: 12px;
  line-height: 16px;
  color: var(--ta-shade-60);
  cursor: pointer;
  user-select: none;
}

.ta-lang__input:checked + .ta-lang__btn {
  background: var(--ta-navy-100);
  color: var(--ta-white);
}

.ta-lang__input:focus-visible + .ta-lang__btn {
  outline: 2px solid var(--ta-blue-80);
  outline-offset: -2px;
}

@media (max-width: 960px) {
  .ta-lang {
    top: 12px;
    right: 16px;
  }
}

/* On a narrow screen the brand panel is a band above the card: the switch sits in that band */
@media (max-width: 960px) {
  .ta-panel {
    position: static;
  }

  .ta-lang {
    top: 16px;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.35);
  }

  .ta-lang__btn {
    color: var(--ta-navy-20);
  }

  .ta-lang__input:checked + .ta-lang__btn {
    background: var(--ta-white);
    color: var(--ta-navy-100);
  }
}

/* 10. Register page: two small things the design does not cover ------------------ */

/* On a phone the two lines of a headline run together (the break is hidden). The space
   after the comma keeps the English words apart; Japanese has no space there. */
html[lang="ja"] .ta-auth .ta-sp {
  display: none;
}

/* A sentence whose word order differs by language is written once per language */
html[lang="ja"] .ta-auth .ta-en-only,
html:not([lang="ja"]) .ta-auth .ta-ja-only {
  display: none;
}
