:root {
  color-scheme: light;
  --blush-50: #fff9fa;
  --blush-100: #fff1f4;
  --blush-200: #f9dfe5;
  --blush-300: #efc4ce;
  --rose: #b85e77;
  --rose-deep: #843c55;
  --forest: #315749;
  --ink: #3f3a38;
  --muted: #776d6b;
  --paper: #fffdf9;
  --gold: #b28a54;
  --line: rgba(132, 60, 85, 0.18);
  --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='paperNoise' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='4' seed='8' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paperNoise)' opacity='.7'/%3E%3C/svg%3E");
}

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

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--blush-100);
  color: var(--ink);
  font-family: "Manrope", Arial, sans-serif;
}

button {
  color: inherit;
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid rgba(184, 94, 119, 0.42);
  outline-offset: 4px;
}

.login-page {
  position: relative;
  display: grid;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

/* The illustration remains atmospheric; the invitation itself stays readable. */
.login-page::before {
  position: fixed;
  z-index: -3;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 241, 244, 0.28), rgba(255, 253, 249, 0.72)),
    url("./assets/fairytale-dove.png") center / cover no-repeat;
  content: "";
  filter: saturate(0.86) contrast(0.94);
  transform: scale(1.025);
}

.login-page::after {
  position: fixed;
  z-index: -2;
  inset: 0;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.7), transparent 28%),
    linear-gradient(180deg, rgba(255, 249, 250, 0.12), rgba(132, 60, 85, 0.08));
  content: "";
  pointer-events: none;
}

.login-header {
  position: absolute;
  z-index: 20;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  padding: 0 clamp(18px, 3vw, 42px);
  border-bottom: 1px solid rgba(132, 60, 85, 0.08);
  background: rgba(255, 249, 250, 0.72);
  box-shadow: 0 8px 28px rgba(93, 61, 66, 0.04);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.monogram,
.login-seal {
  display: grid;
  place-items: center;
  border: 1px solid rgba(178, 138, 84, 0.55);
  border-radius: 50%;
  color: var(--rose-deep);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 700;
}

.monogram {
  width: 40px;
  height: 40px;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.16rem;
  line-height: 1;
}

.brand-copy small,
.edition,
.eyebrow,
.issue-label,
.portrait-caption small,
.invitation-meta {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-copy small {
  color: var(--muted);
}

.edition {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--rose-deep);
}

.edition::before {
  width: 24px;
  height: 1px;
  background: var(--gold);
  content: "";
}

.login-shell {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100svh;
  padding: 102px 28px 34px;
}

.invitation-book {
  position: relative;
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(430px, 1.08fr);
  width: min(1080px, 100%);
  min-height: min(650px, calc(100svh - 136px));
  overflow: hidden;
  border: 1px solid rgba(178, 138, 84, 0.36);
  border-radius: 22px 18px 18px 22px;
  background-color: var(--paper);
  background-image: var(--paper-grain);
  background-size: 180px 180px;
  background-blend-mode: soft-light;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.9),
    0 20px 45px rgba(93, 61, 66, 0.15),
    0 46px 110px rgba(93, 61, 66, 0.2);
  isolation: isolate;
  animation: bookArrive 920ms cubic-bezier(0.2, 0.82, 0.2, 1) both;
}

.invitation-book::before {
  position: absolute;
  z-index: 8;
  inset: 8px;
  border: 1px solid rgba(178, 138, 84, 0.2);
  border-radius: 15px 11px 11px 15px;
  content: "";
  pointer-events: none;
}

.invitation-book::after {
  position: absolute;
  z-index: 9;
  inset: 0;
  background-image: var(--paper-grain);
  background-size: 180px 180px;
  content: "";
  mix-blend-mode: multiply;
  opacity: 0.045;
  pointer-events: none;
}

.book-spine {
  position: absolute;
  z-index: 11;
  top: 0;
  bottom: 0;
  left: 42.6%;
  width: 34px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(93, 61, 66, 0.09) 36%,
    rgba(255, 255, 255, 0.64) 52%,
    rgba(93, 61, 66, 0.06) 66%,
    transparent
  );
  pointer-events: none;
  transform: translateX(-50%);
}

.portrait-panel,
.login-copy {
  position: relative;
  min-width: 0;
}

.portrait-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 38px clamp(30px, 4vw, 54px) 34px;
  overflow: hidden;
  border-right: 1px solid rgba(132, 60, 85, 0.12);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.86), transparent 30%),
    linear-gradient(145deg, rgba(249, 223, 229, 0.84), rgba(255, 241, 244, 0.4));
}

.portrait-panel::before,
.portrait-panel::after {
  position: absolute;
  border: 1px solid rgba(184, 94, 119, 0.13);
  border-radius: 50%;
  content: "";
}

.portrait-panel::before {
  top: -120px;
  left: -135px;
  width: 280px;
  height: 280px;
}

.portrait-panel::after {
  right: -88px;
  bottom: -92px;
  width: 220px;
  height: 220px;
}

.issue-label {
  position: relative;
  z-index: 2;
  margin: 0;
  color: var(--rose-deep);
}

.login-portrait {
  position: relative;
  z-index: 2;
  align-self: center;
  width: min(310px, 88%);
  margin: 20px auto 18px;
  transform: rotate(-1.5deg);
}

.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  padding: 9px;
  background: rgba(255, 253, 249, 0.96);
  box-shadow:
    0 16px 34px rgba(93, 61, 66, 0.18),
    0 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.portrait-frame::after {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  content: "";
  pointer-events: none;
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 32% center;
  animation: portraitBreathe 9s ease-in-out infinite alternate;
}

.portrait-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 5px 0;
}

.portrait-caption span {
  color: var(--rose-deep);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.22rem;
  font-weight: 700;
}

.portrait-caption small {
  color: var(--muted);
  white-space: nowrap;
}

.portrait-note {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--forest);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1rem;
  font-style: italic;
}

.portrait-note::before {
  flex: 0 0 32px;
  height: 1px;
  background: rgba(49, 87, 73, 0.42);
  content: "";
}

.login-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 50px clamp(44px, 5vw, 74px) 44px;
}

.login-copy::before {
  position: absolute;
  top: 31px;
  right: 38px;
  color: rgba(178, 138, 84, 0.58);
  content: "✦";
  font-size: 1.1rem;
}

.eyebrow {
  margin: 0;
  color: var(--rose-deep);
}

h1 {
  max-width: 520px;
  margin: 15px 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3.4rem, 5.2vw, 5.25rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 0.86;
}

h1 span {
  display: block;
  color: var(--rose);
  font-style: italic;
}

.intro {
  max-width: 470px;
  margin: 22px 0 0;
  color: var(--muted);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.28rem;
  line-height: 1.42;
}

.invitation-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  color: var(--forest);
}

.invitation-meta span {
  color: var(--gold);
  font-size: 0.78rem;
}

.access-panel {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 0 16px;
  margin-top: 25px;
  padding: 19px 20px 18px;
  border: 1px solid rgba(178, 138, 84, 0.3);
  border-radius: 14px;
  background: rgba(255, 249, 250, 0.72);
  box-shadow: 0 12px 30px rgba(93, 61, 66, 0.07);
}

.access-panel::before {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(132, 60, 85, 0.08);
  border-radius: 10px;
  content: "";
  pointer-events: none;
}

.login-seal {
  position: relative;
  z-index: 2;
  grid-row: 1 / span 2;
  align-self: start;
  width: 58px;
  height: 58px;
  border-color: rgba(255, 253, 249, 0.54);
  background: var(--rose-deep);
  box-shadow:
    0 0 0 3px var(--rose-deep),
    0 0 0 4px rgba(178, 138, 84, 0.7),
    0 8px 18px rgba(132, 60, 85, 0.2);
  color: var(--paper);
  font-size: 0.92rem;
  overflow: hidden;
}

.login-seal::after {
  position: absolute;
  top: -20%;
  left: -75%;
  width: 45%;
  height: 140%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.52), transparent);
  content: "";
  transform: rotate(18deg);
  animation: sealGleam 5.8s ease-in-out infinite 1.2s;
}

.access-copy {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 3px;
  align-self: center;
}

.access-copy strong {
  color: var(--forest);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.17rem;
}

.access-copy small {
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.45;
}

.name-access-form {
  position: relative;
  z-index: 2;
  grid-column: 2;
  display: grid;
  gap: 7px;
  min-width: 0;
  margin-top: 14px;
}

.name-access-form label {
  color: var(--rose-deep);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.name-access-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.name-access-row input {
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(132, 60, 85, 0.24);
  border-radius: 9px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.9);
  font: 600 0.86rem/1 "Manrope", Arial, sans-serif;
  box-shadow: inset 0 1px 3px rgba(93, 61, 66, 0.05);
}

.name-access-row input::placeholder {
  color: rgba(119, 109, 107, 0.68);
  font-weight: 400;
}

.name-access-row input:focus {
  border-color: rgba(184, 94, 119, 0.62);
  outline: 3px solid rgba(184, 94, 119, 0.13);
  outline-offset: 1px;
}

.name-access-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid var(--rose-deep);
  border-radius: 9px;
  color: var(--paper);
  background: var(--rose-deep);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(132, 60, 85, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.name-access-row button:hover:not(:disabled) {
  box-shadow: 0 11px 24px rgba(132, 60, 85, 0.24);
  transform: translateY(-1px);
}

.name-access-row button:disabled,
.name-access-row input:disabled {
  cursor: wait;
  opacity: 0.62;
}

.login-status {
  position: relative;
  z-index: 2;
  grid-column: 2;
  min-height: 18px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.login-status:not(:empty)::before {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
  vertical-align: 1px;
  animation: statusPulse 1.3s ease-in-out infinite;
}

.login-status.is-error {
  color: #8d2f46;
}

.login-status.is-error::before {
  background: #8d2f46;
  animation: none;
}

.privacy {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 450px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.privacy-mark {
  position: relative;
  flex: 0 0 13px;
  width: 13px;
  height: 10px;
  margin-top: 3px;
  border: 1px solid var(--forest);
  border-radius: 2px;
}

.privacy-mark::before {
  position: absolute;
  bottom: 7px;
  left: 2px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--forest);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  content: "";
}

.petal-field {
  position: fixed;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.petal {
  position: absolute;
  top: -10vh;
  left: var(--left);
  width: var(--size);
  height: calc(var(--size) * 1.45);
  border-radius: 80% 12% 76% 18%;
  background: linear-gradient(145deg, rgba(255, 253, 249, 0.95), rgba(239, 196, 206, 0.88) 54%, rgba(184, 94, 119, 0.46));
  box-shadow: 0 2px 5px rgba(132, 60, 85, 0.1);
  opacity: 0;
  animation: petalFall var(--duration) linear infinite;
  animation-delay: var(--delay);
  will-change: transform, opacity;
}

.petal:nth-child(1) { --left: 7%; --size: 9px; --duration: 15s; --delay: -6s; --drift: 12vw; --turn: 520deg; }
.petal:nth-child(2) { --left: 17%; --size: 13px; --duration: 19s; --delay: -14s; --drift: -9vw; --turn: -610deg; }
.petal:nth-child(3) { --left: 29%; --size: 8px; --duration: 13s; --delay: -3s; --drift: 8vw; --turn: 480deg; }
.petal:nth-child(4) { --left: 41%; --size: 11px; --duration: 18s; --delay: -11s; --drift: -12vw; --turn: -560deg; }
.petal:nth-child(5) { --left: 54%; --size: 7px; --duration: 14s; --delay: -9s; --drift: 10vw; --turn: 680deg; }
.petal:nth-child(6) { --left: 66%; --size: 12px; --duration: 20s; --delay: -16s; --drift: -8vw; --turn: -520deg; }
.petal:nth-child(7) { --left: 78%; --size: 9px; --duration: 16s; --delay: -5s; --drift: 11vw; --turn: 580deg; }
.petal:nth-child(8) { --left: 89%; --size: 11px; --duration: 21s; --delay: -18s; --drift: -10vw; --turn: -680deg; }
.petal:nth-child(9) { --left: 96%; --size: 7px; --duration: 14s; --delay: -12s; --drift: -14vw; --turn: 510deg; }
.petal:nth-child(10) { --left: 35%; --size: 6px; --duration: 22s; --delay: -20s; --drift: 7vw; --turn: -460deg; }

@keyframes bookArrive {
  0% {
    opacity: 0;
    transform: translate3d(0, 28px, 0) rotateX(2.2deg) scale(0.975);
  }
  60% {
    opacity: 1;
    transform: translate3d(0, -3px, 0) rotateX(0deg) scale(1.002);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes portraitBreathe {
  from { transform: scale(1.001) translate3d(0, 0, 0); }
  to { transform: scale(1.035) translate3d(0, -4px, 0); }
}

@keyframes sealGleam {
  0%, 62%, 100% { left: -75%; opacity: 0; }
  70% { opacity: 0.72; }
  84% { left: 135%; opacity: 0; }
}

@keyframes statusPulse {
  0%, 100% { opacity: 0.34; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes petalFall {
  0% {
    opacity: 0;
    transform: translate3d(0, -12vh, 0) rotate(0deg) rotateX(0deg);
  }
  10% { opacity: 0.58; }
  45% { transform: translate3d(var(--drift), 44vh, 0) rotate(220deg) rotateX(140deg); }
  82% { opacity: 0.48; }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), 112vh, 0) rotate(var(--turn)) rotateX(310deg);
  }
}

@media (max-width: 900px) {
  .login-page {
    overflow: visible;
  }

  .login-page::before,
  .login-page::after,
  .petal-field {
    position: absolute;
  }

  .login-page::before {
    transform: none;
  }

  .login-shell {
    place-items: start center;
    padding: 92px 18px 34px;
  }

  .invitation-book {
    grid-template-columns: 1fr;
    min-height: 0;
    border-radius: 20px;
  }

  .book-spine {
    top: 236px;
    right: 0;
    bottom: auto;
    left: 0;
    width: auto;
    height: 30px;
    background: linear-gradient(180deg, transparent, rgba(93, 61, 66, 0.08), rgba(255, 255, 255, 0.56), transparent);
    transform: translateY(-50%);
  }

  .portrait-panel {
    grid-template: auto 1fr / minmax(170px, 0.48fr) minmax(220px, 0.52fr);
    min-height: 236px;
    padding: 26px 34px 24px;
    border-right: 0;
    border-bottom: 1px solid rgba(132, 60, 85, 0.12);
  }

  .issue-label {
    grid-column: 1 / -1;
  }

  .login-portrait {
    grid-row: 2;
    align-self: end;
    width: 164px;
    margin: 14px 0 0 12px;
  }

  .portrait-frame {
    aspect-ratio: 4 / 4.25;
    padding: 6px;
  }

  .portrait-frame::after {
    inset: 6px;
  }

  .portrait-caption {
    padding-top: 8px;
  }

  .portrait-caption span {
    font-size: 0.98rem;
  }

  .portrait-caption small {
    font-size: 0.5rem;
  }

  .portrait-note {
    grid-row: 2;
    align-self: center;
    margin-left: 30px;
    font-size: 1.12rem;
  }

  .login-copy {
    padding: 42px clamp(32px, 8vw, 70px) 38px;
  }

  h1 {
    font-size: clamp(3.35rem, 10vw, 4.7rem);
  }
}

@media (max-width: 560px) {
  .login-header {
    height: 60px;
    padding: 0 16px;
  }

  .monogram {
    width: 36px;
    height: 36px;
    font-size: 0.86rem;
  }

  .edition {
    display: none;
  }

  .login-shell {
    padding: 72px 12px 18px;
  }

  .invitation-book {
    border-radius: 17px;
    box-shadow:
      0 2px 0 rgba(255, 255, 255, 0.84),
      0 18px 48px rgba(93, 61, 66, 0.18);
  }

  .invitation-book::before {
    inset: 6px;
  }

  .book-spine {
    top: 136px;
    height: 22px;
  }

  .portrait-panel {
    grid-template: auto 1fr / minmax(0, 1fr) 92px;
    width: 100%;
    height: 136px;
    min-height: 0;
    padding: 17px 20px 15px;
  }

  .issue-label {
    grid-column: 1;
    align-self: start;
    font-size: 0.5rem;
    line-height: 1.3;
  }

  .login-portrait {
    grid-row: 1 / -1;
    grid-column: 2;
    align-self: center;
    width: 82px;
    margin: 0 0 0 10px;
    transform: rotate(1.8deg);
  }

  .portrait-frame {
    aspect-ratio: 1 / 1.03;
    padding: 4px;
    box-shadow: 0 8px 20px rgba(93, 61, 66, 0.16);
  }

  .portrait-frame::after {
    inset: 4px;
  }

  .portrait-caption {
    display: block;
    padding: 4px 1px 0;
    line-height: 1;
  }

  .portrait-caption span {
    font-size: 0.7rem;
  }

  .portrait-caption small {
    display: none;
  }

  .portrait-note {
    grid-row: 2;
    grid-column: 1;
    align-self: center;
    max-width: 170px;
    margin: 8px 0 0;
    font-size: 0.92rem;
    line-height: 1.18;
  }

  .portrait-note::before {
    flex-basis: 16px;
  }

  .login-copy {
    padding: 25px 20px 25px;
  }

  .login-copy::before {
    top: 17px;
    right: 23px;
    font-size: 0.9rem;
  }

  h1 {
    margin-top: 10px;
    font-size: clamp(2.6rem, 12.5vw, 3.3rem);
  }

  .intro {
    margin-top: 13px;
    font-size: 1rem;
    line-height: 1.3;
  }

  .invitation-meta {
    margin-top: 12px;
    font-size: 0.5rem;
  }

  .access-panel {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0 11px;
    margin-top: 15px;
    padding: 14px 13px 12px;
  }

  .login-seal {
    width: 40px;
    height: 40px;
    font-size: 0.68rem;
  }

  .access-copy strong {
    font-size: 0.98rem;
  }

  .access-copy small {
    font-size: 0.58rem;
    line-height: 1.35;
  }

  .name-access-form,
  .login-status {
    grid-column: 1 / -1;
  }

  .name-access-form {
    margin-top: 12px;
  }

  .name-access-row {
    grid-template-columns: 1fr;
  }

  .name-access-row button {
    width: 100%;
  }

  .privacy {
    margin-top: 12px;
    font-size: 0.58rem;
    line-height: 1.4;
  }

  .petal:nth-child(2),
  .petal:nth-child(4),
  .petal:nth-child(6),
  .petal:nth-child(9) {
    display: none;
  }
}

@media (max-width: 360px) {
  .brand-copy strong {
    font-size: 1.03rem;
  }

  h1 {
    font-size: 2.48rem;
  }

  .portrait-note {
    max-width: 150px;
    margin-left: 0;
    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .petal-field {
    display: none;
  }
}
