/* ============ FONTS ============ */

@font-face {
  font-family: 'Modak';
  src: url('public/fonts/Modak-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rockwell';
  src: url('public/fonts/Rockwell-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rockwell';
  src: url('public/fonts/Rockwell-Italic.otf') format('opentype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Rockwell';
  src: url('public/fonts/Rockwell-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Rockwell';
  src: url('public/fonts/Rockwell-Bold-Italic.otf') format('opentype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Rockwell';
  src: url('public/fonts/Rockwell-Extra-Bold.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ============ TOKENS ============ */

:root {
  --brand-navy: #1A2557;
  --brand-navy-soft: rgba(26, 37, 87, 0.7);
  --brand-cream: #F4EFE4;
  --brand-cream-overlay: rgba(244, 239, 228, 0.15);
}

/* ============ RESET ============ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Navy backdrop sits behind everything (including the negative-z-index video).
     This fixes whitespace when the video doesn't fully cover the viewport or hasn't loaded. */
  background: #1A2557;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: 'Rockwell', Georgia, serif;
  color: var(--brand-navy);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ LOADING SCREEN ============ */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--brand-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.7s ease-out;
}

.loading-screen.hidden {
  opacity: 0;
}

.loading-dots {
  display: flex;
  gap: 0.625rem;
}

.loading-dots span {
  width: 11px;
  height: 11px;
  background: var(--brand-cream);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.18s; }
.loading-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes dotPulse {
  0%, 100% { transform: scale(0.6); opacity: 0.35; }
  50%      { transform: scale(1.15); opacity: 1; }
}

/* ============ BACKGROUND LAYERS ============ */

.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -3;
  will-change: transform;
  animation: slowDrift 60s ease-in-out infinite alternate;
}

@keyframes slowDrift {
  0% { transform: scale(1.06) translate3d(0, 0, 0); }
  100% { transform: scale(1.16) translate3d(-3%, -2%, 0); }
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--brand-cream-overlay);
  z-index: -2;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.12;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.65 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
}

/* ============ LAYOUT ============ */

main {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  padding: clamp(2.5rem, 7vh, 5rem) 1.5rem clamp(3rem, 10vh, 6rem);
  gap: 2rem;
}

.top-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.wordmark-img {
  width: clamp(180px, 30vw, 380px);
  height: auto;
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tagline {
  font-family: 'Rockwell', Georgia, serif;
  font-weight: 700;
  font-style: italic;
  font-size: clamp(1.375rem, 2.8vw, 2rem);
  letter-spacing: 0.005em;
  color: var(--brand-navy);
  max-width: 32rem;
  line-height: 1.2;
  text-shadow:
    0 1.5px 0 rgba(26, 37, 87, 0.18),
    0 4px 12px rgba(26, 37, 87, 0.18);
}

/* ============ FORM AREA ============ */

.form-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(1rem, 4vh, 3rem);
}

.form-pill {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0.9rem;
  width: 100%;
  max-width: 32rem;
  padding: 0.5rem 0;
}

/* Email input — cream sticker, slightly tilted left */
.form-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  transform: rotate(-1deg);
  transition: transform 0.25s ease, filter 0.25s ease;
  filter: drop-shadow(4px 6px 0 rgba(26, 37, 87, 0.18))
          drop-shadow(0 16px 28px rgba(26, 37, 87, 0.22));
}

.form-wrap:hover {
  transform: rotate(-1deg) translateY(-2px);
  filter: drop-shadow(5px 8px 0 rgba(26, 37, 87, 0.2))
          drop-shadow(0 22px 36px rgba(26, 37, 87, 0.28));
}

.form-wrap:focus-within {
  transform: rotate(-1deg) translateY(-2px);
}

.email-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand-navy);
  pointer-events: none;
  z-index: 1;
}

.form-pill input[type="email"] {
  width: 100%;
  padding: 1.05rem 1.5rem 1.05rem 3rem;
  font-family: 'Rockwell', Georgia, serif;
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--brand-navy);
  background: var(--brand-cream);
  border: 2.5px solid var(--brand-navy);
  border-radius: 999px;
  outline: none;
  position: relative;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.4);
}

.form-pill input[type="email"]::placeholder {
  color: rgba(26, 37, 87, 0.55);
  font-style: italic;
}

/* Submit button — navy sticker badge, slightly tilted right, double-ring */
.form-pill button {
  flex: 0 0 auto;
  position: relative;
  padding: 1.05rem 1.6rem;
  font-family: 'Rockwell', Georgia, serif;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-cream);
  background: var(--brand-navy);
  border: 2.5px solid var(--brand-navy);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transform: rotate(1.5deg);
  transition: transform 0.2s ease, filter 0.25s ease;
  filter: drop-shadow(4px 6px 0 rgba(26, 37, 87, 0.22))
          drop-shadow(0 14px 26px rgba(26, 37, 87, 0.32));
  /* inner ring effect */
  box-shadow: inset 0 0 0 3px var(--brand-navy),
              inset 0 0 0 4px var(--brand-cream),
              inset 0 0 0 5px var(--brand-navy);
}

.form-pill button::before {
  /* subtle top-edge highlight */
  content: '';
  position: absolute;
  inset: 4px 8px auto 8px;
  height: 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  border-radius: 999px 999px 0 0;
  pointer-events: none;
}

.form-pill button .btn-arrow {
  transition: transform 0.2s ease;
  position: relative;
}

.form-pill button:hover {
  transform: rotate(1.5deg) translateY(-2px);
  filter: drop-shadow(5px 8px 0 rgba(26, 37, 87, 0.26))
          drop-shadow(0 20px 36px rgba(26, 37, 87, 0.38));
}

.form-pill button:hover .btn-arrow {
  transform: translateX(3px);
}

.form-pill button:active {
  transform: rotate(1.5deg) scale(0.97);
}

.form-pill button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ============ FORM MESSAGE ============ */

.form-message {
  font-family: 'Rockwell', Georgia, serif;
  font-style: italic;
  font-size: clamp(1.125rem, 1.8vw, 1.375rem);
  font-weight: 700;
  color: var(--brand-navy);
  min-height: 1.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-shadow:
    0 1px 0 rgba(26, 37, 87, 0.15),
    0 3px 8px rgba(26, 37, 87, 0.15);
}

.form-message.visible {
  opacity: 1;
}

.form-message.success {
  font-weight: 400;
}

.form-message.error {
  color: #8B2A3E;
}

/* ============ MOBILE ============ */

/* Stack form vertically on narrower viewports (covers phones AND tight desktop windows) */
@media (max-width: 680px) {
  .form-pill {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 0.25rem 0;
  }

  .form-wrap {
    width: 100%;
    max-width: 22rem;
  }

  .form-pill input[type="email"] {
    padding: 1rem 1.5rem 1rem 3rem;
    font-size: 1rem;
  }

  .form-pill button {
    padding: 1rem 2rem;
    font-size: 1rem;
    transform: rotate(1.5deg);
  }

  .wordmark-img {
    width: clamp(240px, 58vw, 340px);
  }
}

@media (max-width: 540px) {
  main {
    min-height: 100svh;
    justify-content: flex-start;
    gap: 0;
    padding-top: clamp(3.5rem, 9vh, 5.5rem);
    padding-bottom: clamp(2rem, 6vh, 4rem);
  }

  .top-cluster {
    gap: 1rem;
  }

  .form-area {
    margin-top: clamp(9rem, 34vh, 17rem);
    margin-bottom: 0;
  }

  .email-icon {
    left: 1.1rem;
  }

  .form-pill input[type="email"] {
    padding: 0.95rem 1.25rem 0.95rem 2.85rem;
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-video {
    animation: none;
  }
}
