:root {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 8px;
  --form-width: min(440px, 100%);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Split layout */
.split {
  display: grid;
  grid-template-columns: 1.55fr minmax(380px, 480px);
  min-height: 100vh;
}

.split-visual {
  position: relative;
  background-color: var(--visual-fallback, #e8eef2);
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  animation: visual-in 1s var(--ease) both;
}

@keyframes visual-in {
  from { opacity: 0; transform: scale(1.03); }
  to { opacity: 1; transform: scale(1); }
}

.split-visual-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2.5rem;
  background: linear-gradient(
    180deg,
    transparent 45%,
    rgba(20, 28, 36, 0.45) 100%
  );
  color: #fff;
}

.visual-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 600;
  letter-spacing: var(--brand-tracking, -0.02em);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
  animation: brand-in 0.8s var(--ease) 0.15s both;
}

.visual-tagline {
  margin: 0.4rem 0 0;
  font-size: 1rem;
  opacity: 0.92;
  animation: brand-in 0.8s var(--ease) 0.28s both;
}

@keyframes brand-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.split-form {
  display: flex;
  align-items: stretch;
  background: #fff;
  border-left: 1px solid var(--line);
}

.form-inner {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 1.5rem 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: panel-in 0.65s var(--ease) 0.1s both;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.form-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}

.lang-switch {
  display: flex;
  gap: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lang-switch a {
  color: var(--muted);
  text-decoration: none;
}

.lang-switch a.is-active {
  color: var(--text);
  font-weight: 600;
}

.auth-header {
  margin-bottom: 1.25rem;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: var(--brand-tracking, -0.02em);
  line-height: 1.15;
  color: var(--brand-color, var(--text));
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-nav {
  display: flex;
  gap: 0.15rem;
  margin-bottom: 1.35rem;
  border-bottom: 1px solid var(--line);
}

.auth-nav a {
  flex: 1;
  padding: 0.7rem 0.35rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-nav a.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.auth-panel {
  flex: 1;
}

.form-title {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.form-intro {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input {
  width: 100%;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafbfc;
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field.is-hidden {
  display: none;
}

.form-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -0.25rem;
}

.muted-link {
  font-size: 0.82rem;
  color: var(--muted);
}

.btn-primary {
  margin-top: 0.35rem;
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  filter: brightness(1.04);
  box-shadow: 0 6px 18px var(--accent-soft);
}

.btn-primary:active {
  transform: translateY(1px);
}

.form-footer {
  margin: 1.15rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.channel-toggle {
  display: flex;
  gap: 0.5rem;
}

.chip {
  flex: 1;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: block;
  padding: 0.55rem 0.5rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.88rem;
  background: #fafbfc;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.chip input:checked + span {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.flash {
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  animation: flash-in 0.4s var(--ease) both;
}

@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.flash-success {
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
}

/* Home hub */
.hub {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0;
}

.hub h1 {
  margin: 0 0 0.5rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
}

.hub-intro {
  color: #5c6570;
  margin: 0 0 2rem;
}

.hub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.hub-list a {
  display: block;
  padding: 1.1rem 1.2rem;
  border: 1px solid #d5dbe3;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.85);
  transition: transform 0.2s var(--ease), border-color 0.2s ease;
}

.hub-list a:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

.hub-list strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 0.2rem;
}

.hub-list span {
  color: #5c6773;
  font-size: 0.92rem;
}

.hub-admin {
  margin-top: 2rem;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }

  .split-visual {
    min-height: 220px;
  }

  .split-visual-overlay {
    padding: 1.5rem;
  }

  .visual-brand {
    font-size: 1.6rem;
  }

  .split-form {
    border-left: 0;
  }

  .form-inner {
    padding: 1.25rem 1.25rem 2rem;
  }

  /* Brand on form side is redundant when visual shows it on mobile */
  .auth-header .brand {
    display: none;
  }
}

@media (min-width: 901px) {
  /* On desktop brand is dominant on the visual plane */
  .auth-header .brand {
    font-size: 1.35rem;
  }
}
