/* ==========================================================
   AKYCONNECT — Login page
   Palette taken from the APC logo: green, white, sky blue, red
   ========================================================== */

:root {
  --green: #2f9e57;
  --green-deep: #17703b;
  --green-ink: #0e2e1c;
  --blue: #4fb6e4;
  --red: #e32636;
  --red-deep: #c11a29;
  --white: #ffffff;
  --paper: #f7faf8;
  --line: #d9e3dc;
  --muted: #55665c;
  --danger-bg: #fdecee;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius: 10px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--green-ink);
  background: var(--white);
}

img { display: block; max-width: 100%; }

a { color: inherit; }

/* ---------- Layout ---------- */

.login {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Brand panel ---------- */

.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: #8e9aa3; /* matches the photo sky while it loads */
}

.brand__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}

.brand__shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(14, 46, 28, 0.35) 0%, rgba(14, 46, 28, 0) 28%),
    linear-gradient(to top, rgba(14, 46, 28, 0.78) 0%, rgba(14, 46, 28, 0) 42%);
  pointer-events: none;
}

.brand__party {
  position: absolute;
  top: clamp(1rem, 3vw, 2rem);
  left: clamp(1rem, 3vw, 2rem);
  display: block;
  width: clamp(56px, 6vw, 84px);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--white);
}

.brand__party img { width: 100%; height: auto; }

.brand__name {
  position: relative;
  margin: 0;
  padding: 0 clamp(1.25rem, 4vw, 3rem) 1.25rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  color: var(--white);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.4);
}

/* Red base band echoes the red "APC" strip of the party logo */
.brand__base {
  position: relative;
  padding: clamp(1rem, 2.4vw, 1.75rem) clamp(1.25rem, 4vw, 3rem);
  background: var(--red);
  color: var(--white);
}

.brand__wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4.6vw, 3.75rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.brand__tagline {
  margin: 0.5rem 0 0;
  font-size: clamp(0.875rem, 1.2vw, 1rem);
  font-weight: 500;
  opacity: 0.95;
}

/* ---------- Sign-in panel ---------- */

.panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1.25rem, 4vw, 3rem);
  background: var(--paper);
}

.panel__inner {
  width: 100%;
  max-width: 26rem;
}

.tricolor {
  display: flex;
  width: 4.5rem;
  height: 6px;
  margin-bottom: 1.5rem;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line);
}

.tricolor span { flex: 1; }
.tricolor span:nth-child(1) { background: var(--green); }
.tricolor span:nth-child(2) { background: var(--white); }
.tricolor span:nth-child(3) { background: var(--blue); }

.panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.1;
}

.panel__lead {
  margin: 0.5rem 0 1.5rem;
  color: var(--muted);
}

/* ---------- Role switch ---------- */

.roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 1.5rem;
  background: #e8efea;
  border-radius: calc(var(--radius) + 4px);
}

.roles__btn {
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.roles__btn:hover { color: var(--green-ink); }

.roles__btn.is-active {
  background: var(--white);
  color: var(--green-deep);
  box-shadow: 0 1px 3px rgba(14, 46, 28, 0.18);
}

/* ---------- Form ---------- */

.form { display: grid; gap: 1.125rem; }

.field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font: inherit;
  color: var(--green-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: #8a9a90; }

.field input:hover { border-color: #b6c6bb; }

.field input:focus {
  outline: none;
  border-color: var(--green-deep);
  box-shadow: 0 0 0 3px rgba(47, 158, 87, 0.25);
}

.field input[aria-invalid="true"] { border-color: var(--red); }

.field__hint {
  margin: 0.375rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.field__password { position: relative; }

.field__password input { padding-right: 4.5rem; }

.field__toggle {
  position: absolute;
  top: 50%;
  right: 0.375rem;
  transform: translateY(-50%);
  min-height: 36px;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--green-deep);
  cursor: pointer;
}

.field__toggle:hover { background: #e8efea; }

.form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 0.9375rem;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--green-deep);
}

.link {
  font-weight: 600;
  color: var(--green-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.link:hover { text-decoration-thickness: 2px; }

.submit {
  min-height: 52px;
  padding: 0.75rem 1.25rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--green-deep);
  font: inherit;
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--white);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.submit:hover { background: #125c31; }
.submit:active { transform: translateY(1px); }

.submit:disabled {
  background: #7fa890;
  cursor: progress;
}

.alert {
  padding: 0.75rem 0.875rem;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: var(--danger-bg);
  font-size: 0.9375rem;
  color: #7a1119;
}

.alert[hidden] { display: none; }

/* ---------- Secondary links ---------- */

.panel__alt {
  display: grid;
  gap: 0.375rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
  color: var(--muted);
}

.panel__alt p { margin: 0; }

.panel__foot {
  margin: 1.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Sponsor Badge ---------- */

.sponsor-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  background: rgba(14, 46, 28, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(6px);
  width: fit-content;
}

.sponsor-badge strong {
  color: #ffdd44;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 0.875rem;
}

.sponsor-badge--dark {
  background: rgba(23, 112, 59, 0.08);
  border-color: var(--green-deep);
  color: var(--green-ink);
  box-shadow: none;
}

.sponsor-badge--dark strong {
  color: var(--green-deep);
}

/* ---------- Keyboard focus ---------- */

.roles__btn:focus-visible,
.submit:focus-visible,
.field__toggle:focus-visible,
.link:focus-visible,
.check input:focus-visible,
.brand__party:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- Tablet and mobile: photo becomes a header banner ---------- */

@media (max-width: 900px) {
  .login {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .brand {
    min-height: 320px;
    height: 42vh;
    max-height: 440px;
  }

  .brand__photo {
    object-position: center 12%;
  }

  .brand__shade {
    background:
      linear-gradient(to bottom, rgba(14, 46, 28, 0.5) 0%, rgba(14, 46, 28, 0) 35%),
      linear-gradient(to top, rgba(14, 46, 28, 0.85) 0%, rgba(14, 46, 28, 0.2) 60%);
  }

  .brand__name {
    display: block;
    position: relative;
    z-index: 2;
    padding: 0 1.25rem 0.75rem;
    font-size: clamp(1.125rem, 4vw, 1.5rem);
    line-height: 1.25;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
  }

  .brand__base {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    padding: 1rem 1.25rem;
  }

  .brand__wordmark {
    font-size: clamp(1.75rem, 6.5vw, 2.5rem);
  }

  .brand__tagline {
    margin-top: 0.2rem;
    font-size: 0.875rem;
  }

  .panel {
    align-items: flex-start;
    padding: 2rem 1.25rem 3rem;
  }

  .panel__inner {
    max-width: 32rem;
  }
}

@media (max-width: 480px) {
  .brand {
    min-height: 290px;
    height: 38vh;
  }

  .brand__party {
    top: 0.875rem;
    left: 0.875rem;
    width: 52px;
  }

  .brand__base {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
  }

  .form__row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

/* Short landscape screens: keep the form reachable */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .brand { min-height: 220px; height: 48vh; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}