/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

html, body {
  height: 100%;
  overflow: hidden;
}

/* ─── Animations ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

/* ─── Page background ─── */
.bg-wood {
  position: fixed;
  inset: 0;
  /* Sampled average of the photograph. Without it the backdrop stays blank
     until the JPEG arrives; with it the first frame is already the right
     colour and the photo simply resolves on top. */
  background-color: #E2C9B0;
  background-image: url('./assets/ghibili_background.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: saturate(0.81) brightness(1.03);
  z-index: -2;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(248, 245, 239, 0.55) 0%,
    rgba(237, 232, 224, 0.7) 50%,
    rgba(228, 220, 210, 0.6) 100%
  );
  z-index: -1;
}

/* ─── Page layout ─── */
.page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: "Barlow Condensed", sans-serif;
  color: #29241d;
}

/* ─── Card ─── */
.card {
  position: relative;
  width: min(520px, 94vw);
  background: #f5f1ea;
  padding: 32px 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  box-shadow:
    0 18px 36px rgba(41, 36, 29, 0.22),
    8px 10px 0 rgba(41, 36, 29, 0.12);
  overflow: visible;
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('./assets/white-paper-texture.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.58;
  filter: contrast(0.92) brightness(1.05);
  pointer-events: none;
  z-index: 0;
}

.card > * {
  position: relative;
  z-index: 1;
}

/* ─── Pins ─── */
.pin {
  position: absolute;
  top: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9b9386;
  border: 1px solid #8a8174;
  pointer-events: none;
  z-index: 2;
}

.pin-left { left: 14px; }
.pin-right { right: 14px; }

/* ─── Logo ─── */
.logo {
  width: 100%;
  max-width: 300px;
  /* The intrinsic ratio of header_logo.png. Without it the element has no
     height until the image decodes, so everything below jumped down when the
     logo landed. */
  aspect-ratio: 2479 / 413;
  mix-blend-mode: multiply;
  animation: fadeIn 1s 0.2s both;
}

/* ─── Mascot ─── */
.mascot {
  width: 100px;
  height: 100px;


  object-fit: cover;
  margin-top: 10px;
  animation: fadeIn 1s 0.4s both;
}

/* ─── Typography ─── */
.headline {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(2.2rem, 7vw, 3rem);
  font-weight: 400;
  color: #29241d;
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1;
  margin-top: 10px;
  animation: fadeUp 0.8s 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.tagline {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.05rem;
  color: #555;
  text-align: center;
  max-width: 380px;
  line-height: 1.45;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  animation: fadeUp 0.8s 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ─── Features (compact horizontal) ─── */
.features {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
  animation: fadeUp 0.8s 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.feature {
  text-align: center;
  flex: 0 1 auto;
}

.feature-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

/* ─── Divider ─── */
.divider {
  width: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c8c1b6, transparent);
  margin: 14px 0 24px 0;
  animation: fadeIn 1s 0.8s both;
}

/* ─── Form section ─── */
.form-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: fadeUp 0.8s 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.form-label {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.05rem;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Input row (input + button side by side) ─── */
.input-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 400px;
  gap: 8px;
}

.input-row-field {
  position: relative;
  width: 100%;
 
}

.input-row-border {
  position: absolute;
  top: 0;
  height: 100%;
  width: 6px;
  pointer-events: none;
  z-index: 2;
}

.input-row-border-left {
  left: -15px;
  transform: scaleX(5);
  transform-origin: left center;
}

.input-row-border-right {
  right: -2px;
  transform: scaleX(-5);
  transform-origin: center;
}

.input-row-border-h-wrap {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background-repeat: repeat-x;
  background-position: left center;
  background-size: auto 100%;
  pointer-events: none;
  z-index: 2;
}

.input-row-border-top { top: 0; }
.input-row-border-bottom { bottom: 0; }

.email-input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.95rem;
  color: #29241d;
  outline: none;
}

.email-input::placeholder {
  color: #8a8174;
}

/* ── Duo-styled "Join" button ──
   Offset pill sits behind the button and lifts via box-shadow, flattening
   onto the pill on press, plus a subtle grain texture. */
.duo-btn-wrap {
  position: relative;
  display: flex;
  flex-shrink: 0;
  width: 100%;
}

.duo-btn-pill {
  position: absolute;
  top: 1px;
  left: 0;
  right: 0;
  bottom: 0.5px;
  z-index: 0;
  background: #7A2528;
  border-radius: 999px;
  transform: translate(0px, 5px);
  pointer-events: none;
}

.duo-btn {
  position: relative;
  z-index: 1;
  box-shadow: 0 5px 0 #942C2F;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s;
}

.duo-btn:active {
  box-shadow: none;
  transform: translateY(5px);
}

.duo-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='1' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.19'/%3E%3C/svg%3E");
  pointer-events: none;
}

.submit-btn {
  width: 100%;
  padding: 12px 22px;
  background: #C53B3F;
  color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.submit-btn:hover {
  background: #AD3236;
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── Honeypot (invisible to humans) ─── */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  z-index: -1;
  pointer-events: none;
}

/* ─── Consent ─── */
.consent {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  max-width: 400px;
  width: 100%;
  margin-top: 10px;
}

.consent input[type="checkbox"] {
  margin-top: 2px;
  accent-color: #C53B3F;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.consent label {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.72rem;
  color: #777;
  line-height: 1.4;
}

.consent a {
  color: rgb(46, 120, 139);
  text-decoration: underline;
}

/* ─── Form messages ─── */
.form-msg {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.82rem;
  text-align: center;
  min-height: 1.2em;
}

.form-msg.success { color: rgb(46, 120, 139); }
.form-msg.error { color: #b70000; }

/* ─── Submit button feedback states ─── */
/* The state class goes on the wrapper, not the button: the drop-shadow pill is
   a *preceding* sibling of the button, and CSS has no way to reach backwards. */
.duo-btn-wrap.is-success .submit-btn,
.duo-btn-wrap.is-success .submit-btn:hover,
.duo-btn-wrap.is-success .submit-btn:disabled {
  background: #2F8F57;
  box-shadow: 0 5px 0 #216B40;
  /* The button stays disabled so a second submit can't fire, but it should
     read as celebratory rather than dimmed out. */
  opacity: 1;
  cursor: default;
  animation: btn-pop 0.34s ease-out;
}

.duo-btn-wrap.is-success .duo-btn-pill { background: #1B5734; }

.duo-btn-wrap.is-error .submit-btn { animation: btn-shake 0.4s ease-in-out; }

@keyframes btn-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes btn-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}

/* Colour still communicates the result; only the movement is dropped. */
@media (prefers-reduced-motion: reduce) {
  .duo-btn-wrap.is-success .submit-btn,
  .duo-btn-wrap.is-error .submit-btn {
    animation: none;
  }
}

/* ─── Image skeletons ─── */
/* The shimmer sits on each image's own background, so no wrapper markup is
   needed: an image that hasn't decoded yet paints its background, and the
   picture covers it once it arrives. Boxes are already reserved by width,
   height or aspect-ratio, so swapping one for the other moves nothing. */
.card img:not(.input-row-border):not(.is-loaded) {
  background-color: #e4ded3;
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.65) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  border-radius: 6px;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.card img.is-loaded {
  animation: img-fade-in 0.35s ease both;
}

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes img-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Keep the placeholder colour, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  .card img:not(.input-row-border):not(.is-loaded),
  .card img.is-loaded {
    animation: none;
  }
}

/* ─── Footer ─── */
.footer {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.7rem;
  color: #aaa;
  text-align: center;
  margin-top: 0px;
  animation: fadeIn 1s 1s both;
}

.footer a {
  color: #999;
  text-decoration: none;
}

.footer a:hover {
  color: rgb(46, 120, 139);
  text-decoration: underline;
}

.footer-sep {
  margin: 0 6px;
  color: #ccc;
}

/* ─── Raccoon peek (decorative) ─── */
.raccoon-peek {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 90px;
  opacity: 0.92;
  pointer-events: none;
  z-index: 3;
  animation: fadeIn 1s 1s both;
}

/* ─── Success state ─── */
.success-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.success-raccoon {
  width: 150px;
  animation: float 3s ease-in-out infinite;
}

.success-state .headline {
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  animation: none;
}

.success-state .tagline {
  font-size: 1rem;
  animation: none;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .page { padding: 12px; }

  .card {
    width: 96vw;
    padding: 28px 18px 20px;
  }

  .logo { max-width: 160px; }

  .mascot { width: 76px; height: 76px; }

  .features { gap: 14px; }

  .input-row { max-width: 100%; }

  .raccoon-peek {
    width: 65px;
    bottom: -6px;
    right: -8px;
  }
}

@media (max-height: 700px) {
  .card { padding: 24px 24px 18px; }

  .mascot {
    width: 70px;
    height: 70px;
    margin-top: 6px;
  }

  .headline {
    font-size: clamp(1.8rem, 6vw, 2.4rem);
    margin-top: 6px;
  }

  .tagline { font-size: 0.95rem; margin-top: 4px; }
  .features { margin-top: 8px; }
  .divider { margin: 8px 0; }
  .raccoon-peek { width: 70px; }
}

/* ─── Privacy Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(41, 36, 29, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  position: relative;
  width: min(560px, 94vw);
  max-height: 80vh;
  background: #f5f1ea;
  padding: 32px 28px 24px;
  box-shadow:
    0 20px 60px rgba(41, 36, 29, 0.35),
    8px 10px 0 rgba(41, 36, 29, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url('./assets/white-paper-texture.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.58;
  filter: contrast(0.92) brightness(1.05);
  pointer-events: none;
  z-index: 0;
}

.modal-card > * {
  position: relative;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: #555;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.modal-close:hover {
  color: #29241d;
  background: rgba(0, 0, 0, 0.06);
}

.modal-card h1 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.8rem;
  font-weight: 300;
  color: #29241d;
  letter-spacing: 0.06em;
  text-align: center;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 8px;
}

.modal-body h2 {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin-top: 14px;
  margin-bottom: 4px;
}

.modal-body p,
.modal-body ul {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.9rem;
  color: #555;
  line-height: 1.6;
}

.modal-body ul {
  padding-left: 18px;
}

.modal-body li {
  margin-bottom: 3px;
}

.modal-body::-webkit-scrollbar {
  width: 5px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #c8c1b6;
  border-radius: 3px;
}

/* ─── Privacy page (scrollable, fallback for direct URL) ─── */
html:has(.privacy-page),
html:has(.privacy-page) body {
  height: auto;
  overflow: auto;
}

.privacy-page {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
  padding: 32px 16px;
}

.privacy-card {
  width: min(680px, 92vw);
  text-align: left;
  align-items: flex-start;
}

.privacy-card h1 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 300;
  color: #29241d;
  letter-spacing: 0.06em;
  align-self: center;
}

.privacy-card h2 {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin-top: 12px;
}

.privacy-card p,
.privacy-card ul {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.95rem;
  color: #555;
  line-height: 1.65;
}

.privacy-card ul { padding-left: 20px; }
.privacy-card li { margin-bottom: 4px; }

.privacy-card a {
  color: rgb(46, 120, 139);
  text-decoration: underline;
}

.back-link {
  display: inline-block;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(46, 120, 139);
  text-decoration: none;
  margin-bottom: 8px;
}

.back-link:hover { text-decoration: underline; }
