/*
 * The postcard invite page (build step 5b, Task 3). Values come from the
 * Figma "Invite Webpage" frames (402px wide): landing 15708:25224,
 * generating 15703:21155, code 15703:25082, out of invites 15703:25108.
 * One ~402px column, centred on big screens; the gradient fills the window.
 */

:root {
  --teal: #269cbf;
  --navy: #24619b;
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.8);
  --text-dark: #203746;
  --teal-alt: #c2fbfe;
  --teal-default: #91e8ff;
  --card-bg: #e3faf8;
  --card-text: #3c3c3c;
  --cta-border: #ddfaff;
  --divider: rgba(255, 255, 255, 0.1);
  --font-sans: 'Gabarito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', var(--font-sans);
  --font-script: 'Damion', 'Brush Script MT', cursive;
  --gutter: clamp(16px, 6.5vw, 26px);
}

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

html {
  background: var(--navy);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal) 13.021%, var(--navy) 58.105%)
    fixed;
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

h1,
p,
ul {
  margin: 0;
}

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

/* ─── Column ─────────────────────────────────────────────────────────────── */

.page {
  width: 100%;
  max-width: 402px;
  min-height: min(100dvh, 874px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(40px, 9.4dvh, 82px) var(--gutter) 36px;
}

/* ─── Brand header: logo, tagline, cashback strip ────────────────────────── */

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.brand__logo {
  display: block;
  width: 108px;
  height: 19.885px;
}

.brand__tagline {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 25px;
  color: var(--teal-alt);
  text-align: center;
  white-space: nowrap;
}

.brand__tagline-top {
  margin-bottom: -4px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.24;
  letter-spacing: -1.92px;
  opacity: 0.2;
}

.brand__tagline-script {
  margin-bottom: -4px;
  font-family: var(--font-script);
  font-size: 38px;
  line-height: 42px;
  letter-spacing: -0.76px;
  opacity: 0.3;
}

.strip {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 6vw, 24px);
  margin-top: 24px;
  padding: 0;
  list-style: none;
}

.strip__item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-weight: 600;
  white-space: nowrap;
}

.strip__item + .strip__item::before {
  content: '';
  position: absolute;
  top: 50%;
  left: calc(clamp(12px, 6vw, 24px) / -2);
  width: 1px;
  height: 28px;
  transform: translate(-50%, -50%);
  background: var(--divider);
}

.strip__percentage {
  color: var(--teal-default);
  font-size: 24px;
  line-height: 30px;
  letter-spacing: -0.48px;
}

.strip__label {
  font-size: 12px;
  line-height: 15px;
}

/* ─── Screen area ────────────────────────────────────────────────────────── */

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 54px;
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.screen--landing {
  gap: 26px;
  max-width: 315px;
}

.screen--code {
  gap: 44px;
  max-width: 350px;
}

.screen--postbox {
  gap: 36px;
  max-width: 341px;
  margin-top: 20px;
}

.screen--error {
  max-width: 341px;
}

.copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.copy__headline {
  font-weight: 600;
  font-size: 24px;
  line-height: 30px;
  letter-spacing: -0.48px;
}

.screen--landing .copy__headline {
  white-space: pre-line;
}

.copy__body {
  font-size: 16px;
  line-height: 20px;
}

/* Keeps the code screen's height while the code (and its date) is minted. */
.copy__body--pending {
  visibility: hidden;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 26px;
  width: 100%;
}

.screen--code .actions {
  gap: 32px;
  max-width: 341px;
}

.screen--postbox .actions {
  gap: 24px;
}

.notice {
  margin-top: -14px;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 49px;
  padding: 8px 20px;
  border: solid var(--cta-border);
  border-width: 2px 1px 4px;
  border-radius: 48px;
  background: radial-gradient(
    ellipse 78% 130% at 44% 14%,
    #ffffff 0%,
    rgba(255, 255, 255, 0.5) 100%
  );
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
  color: var(--text-dark);
  font: 600 14.05px/18px var(--font-sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cta:disabled {
  cursor: progress;
  opacity: 0.75;
}

.cta:focus-visible,
.code-card__copy:focus-visible,
.footer__terms:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.install {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.install__heading {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
}

/* ─── The postcard (landing, only with ?destination=) ────────────────────── */
/* Laid out on the 315px design grid in --u units so it scales down whole. */

.postcard {
  margin: 0;
  width: 100%;
  container-type: inline-size;
}

.postcard__card {
  --u: calc(100cqw / 315);
  position: relative;
  width: 100%;
  aspect-ratio: 315 / 229;
  border-radius: calc(12 * var(--u));
  background: var(--card-bg);
  color: var(--card-text);
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.2));
}

.postcard__head {
  position: absolute;
  top: calc(28.5 * var(--u));
  left: calc(22 * var(--u));
  display: flex;
  flex-direction: column;
  gap: calc(3 * var(--u));
  width: calc(145 * var(--u));
}

.postcard__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #000000;
  font-weight: 600;
  font-size: calc(24 * var(--u));
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.postcard__month {
  font-size: calc(14 * var(--u));
  line-height: calc(23 * var(--u));
}

.postcard__photo {
  position: absolute;
  top: calc(109.27 * var(--u));
  left: calc(24.24 * var(--u));
  width: calc(102.458 * var(--u));
  height: calc(72.75 * var(--u));
  border: calc(3 * var(--u)) solid #ffffff;
  border-radius: calc(4 * var(--u));
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
  object-fit: cover;
  transform: rotate(-2deg);
  background: #cfe9ef;
}

.postcard__blurb {
  position: absolute;
  top: calc(111.5 * var(--u));
  right: calc(25 * var(--u));
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  width: calc(150 * var(--u));
  font-size: calc(14 * var(--u));
  line-height: calc(23 * var(--u));
  text-align: right;
  text-decoration: underline;
  text-underline-position: from-font;
}

.postcard__stamp-group {
  position: absolute;
  top: calc(22.5 * var(--u));
  left: calc(201 * var(--u));
  width: calc(88 * var(--u));
  height: calc(56.587 * var(--u));
}

.postcard__brush {
  position: absolute;
  top: calc(10.27 * var(--u));
  left: calc(-0.64 * var(--u));
  width: calc(38.36 * var(--u));
  height: calc(25.76 * var(--u));
}

.stamp {
  position: absolute;
  top: calc(0.98 * var(--u));
  left: calc(29.68 * var(--u));
  width: calc(57.389 * var(--u));
  height: calc(54.618 * var(--u));
  transform: rotate(2deg);
  filter: drop-shadow(0 1.554px 3.107px rgba(0, 0, 0, 0.2));
}

.stamp__frame {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(51.476 * var(--u));
  height: 100%;
}

.stamp__photo {
  position: absolute;
  top: 7.39%;
  left: 6.37%;
  width: 76.57%;
  height: 85.1%;
  object-fit: cover;
}

.stamp__logo {
  position: absolute;
  top: calc(13.15 * var(--u));
  left: calc(8.27 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(1.94 * var(--u));
  filter: drop-shadow(0 1.94px 3.88px rgba(0, 0, 0, 0.15));
}

.stamp__52 {
  background: linear-gradient(130.28deg, #ffffff 9.17%, #c7fcff 90.35%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: calc(19.4 * var(--u));
  line-height: calc(15.522 * var(--u));
  letter-spacing: calc(-0.388 * var(--u));
}

.stamp__wordmark {
  display: block;
  width: calc(29.552 * var(--u));
  height: calc(8.692 * var(--u));
}

/* ─── The code card (generating + code shown) ────────────────────────────── */

.code-card {
  position: relative;
  width: 100%;
  height: 177px;
  border-radius: 24px;
  background: linear-gradient(
    187.17deg,
    #74aed1 6.93%,
    #76b4d5 46.19%,
    #d0cdff 80.73%,
    #aff1d4 101.81%
  );
  text-align: center;
}

.code-card__label {
  padding-top: 32px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.96px;
  text-transform: uppercase;
}

.code-card__code {
  margin-top: 12px;
  font-weight: 600;
  font-size: 48px;
  line-height: 1.2;
  letter-spacing: 1.92px;
}

.code-card__code--pending {
  margin-top: 23px;
  font-size: 37px;
  letter-spacing: 1.48px;
}

.code-card__copy {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 42px;
  border: solid var(--cta-border);
  border-width: 2px 1px 4px;
  border-radius: 0 0 20px 20px;
  background: radial-gradient(
    ellipse 78% 130% at 44% 14%,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(255, 255, 255, 0.25) 100%
  );
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
  color: var(--text-dark);
  font: 600 12px/15px var(--font-sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Postbox (out of invites, closed, not found) ────────────────────────── */

.postbox {
  display: block;
  width: 94px;
  height: 163px;
  object-fit: cover;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */

.footer {
  margin-top: auto;
  padding-top: 40px;
}

.footer__terms {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.96px;
  text-decoration: none;
  text-transform: uppercase;
}
