*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette pulled from the Barangay Lomboy seal (ring, sun, crab, water) instead of a generic teal/red pair */
  --ink:        #142A20;
  --navy:       #17335C;
  --navy-dark:  #0B1D36;
  --gold:       #E4A930;
  --gold-dark:  #C68B1E;
  --terracotta: #C1442D;
  --cream:      #FBF1DA;
  --cream-line: #E4D3A6;
  --teal:       #2B6E74;
  --underline:  #8A7F66;

  --radius-sm:  10px;
  --radius:     14px;
  --radius-lg:  24px;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 48px;

  --ease: cubic-bezier(.4,0,.2,1);
}

html, body { height: 100%; font-family: 'DM Sans', sans-serif; }

body { min-height: 100vh; overflow-x: hidden; }

/* Edge-to-edge 50/50 split: photo on the left, plain cream panel on the
   right — no floating card, no border-radius, no drop shadow. */
.split-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Left: full-bleed photo panel */
.split-left {
  position: relative;
  flex: 1 1 50%;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  background-image: url('assets/login-bg.jpg');
  background-size: cover;
  background-position: center;
}

.split-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(11, 29, 54, 0.88) 0%,
    rgba(15, 41, 74, 0.74) 40%,
    rgba(23, 51, 92, 0.48) 72%,
    rgba(228, 169, 48, 0.16) 100%
  );
}

.split-left::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: .32;
  mix-blend-mode: soft-light;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cg fill='none' stroke='%23E4A930' stroke-width='1'%3E%3Cpath d='M-20 40 Q60 10 140 40 T300 40 T460 40'/%3E%3Cpath d='M-20 100 Q60 70 140 100 T300 100 T460 100' opacity='.7'/%3E%3Cpath d='M-20 160 Q60 130 140 160 T300 160 T460 160' opacity='.5'/%3E%3Cpath d='M-20 220 Q60 190 140 220 T300 220 T460 220' opacity='.7'/%3E%3Cpath d='M-20 280 Q60 250 140 280 T300 280 T460 280'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 320px 320px;
}

.left-brand {
  position: relative;
  z-index: 2;
  color: #fff;
  max-width: 460px;
  padding: var(--sp-9);
  animation: rise-in .7s var(--ease) both;
}

.left-brand .tagline {
  display: inline-block;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid rgba(228, 169, 48, .35);
}

.left-brand h2 {
  font-family: 'Poppins', serif;
  font-size: clamp(38px, 4.2vw, 58px);
  line-height: 1.12;
  color: #fff;
  margin-bottom: var(--sp-5);
}

.left-brand p {
  font-size: 16px;
  color: rgba(255,255,255,.68);
  line-height: 1.7;
  max-width: 380px;
}

/* Right: plain cream panel, no card container */
.split-right {
  flex: 1 1 50%;
  min-width: 0;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
}

.auth-panel {
  width: 100%;
  max-width: 380px;
  animation: rise-in .7s var(--ease) .12s both;
}

/* Header */
.card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--sp-6);
}

.logo-box {
  width: 112px; height: 112px;
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gold);
  box-shadow: 0 10px 26px rgba(23,51,92,.2);
}

.logo-box img { width: 100%; height: 100%; object-fit: contain; }

.card-header h1 {
  font-family: 'Poppins', serif;
  font-size: 32px;
  color: var(--ink);
  margin-bottom: var(--sp-1);
  font-weight: 700;
  letter-spacing: -.01em;
}

.card-header p {
  font-size: 14px;
  color: #6b5d43;
}

/* Form panels sit side by side in a horizontal track; switching
   between login/signup slides the track instead of collapsing it
   vertically. The outer forms-collapse still does the old grid-row
   trick, but now only for the "form area disappears entirely" case
   (once the success message takes over after signup). */
.forms-collapse {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows .35s var(--ease), opacity .3s ease;
  opacity: 1;
}

.forms-collapse.hidden {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.forms-collapse-inner { overflow: hidden; min-height: 0; }

.panel-viewport {
  overflow: hidden;
  /* Height is frozen at the taller of the two panels (see script.js) —
     not re-measured on every switch — so switching login/signup never
     changes the card's total height, which is what was moving the
     logo/heading above it as the page re-centered. */
}

.panel-track {
  display: flex;
  align-items: flex-start;
  width: 200%;
  transition: transform .45s var(--ease);
}

.panel-track.show-signup { transform: translateX(-50%); }

.panel { flex: 0 0 50%; min-width: 0; }

.panel-body { padding: 2px; }

/* Fields — underline style: no box, no fill, just a bottom rule.
   The label sits right above the line and doubles as the placeholder,
   so the inputs themselves carry no placeholder text. */
.field { margin-bottom: var(--sp-5); }

.field label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--underline);
  border-radius: 0;
  padding: 6px 2px 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .2s;
}

.field input:hover,
.field input:focus {
  border-bottom-color: var(--gold-dark);
}

.field input::placeholder { color: transparent; }

/* Kill the browser's forced white/yellow autofill fill — paint the
   huge inset shadow the same color as the page instead, so an
   autofilled field still reads as just a line. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus,
.field input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--cream) inset;
  box-shadow: 0 0 0 1000px var(--cream) inset;
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  transition: background-color 9999s ease-in-out 0s;
}

.field input:autofill {
  box-shadow: 0 0 0 1000px var(--cream) inset;
  -webkit-text-fill-color: var(--ink);
}

/* Primary action — one clear button per panel; signup is now a text
   link, not a second full-strength button competing with login */
.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 999px;
  font-family: 'Poppins', serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--gold);
  color: var(--navy-dark);
  margin-top: var(--sp-3);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s;
}

.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(228,169,48,.35); background: var(--gold-dark); }
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.switch-row {
  text-align: center;
  margin-top: var(--sp-5);
  font-size: 14px;
  color: #6b5d43;
}

.switch-row a, .back-link a {
  color: var(--teal);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.switch-row a:hover, .back-link a:hover { text-decoration: underline; }

.back-link { text-align: center; margin-top: var(--sp-5); font-size: 14px; color: #6b5d43; }

/* Focus visibility for keyboard users */
.btn-primary:focus-visible,
.switch-row a:focus-visible,
.back-link a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* Error message */
.err-msg {
  display: none;
  background: #FBEAE5;
  border: 1px solid rgba(193, 68, 45, .35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #8A2F1E;
  margin-bottom: var(--sp-5);
  animation: shake-in .35s var(--ease);
}

/* Success overlay */
.success-overlay {
  display: none;
  text-align: center;
  padding: 16px 0 8px;
}

.success-overlay .check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: #d1fae5;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--sp-4);
  animation: pop-in .4s var(--ease) both;
}

.success-overlay .check svg path,
.success-overlay .check svg polyline {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: draw-check .3s .25s var(--ease) forwards;
}

.success-overlay h3 {
  font-family: 'Poppins', serif;
  font-size: 20px;
  color: var(--navy);
  margin-bottom: var(--sp-2);
}

.success-overlay p {
  font-size: 13px;
  color: #6b5d43;
  line-height: 1.6;
  margin-bottom: var(--sp-5);
}

/* Motion — one orchestrated entrance, plus small moments that answer
   the user's own actions (submit fails, submit succeeds) */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake-in {
  0%   { opacity: 0; transform: translateX(0); }
  30%  { opacity: 1; transform: translateX(-4px); }
  60%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Responsive */
@media (max-width: 900px) {
  .split-left { display: none; }
  .split-right { flex: 1 1 100%; padding: 1.5rem; }
}

/* Tablet portrait (iPad Pro 12.9" ~1024px, iPad Air 10.9" ~820px is
   already covered above) — trim the left copy a little so it doesn't
   crowd the form column. */
@media (min-width: 901px) and (max-width: 1100px) {
  .left-brand { padding: var(--sp-7); max-width: 360px; }
  .left-brand h2 { font-size: clamp(30px, 4vw, 44px); }
  .logo-box { width: 96px; height: 96px; }
  .card-header h1 { font-size: 28px; }
}

@media (max-width: 480px) {
  .split-right { padding: var(--sp-6) var(--sp-5); }
  .logo-box { width: 92px; height: 92px; }
  .card-header h1 { font-size: 28px; }
  .btn-primary { font-size: 15px; }
}

/* Very small phones (iPhone SE, older Android, ~320–360px) */
@media (max-width: 360px) {
  .split-right { padding: var(--sp-5) var(--sp-4); }
  .logo-box { width: 80px; height: 80px; }
  .card-header h1 { font-size: 24px; }
  .btn-primary { font-size: 14px; padding: 12px 8px; }
}