/* ── Fonts ─────────────────────────────────────────────────────────────────
   Local files in assets/fonts. Canela is a TRIAL file — swap in a licensed
   copy before this goes properly live.                                      */
@font-face {
  font-family: "Canela Condensed";
  src: url("../assets/fonts/CanelaCondensed-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Makcasa";
  src: url("../assets/fonts/Makcasa-Regular.otf") format("opentype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("../assets/fonts/InstrumentSerif-Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Saint Andrews Queen";
  src: url("../assets/fonts/SaintAndrewsQueen.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* ── The Blue Hour ─────────────────────────────────────────────────────────
   Palette drawn from the invite artwork.                                    */
:root {
  --ink-deep:   #050d1c;   /* near-black navy */
  --ink-blue:   #123a63;   /* mid blue        */
  --moon:       #a8cfe0;   /* pale moon blue  */
  --moon-soft:  #cfe6f0;   /* lightest text   */
  --text:       #e7f1f7;
  --error:      #ffb4a8;

  /* Display — big dates, venue, buttons */
  --font-display: "Canela Condensed", "Makcasa", Georgia, serif;
  /* Serif used for the invite copy and headings */
  --font-serif:   "Makcasa", Georgia, serif;
  /* Italic accent */
  --font-accent:  "Instrument Serif", Georgia, serif;
  /* Script — decorative only, matches the logo's "Blue" */
  --font-script:  "Saint Andrews Queen", cursive;
  /* UI / form text — kept as a sans for legibility and ₹ support */
  --font-body:    "Jost", "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text);
  background-color: var(--ink-deep);
  display: flex;
  justify-content: center;
}

/* Only the invite artwork — stretched to fill the viewport, nothing else.
   Portrait art on phones, 16:9 art on wider screens. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("../assets/5.jpg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

@media (min-width: 900px) {
  body::before { background-image: url("../assets/4.jpg"); }
}

body.no-scroll { overflow: hidden; }

/* ── Invite column ── */
.invite { width: 100%; max-width: 560px; padding: 0 28px 64px; }

.invite__inner {
  display: flex;
  flex-direction: column;
  /* Fade only — a transform here would become the containing block for the
     position:fixed logo pieces and make them scroll with the page. */
  animation: fade-in 900ms ease both;
}

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

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

.invite__logo {
  width: min(420px, 68%);
  align-self: center;
  margin-top: 110px;
  margin-right: 18vh;
  /* right shift on mobile — increase to move right, negative to move left */
  transform: translateX(6%);
}

.invite__assoc {
  width: min(150px, 19%);
  align-self: center;
  margin-top: 93px;
  margin-right: 155px;
}

.invite__presents {
  width: min(900px, 265%);
  align-self: center;
  margin-top: 93px;
  margin-right: 20px;
}

.invite__copy { margin-top: clamp(24px, 6vh, 64px); }

.invite__copy p {
  font-family: var(--font-serif);
  font-size: clamp(1.12rem, 2.8vw, 1.32rem);
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--moon-soft);
  margin-bottom: 1.1em;
}

/* ── CTA (the green-marked area) ── */
.invite__cta { margin: clamp(20px, 4vh, 40px) 0 clamp(28px, 6vh, 56px); }

.btn-register {
  width: 100%;
  padding: 20px 24px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 400;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--moon-soft);
  background: rgba(168, 207, 224, 0.06);
  border: 1px solid rgba(168, 207, 224, 0.55);
  border-radius: 2px;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 260ms ease, box-shadow 260ms ease, letter-spacing 260ms ease;
}

.btn-register:hover,
.btn-register:focus-visible {
  background: rgba(168, 207, 224, 0.16);
  box-shadow: 0 0 32px rgba(168, 207, 224, 0.25);
  letter-spacing: 0.4em;
}

.btn-register:focus-visible,
.btn-submit:focus-visible,
.modal__close:focus-visible {
  outline: 2px solid var(--moon);
  outline-offset: 3px;
}

/* ── Event block ── */
.invite__event + .invite__event { margin-top: clamp(22px, 4vh, 34px); }

.event__date {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 5.8vw, 2.5rem);
  letter-spacing: 0.14em;
  color: var(--moon-soft);
}

.event__venue {
  font-family: var(--font-display);
  margin-top: 6px;
  font-size: clamp(1rem, 3vw, 1.2rem);
  letter-spacing: 0.16em;
  color: rgba(207, 230, 240, 0.75);
  max-width: 22ch;
}

.event__rule {
  margin: 14px 0 12px;
  border: 0;
  border-top: 1px solid rgba(207, 230, 240, 0.55);
  max-width: 330px;
}

.event__time {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  letter-spacing: 0.22em;
  color: var(--moon-soft);
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.modal.is-open { display: flex; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 18, 0.78);
  backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 40px 40px 44px;
  background: linear-gradient(170deg, rgba(13, 33, 60, 0.96), rgba(5, 13, 28, 0.97));
  border: 1px solid rgba(168, 207, 224, 0.28);
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: rise 360ms ease both;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.9rem;
  line-height: 1;
  color: rgba(207, 230, 240, 0.7);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.modal__close:hover { color: var(--moon-soft); }

.modal__head { text-align: center; margin-bottom: 26px; }
.modal__head img { width: 190px; }
.modal__head p {
  font-family: var(--font-display);
  margin-top: 10px;
  font-size: 1rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(207, 230, 240, 0.8);
}

/* ── Disclaimer ── */
.modal__disclaimer {
  margin-bottom: 26px;
  padding: 16px 18px;
  border: 1px solid rgba(168, 207, 224, 0.22);
  border-radius: 3px;
  background: rgba(168, 207, 224, 0.04);
}

.modal__disclaimer h4 {
  margin-bottom: 8px;
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--moon);
}

.modal__disclaimer p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(207, 230, 240, 0.78);
}

.modal__disclaimer p + p { margin-top: 8px; }

/* ── Form ── */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.fld { display: block; margin-bottom: 18px; }

.fld span {
  display: block;
  margin-bottom: 7px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(207, 230, 240, 0.7);
}

.fld input,
.fld select {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text);
  background: rgba(168, 207, 224, 0.05);
  border: 1px solid rgba(168, 207, 224, 0.3);
  border-radius: 2px;
  transition: border-color 200ms ease, background 200ms ease;
}

.fld input::placeholder { color: rgba(207, 230, 240, 0.35); }

.fld select { appearance: none; }
.fld select:invalid { color: rgba(207, 230, 240, 0.45); }
.fld option { color: #0b1930; background: #dce9f1; }

.fld input:focus,
.fld select:focus {
  outline: none;
  border-color: var(--moon);
  background: rgba(168, 207, 224, 0.1);
}

.form__error {
  min-height: 1.2em;
  margin: 2px 0 12px;
  font-size: 0.92rem;
  color: var(--error);
}

.btn-submit {
  width: 100%;
  padding: 16px;
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-deep);
  background: var(--moon);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: background 220ms ease, box-shadow 220ms ease;
}

.btn-submit:hover:not(:disabled) {
  background: var(--moon-soft);
  box-shadow: 0 0 30px rgba(168, 207, 224, 0.35);
}

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

/* ── Success ── */
.modal__success { text-align: center; padding: 20px 4px 8px; }

.modal__tick {
  width: 66px;
  height: 66px;
  margin-bottom: 6px;
  fill: none;
  stroke: var(--moon);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal__tick-ring {
  stroke-dasharray: 145;
  stroke-dashoffset: 145;
  animation: tick-ring 620ms ease forwards;
}

.modal__tick-mark {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: tick-mark 380ms ease 480ms forwards;
}

@keyframes tick-ring { to { stroke-dashoffset: 0; } }
@keyframes tick-mark { to { stroke-dashoffset: 0; } }

.modal__success h3 {
  margin: 4px 0 12px;
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: 0.06em;
  color: var(--moon-soft);
}
.modal__success p { font-family: var(--font-serif); line-height: 1.7; color: rgba(231, 241, 247, 0.85); }

/* ── Mobile ── */
@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; gap: 0; }
  .modal { padding: 0; align-items: flex-end; }
  .modal__panel {
    max-width: none;
    max-height: 94dvh;
    border-radius: 14px 14px 0 0;
    padding: 32px 22px 40px;
  }

  /* Once registered, the shorter panel reads better centred */
  .modal.is-success { padding: 20px; align-items: center; }
  .modal.is-success .modal__panel {
    max-height: calc(100dvh - 40px);
    border-radius: 10px;
    padding: 34px 22px 38px;
  }
  .btn-register { letter-spacing: 0.22em; padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* the tick is drawn by its animation — show it fully when animation is off */
  .modal__tick-ring,
  .modal__tick-mark { stroke-dashoffset: 0; }
}

/* ── Mobile: fit the whole invite into one screen ─────────────────────────
   Everything is sized against dvh so the logo, copy, button and both event
   blocks land inside the viewport — nothing to scroll, nothing to shift.
   The clamp() maxima are the original desktop-ish values; the minima keep it
   readable on short phones (SE / 13 mini).                                  */
@media (max-width: 899px) {
  .invite {
    height: 100dvh;
    padding-bottom: clamp(10px, 2dvh, 24px);
  }

  .invite__inner { height: 100%; }

  .invite__logo  { margin-top: clamp(34px, 15dvh, 118px); }
  .invite__assoc { margin-top: clamp(24px, 9.5dvh, 125px); }
  .invite__presents { margin-top: clamp(-45px, -7.5dvh, 116px); }

  .invite__copy { margin-top: clamp(12px, 3dvh, 40px); }

  .invite__copy p {
    font-size: clamp(0.88rem, 3.4vw, 1.14rem);
    line-height: 1.42;
    margin-bottom: 0.62em;
  }

  .invite__cta { margin: clamp(12px, 2.6dvh, 30px) 0 clamp(14px, 3dvh, 34px); }

  .btn-register { padding: clamp(12px, 1.8dvh, 18px) 14px; font-size: 0.92rem; }

  .invite__event + .invite__event { margin-top: clamp(10px, 2.2dvh, 26px); }

  .event__date  { font-size: clamp(1.28rem, 5.2vw, 1.9rem); }
  .event__venue { font-size: clamp(0.78rem, 2.9vw, 1.05rem); margin-top: 3px; }
  .event__rule  { margin: clamp(6px, 1.1dvh, 12px) 0 clamp(5px, 1dvh, 10px); }
  .event__time  { font-size: clamp(0.76rem, 2.7vw, 0.98rem); }
}

/* ── Desktop: the two logo pieces, anchored to the moon ───────────────────
   Placed last so they win over the base rules above.
   Coordinates are measured off the artwork: the moon's centre sits at 20.9%
   across, 32.4% down. --moon-x / --moon-y are the shared anchor — move those
   and both pieces follow together.                                          */
@media (min-width: 900px) {
  .invite__logo,
  .invite__assoc,
  .invite__presents {
    --moon-x: 20.9vw;
    --moon-y: 32.4vh;

    position: fixed;
    z-index: 1;
    margin: 0;
    max-width: none;
    align-self: auto;
    left: var(--moon-x);
  }

  /* "THE Blue HOUR" — centred on the moon */
  .invite__logo {
    width: 31vw;
    top: var(--moon-y);
    transform: translate(-50%, -50%);
  }

  /* "IN ASSOCIATION WITH / MM" — sits below the moon */
  .invite__assoc {
    width: 10vw;
    top: calc(var(--moon-y) + 8.7vw);
    transform: translateX(-50%);
  }

  /* PRESENTS — its own top so it moves independently */
  .invite__presents {
    width: 87vw;
    top: calc(var(--moon-y) - 23vw);
    transform: translateX(-50%);
  }

  /* Content column sits to the right, clear of the logo */
  .invite {
    position: relative;
    z-index: 1;
    margin-left: auto;
    margin-right: 8vw;
  }

  .invite__inner { padding-top: 14vh; }
}
