/* ==========================================================================
   OrvaHR brand layer: Thai typography + auth (login / forgot / reset) pages.
   Loaded by index.html and the auth templates AFTER tailwind/global CSS.
   Everything is self-hosted (no fonts.googleapis.com): the app has to work
   offline and must not leak visitor IPs to third parties (PDPA).
   ========================================================================== */

/* --- IBM Plex Sans Thai (SIL OFL 1.1, see ../fonts/OFL.txt) -------------
   Only the Thai subset is shipped. unicode-range limits these faces to
   Thai code points, so Latin text keeps rendering in Inter (already
   self-hosted in cdn/googleapi) and the browser only downloads a face
   when a page actually contains Thai. */
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-400.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-500.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-600.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "IBM Plex Sans Thai";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-thai-700.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}

:root {
  /* Thai glyphs come from Plex Sans Thai (Thai-only unicode-range), every
     other character falls through to Inter, then to the platform UI font. */
  --orva-font-sans: "IBM Plex Sans Thai", "Inter", system-ui, -apple-system,
    "Segoe UI", Roboto, "Noto Sans Thai", "Leelawadee UI", Tahoma,
    "Helvetica Neue", Arial, sans-serif;
  --orva-gold-50: #fbf5ea;
  --orva-gold-300: #f0cf8e;
  --orva-gold-500: #c9a063;
  --orva-gold-600: #b8904f;
  --orva-gold-700: #8a6a3a;
  --orva-gold-text: #82612c; /* 5.68:1 on white */
  --orva-charcoal: #16161a;
  --orva-charcoal-2: #2a2a30;
  --orva-paper: #f8f6f2;
}

body,
.font-orva {
  font-family: var(--orva-font-sans);
}

/* Thai stacks tone marks and vowels above and below the x-height; the
   Latin-tuned 1.5 default clips them in tight boxes. Pages served in Thai
   get a roomier rhythm, and single-line truncated labels (overflow hidden)
   keep their marks. */
:lang(th) body {
  line-height: 1.65;
}
:lang(th) .truncate,
:lang(th) .oh-sidebar-label {
  line-height: 1.6;
}

/* ==========================================================================
   Auth pages
   ========================================================================== */
.orva-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  background: var(--orva-paper);
  color: var(--orva-charcoal);
}

/* Brand panel (charcoal, wide screens only) */
.orva-auth__brand {
  display: none;
  position: relative;
  overflow: hidden;
  flex: 0 0 44%;
  max-width: 640px;
  padding: 48px 56px;
  flex-direction: column;
  justify-content: space-between;
  color: #e7e5e1;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(201, 160, 99, 0.18) 0%, rgba(201, 160, 99, 0) 55%),
    radial-gradient(90% 70% at 100% 100%, rgba(240, 207, 142, 0.12) 0%, rgba(240, 207, 142, 0) 60%),
    linear-gradient(160deg, #1d1d22 0%, var(--orva-charcoal) 60%, #111114 100%);
}
.orva-auth__brand::after {
  /* Large, faint brand mark as a watermark. */
  content: "";
  position: absolute;
  right: -120px;
  bottom: -120px;
  width: 460px;
  height: 460px;
  background: var(--orva-mark-url) center / contain no-repeat;
  opacity: 0.07;
  pointer-events: none;
}
.orva-auth__brand-logo {
  width: 200px;
  height: auto;
}
.orva-auth__headline {
  position: relative;
  z-index: 1;
  max-width: 26rem;
}
.orva-auth__headline h2 {
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 600;
  color: #ffffff;
  margin: 0 0 1rem;
}
.orva-auth__headline h2 span {
  background: linear-gradient(90deg, var(--orva-gold-300), var(--orva-gold-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.orva-auth__headline p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #b5b3ad; /* 8.1:1 on the panel */
  margin: 0;
}
.orva-auth__brand-foot {
  position: relative;
  z-index: 1;
  font-size: 0.75rem;
  color: #8a8880; /* 4.8:1 */
}
.orva-auth__rule {
  display: block;
  width: 56px;
  height: 3px;
  margin-bottom: 1.25rem;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--orva-gold-300), var(--orva-gold-700));
}

/* Form side */
.orva-auth__main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(70% 50% at 100% 0%, rgba(201, 160, 99, 0.10) 0%, rgba(201, 160, 99, 0) 70%),
    var(--orva-paper);
}
.orva-auth__card {
  width: 100%;
  max-width: 420px;
  padding: 40px 36px;
  border: 1px solid #ece7dd;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(22, 22, 26, 0.04), 0 18px 48px -18px rgba(22, 22, 26, 0.18);
}
.orva-auth__card-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: 100%;
  margin: 0 auto 1.5rem;
}
.orva-auth__card-logo--icon {
  height: 64px;
}
.orva-auth__title {
  margin: 0 0 0.375rem;
  font-size: 1.5rem;
  line-height: 1.35;
  font-weight: 600;
  text-align: center;
  color: var(--orva-charcoal);
}
.orva-auth__subtitle {
  margin: 0 0 1.75rem;
  font-size: 0.875rem;
  line-height: 1.6;
  text-align: center;
  color: #5c5b61; /* 6.6:1 on white */
}
.orva-auth label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #3d3c42;
}
.orva-auth input[type="text"],
.orva-auth input[type="email"],
.orva-auth input[type="password"] {
  height: 46px;
  padding: 0 14px;
  border: 1px solid #dcd8d0;
  border-radius: 10px;
  background: #ffffff;
  font-size: 0.875rem;
  color: var(--orva-charcoal);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.orva-auth input::placeholder {
  color: #8f8d87;
  font-weight: 400;
}
.orva-auth input:focus,
.orva-auth input:focus-visible {
  outline: none;
  border-color: var(--auth-accent, var(--orva-gold-500));
  box-shadow: 0 0 0 3px var(--auth-ring, rgba(201, 160, 99, 0.28));
}
.orva-auth input[aria-invalid="true"] {
  border-color: #ef4444;
}
.orva-auth .oh-password-input--toggle {
  top: 50%;
  transform: translateY(-50%);
}
.orva-auth__link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--auth-link, var(--orva-gold-text));
  text-decoration: none;
}
.orva-auth__link:hover,
.orva-auth__link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.orva-auth__note {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  text-align: center;
  color: #5c5b61;
}

/* Primary auth button. Default (OrvaHR Gold or no theme): brand gold
   gradient with charcoal text, >= 6.1:1 at the darkest stop. Any other
   default theme sets --auth-btn-* to its own primary_600 + white. */
.orva-btn-primary {
  display: inline-flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 10px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  color: var(--auth-btn-fg, var(--orva-charcoal));
  background: var(--auth-btn-bg, linear-gradient(135deg, var(--orva-gold-300) 0%, var(--orva-gold-500) 55%, var(--orva-gold-600) 100%));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 8px 20px -10px rgba(138, 106, 58, 0.7);
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.05s ease;
}
.orva-btn-primary:hover {
  filter: brightness(1.04) saturate(1.05);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.35) inset, 0 12px 24px -10px rgba(138, 106, 58, 0.8);
}
.orva-btn-primary:active {
  transform: translateY(1px);
}
.orva-btn-primary:focus-visible {
  outline: 3px solid var(--orva-charcoal);
  outline-offset: 2px;
}
.orva-btn-primary img {
  width: 18px;
  height: 18px;
  /* sign.svg is drawn white; match the button text colour. */
  filter: var(--auth-btn-icon-filter, brightness(0) opacity(0.85));
}
.orva-btn-secondary {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

@media (min-width: 960px) {
  .orva-auth__brand {
    display: flex;
  }
  .orva-auth__card-logo--wordmark {
    display: none;
  }
}
@media (max-width: 480px) {
  .orva-auth__card {
    padding: 32px 22px;
    border-radius: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .orva-btn-primary,
  .orva-auth input {
    transition: none;
  }
}
