/*
 * Aboard account pages (sign in, sign up, forgotten password).
 *
 * Only loaded by layouts/auth.html.erb. Every rule is scoped under .ab-auth
 * (the page wrapper) or .ab-auth-page (the body of the auth layout), so it
 * cannot affect any other page even if it is loaded there.
 */
.ab-auth-page,
.ab-auth {
  --green-dark: #112e29;
  --green-deep: #1e403b;
  --teal: #41756d;
  --teal-light: #9fc4be;
  --cream: #f4ecd6;
  --sage: #e2eae5;
  --card: #faf8f3;
  --ink: #15191a;
  --ink-soft: #4a5153;
  --error: #b5432e;
  --error-fg: #8a2c1c;
  --error-bg: #f6e3da;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

.ab-auth,
.ab-auth * { box-sizing: border-box; }

body.ab-auth-page {
  margin: 0;
  background: var(--sage);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Colours of the form half. Change these to restyle it. */
.ab-auth {
  --panel-bg: var(--sage);
  --panel-fg: var(--ink);
  --panel-soft: var(--ink-soft);
  --field-bg: var(--card);
  --field-border: rgba(17, 46, 41, 0.18);
  --focus: var(--teal);
  --link: var(--teal);
  --primary-bg: var(--green-dark);
  --primary-fg: var(--cream);
  --primary-hover: var(--green-deep);
  --secondary-border: rgba(17, 46, 41, 0.3);
  --secondary-hover: var(--green-dark);
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--panel-bg);
  font-family: var(--sans);
}

.ab-auth a { color: inherit; text-decoration: none; }
.ab-auth :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Photo half: the photo under two dark green layers (one tints, one darkens). */
.ab-auth .visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 4vw, 56px);
  overflow: hidden;
  isolation: isolate;
  color: var(--cream);
  background: var(--green-dark);
}

.ab-auth .visual-photo {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 50%;
}

.ab-auth .visual::before,
.ab-auth .visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--green-dark);
  opacity: 0.6;
}

.ab-auth .visual::before { mix-blend-mode: color; }

.ab-auth .logo img { display: block; width: auto; height: 32px; }

.ab-auth .headline {
  max-width: 11em;
  margin: 0;
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(2.4rem, 4vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.025em;
}

.ab-auth .headline em { font-style: normal; color: var(--teal-light); }

/* Form half */
.ab-auth .panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 6vw, 96px) clamp(24px, 5vw, 80px);
  background: var(--panel-bg);
  color: var(--panel-fg);
}

.ab-auth .form-wrap { width: 100%; max-width: 400px; }

.ab-auth h1 {
  margin: 0 0 clamp(28px, 4vh, 40px);
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(2.4rem, 3.4vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.ab-auth form { display: flex; flex-direction: column; gap: 20px; margin: 0; }

.ab-auth .field { display: flex; flex-direction: column; gap: 8px; }

.ab-auth .field-label { font-size: 0.88rem; font-weight: 500; color: var(--panel-soft); }

.ab-auth input:not([type="checkbox"]) {
  width: 100%;
  margin: 0;
  padding: 13px 14px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--panel-fg);
  font: 400 1rem var(--sans);
  box-shadow: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ab-auth input:not([type="checkbox"]):focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(65, 117, 109, 0.22);
}

.ab-auth .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.92rem;
}

.ab-auth .check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }

.ab-auth input[type="checkbox"] {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary-bg);
}

.ab-auth .text-link {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  text-decoration-color: rgba(65, 117, 109, 0.45);
}

.ab-auth .text-link:hover { text-decoration-color: currentColor; }

.ab-auth .actions { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

.ab-auth .btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 15px 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 0.95rem var(--sans);
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
}

.ab-auth .btn-primary { background: var(--primary-bg); color: var(--primary-fg); }
.ab-auth .btn-primary:hover { background: var(--primary-hover); }
.ab-auth .btn-secondary { border-color: var(--secondary-border); background: transparent; color: var(--panel-fg); }
.ab-auth .btn-secondary:hover { border-color: var(--secondary-hover); }

/* Disabled submit (e.g. registration until the privacy box is ticked). */
.ab-auth .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ab-auth .btn-primary:disabled:hover { background: var(--primary-bg); }

/* Error and notice messages above the form (validation errors, wrong password, e-mail sent). */
.ab-auth .alert {
  margin: 0 0 24px;
  padding: 14px 16px;
  border-left: 3px solid var(--error);
  border-radius: 4px;
  background: var(--error-bg);
  color: var(--error-fg);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ab-auth .alert ul { margin: 6px 0 0; padding-left: 18px; }
.ab-auth .alert-notice { border-left-color: var(--teal); background: rgba(65, 117, 109, 0.08); color: var(--green-deep); }

/* Tablet and phone: the photo becomes a short band on top, the form below. */
@media (max-width: 900px) {
  .ab-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ab-auth .visual { min-height: 240px; padding: calc(20px + env(safe-area-inset-top, 0px)) 16px 24px; }
  .ab-auth .logo img { height: 26px; }
  .ab-auth .headline { font-size: clamp(2rem, 8vw, 2.6rem); }
  .ab-auth .panel { align-items: flex-start; padding: 40px 16px calc(48px + env(safe-area-inset-bottom, 0px)); }
}
