@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,500;9..144,600;9..144,700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #16223c;
  --ink-deep: #0e1729;
  --paper: #f4ecda;
  --paper-dim: #e8dfc8;
  --brass: #b4893f;
  --brass-bright: #d9ab5c;
  --err: #8a2c2c;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--ink-deep);
  font-family: 'IBM Plex Mono', monospace;
  overflow-x: hidden;
}

.login-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  max-width: 1180px;
  margin: auto;
  min-height: 100vh;
  box-shadow: 0 40px 120px rgba(0,0,0,0.55);
}

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .brand-panel { min-height: 280px; }
}

/* ---------- Brand panel (left, ink) ---------- */

.brand-panel {
  position: relative;
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-deep) 100%);
  color: var(--paper);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 3.5rem;
}

.brand-panel::before {
  /* ruled ledger lines */
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 47px,
    rgba(244,236,218,0.07) 48px
  );
  pointer-events: none;
}

.brand-panel::after {
  /* paper grain */
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

.brand-panel__content {
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: rise 0.9s cubic-bezier(.2,.8,.2,1) 0.15s forwards;
}

.brand-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  color: var(--brass-bright);
  text-transform: uppercase;
  border-top: 1px solid var(--brass);
  border-bottom: 1px solid var(--brass);
  padding: 0.45em 0;
}

.brand-numeral {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-style: italic;
  font-size: clamp(5rem, 13vw, 9rem);
  line-height: 0.85;
  margin: 0.3em 0 0;
  color: var(--paper);
  text-shadow: 0 0 60px rgba(217,171,92,0.25);
}

.brand-title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.7rem;
  margin: 0.2em 0 0.4em;
  color: var(--paper);
}

.brand-sub {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(244,236,218,0.6);
  letter-spacing: 0.04em;
}

.brand-seal {
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 220px;
  height: 220px;
  border: 1.5px solid rgba(180,137,63,0.45);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: fadeIn 1s ease 0.6s forwards;
}

.brand-seal::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(180,137,63,0.35);
  border-radius: 50%;
}

.brand-seal span {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--brass-bright);
  transform: rotate(-18deg);
  text-align: center;
  width: 70%;
}

/* ---------- Form panel (right, paper) ---------- */

.form-panel {
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  position: relative;
}

.ledger-form {
  width: 100%;
  max-width: 360px;
  opacity: 0;
  animation: rise 0.9s cubic-bezier(.2,.8,.2,1) 0.35s forwards;
}

.ledger-form h2 {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--ink);
  margin: 0 0 0.3rem;
}

.ledger-form .form-hint {
  margin: 0 0 2rem;
  font-size: 0.8rem;
  color: #6b6250;
}

.field {
  display: block;
  margin-bottom: 1.6rem;
}

.field span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a7f65;
  margin-bottom: 0.5rem;
}

.field input {
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--paper-dim);
  background: transparent;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.05rem;
  color: var(--ink);
  padding: 0.4rem 0.1rem;
  outline: none;
  transition: border-color 0.25s ease;
}

.field input:focus {
  border-bottom-color: var(--brass);
}

.field input::placeholder { color: #b3a98d; }

.submit-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 2.4rem;
}

button.stamp {
  position: relative;
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.85rem 1.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

button.stamp:hover { background: var(--ink-deep); }
button.stamp:active { transform: scale(0.94); }

.form-error {
  background: rgba(138,44,44,0.08);
  border-left: 3px solid var(--err);
  color: var(--err);
  font-size: 0.82rem;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1.6rem;
  animation: shake 0.4s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@media (prefers-color-scheme: dark) {
  .form-panel { background: #efe6d1; }
}
