/* ==========================================================================
   Annual billing offer: a sealed navy envelope that opens on tap and lets a
   cream letter rise out. Shown once to first-time visitors (assets/js/offer.js).

   Geometry (desktop): the envelope block is 100% wide; the pocket is 62% of
   the width tall and sits under a 32% tall space that the opened flap and the
   risen letter occupy. Percentages inside the block are of its total height
   (94% of width), so the pocket starts at 34% and the pocket is 66% tall.
   ========================================================================== */

:root {
  --ofr-navy-1: #152647;
  --ofr-navy-2: #0C1A36;
  --ofr-navy-3: #081226;
  --ofr-gold: rgba(214, 186, 128, 0.55);
  --ofr-gold-strong: rgba(221, 196, 140, 0.85);
  --ofr-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.055 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
}

.offer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

.offer[hidden] { display: none; }

.offer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 24, 0.64);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.offer.is-open .offer__backdrop { opacity: 1; }

.offer__stage {
  position: relative;
  width: min(100%, 640px);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.offer.is-open .offer__stage { opacity: 1; transform: none; }

.offer__close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 9;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(7, 20, 38, 0.85);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.offer__close:hover,
.offer__close:focus-visible { background: #0B1120; outline: 2px solid #60A5FA; outline-offset: 2px; }

.offer__close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---- Envelope block ---- */
.offer__env {
  position: relative;
  padding-top: 32%;
  perspective: 1400px;
  filter:
    drop-shadow(0 34px 50px rgba(2, 8, 23, 0.62))
    drop-shadow(0 0 34px rgba(59, 130, 246, 0.26));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.offer__env.is-opened { cursor: default; }

.offer__env:focus-visible { outline: none; }
.offer__env:focus-visible .offer__pocket { box-shadow: 0 0 0 3px #60A5FA; }

/* Back of the envelope (the pocket) */
.offer__pocket {
  position: relative;
  width: 100%;
  padding-top: 62%;
  border-radius: 7px;
  background:
    var(--ofr-grain),
    linear-gradient(170deg, #122140 0%, #0B182F 55%, #081226 100%);
  z-index: 1;
}

/* Inside lining, visible once the flap lifts */
.offer__inside {
  position: absolute;
  left: 0;
  right: 0;
  top: 34%;
  height: 66%;
  border-radius: 7px;
  background:
    var(--ofr-grain),
    linear-gradient(180deg, #050C1A 0%, #07111F 100%);
  box-shadow: inset 0 14px 30px rgba(0, 0, 0, 0.55);
  z-index: 1;
}

/* Front pieces: each is a gold hairline shape with the navy face inset 1.5px,
   so a fine trim shows along every fold. */
.offer__piece {
  position: absolute;
  left: 0;
  right: 0;
  top: 34%;
  height: 66%;
  background: linear-gradient(180deg, var(--ofr-gold-strong), var(--ofr-gold));
  z-index: 3;
}

.offer__piece::after {
  content: "";
  position: absolute;
  inset: 1.5px 0 0;
  background: var(--ofr-grain), var(--piece-bg);
}

.offer__piece--left {
  clip-path: polygon(0 0, 50% 58%, 0 100%);
  --piece-bg: linear-gradient(115deg, #17294C 0%, #0F1D3A 55%, #0B172F 100%);
}
.offer__piece--left::after { clip-path: polygon(0 0, 50% 58%, 0 100%); }

.offer__piece--right {
  clip-path: polygon(100% 0, 50% 58%, 100% 100%);
  --piece-bg: linear-gradient(245deg, #15274A 0%, #0D1A35 55%, #0A152C 100%);
}
.offer__piece--right::after { clip-path: polygon(100% 0, 50% 58%, 100% 100%); }

.offer__piece--bottom {
  clip-path: polygon(0 100%, 50% 42%, 100% 100%);
  border-radius: 0 0 7px 7px;
  z-index: 4;
  --piece-bg: linear-gradient(180deg, #1B2F56 0%, #11213F 48%, #0C182F 100%);
}
.offer__piece--bottom::after { clip-path: polygon(0 100%, 50% 42%, 100% 100%); border-radius: 0 0 7px 7px; }

/* Soft highlight along the top edge of the bottom flap */
.offer__piece--bottom::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  clip-path: polygon(0 100%, 50% 42%, 100% 100%, 100% 96%, 50% 48%, 0 96%);
  background: linear-gradient(180deg, rgba(147, 197, 253, 0.28), rgba(147, 197, 253, 0));
  pointer-events: none;
}

/* Top flap: hinged at the pocket's top edge. Sealed = hanging down over the
   front. Opened = rotated up and back, showing its lining. */
.offer__flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 34%;
  height: 40%;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 6;
}

.offer__env.is-opened .offer__flap { transform: rotateX(180deg); z-index: 0; }

.offer__flap-face,
.offer__flap-back {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.offer__flap-face {
  background: linear-gradient(180deg, var(--ofr-gold-strong), var(--ofr-gold));
}

.offer__flap-face::after {
  content: "";
  position: absolute;
  inset: 0 1.5px 1.5px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background:
    var(--ofr-grain),
    linear-gradient(180deg, #1C3159 0%, #122140 55%, #0D1A35 100%);
}

.offer__flap-back {
  transform: rotateX(180deg);
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  background: linear-gradient(0deg, var(--ofr-gold-strong), var(--ofr-gold));
}

.offer__flap-back::after {
  content: "";
  position: absolute;
  inset: 1.5px 0 0;
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
  background:
    var(--ofr-grain),
    linear-gradient(180deg, #0C1830 0%, #15284A 100%);
  box-shadow: inset 0 -18px 30px rgba(0, 0, 0, 0.35);
}

.offer__hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 34%;
  margin-top: 21%;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ofr-gold-strong);
  z-index: 7;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.offer__env.is-opened .offer__hint { opacity: 0; }

/* Brand on the bottom flap */
.offer__brand {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  z-index: 5;
  text-align: center;
  color: #fff;
  pointer-events: none;
}

.offer__brand::before {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  margin: 0 auto 0.75rem;
  background: var(--ofr-gold-strong);
}

.offer__brand-word {
  display: block;
  font-size: clamp(1.05rem, 3.2vw, 1.4rem);
  font-weight: 300;
  letter-spacing: 0.46em;
  margin-left: 0.46em;
  line-height: 1;
}

.offer__brand-sub {
  display: block;
  margin-top: 0.5rem;
  font-size: clamp(0.48rem, 1.4vw, 0.6rem);
  font-weight: 500;
  letter-spacing: 0.32em;
  margin-left: 0.32em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.72);
}

/* ---- Letter card ---- */
.offer__letter {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 7%;
  bottom: 26%;
  z-index: 2;
  background: linear-gradient(180deg, #FFFDF8 0%, #F5F1E8 100%);
  border-radius: 6px;
  box-shadow: 0 18px 40px rgba(2, 8, 23, 0.4);
  padding: 4.5% 7% 0;
  text-align: center;
  color: #0B1120;
  overflow: hidden;
  transform-origin: 50% 100%;
  transform: translateY(28%) scale(0.8);
  transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.45s;
}

.offer__env.is-opened .offer__letter { transform: none; }

.offer__letter::before {
  content: "";
  position: absolute;
  inset: 3.5%;
  border: 1px solid rgba(11, 17, 32, 0.12);
  border-radius: 3px;
  pointer-events: none;
}

.offer__mark { width: 18px; height: 18px; margin: 0 auto 0.9rem; color: #2563EB; }

.offer__eyebrow {
  display: block;
  font-size: clamp(0.58rem, 1.6vw, 0.7rem);
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #1F2937;
  margin-bottom: 1rem;
}

.offer__title {
  font-family: "DM Serif Display", Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(1.35rem, 4.6vw, 2.3rem);
  line-height: 1.12;
  color: #0B1120;
  margin: 0;
}

.offer__title em { display: block; font-style: normal; color: #2563EB; }

.offer__text {
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  line-height: 1.55;
  color: #374151;
  max-width: 24rem;
  margin: 0.8rem auto 0;
}

.offer__rule { display: block; width: 36px; height: 1px; background: rgba(11, 17, 32, 0.25); margin: 0.9rem auto; }

.offer__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #3B82F6 0%, #1D4ED8 100%);
  color: #fff;
  font-weight: 600;
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.offer__cta:hover,
.offer__cta:focus-visible { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(37, 99, 235, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25); outline: none; }

.offer__cta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Phones: env = 58% space + 78% pocket (of width), total 136% ---- */
@media (max-width: 480px) {
  .offer { padding: 0.75rem; }
  .offer__env { padding-top: 58%; }
  .offer__pocket { padding-top: 78%; }
  .offer__inside, .offer__piece { top: 42.6%; height: 57.4%; }
  .offer__piece--left, .offer__piece--left::after { clip-path: polygon(0 0, 50% 70%, 0 100%); }
  .offer__piece--right, .offer__piece--right::after { clip-path: polygon(100% 0, 50% 70%, 100% 100%); }
  .offer__piece--bottom, .offer__piece--bottom::after { clip-path: polygon(0 100%, 50% 56%, 100% 100%); }
  .offer__piece--bottom::before { clip-path: polygon(0 100%, 50% 56%, 100% 100%, 100% 96%, 50% 61%, 0 96%); }
  .offer__flap { top: 42.6%; height: 42%; }
  .offer__hint { top: 42.6%; margin-top: 30%; }
  .offer__letter { left: 6%; right: 6%; top: 1%; bottom: 22%; padding: 7% 7% 0; transform: translateY(24%) scale(0.68); }
  .offer__title { font-size: 1.55rem; }
  .offer__close { top: -10px; right: -4px; width: 44px; height: 44px; }
  .offer__brand { bottom: 5%; }
}

@media (prefers-reduced-motion: reduce) {
  .offer__backdrop, .offer__stage, .offer__letter, .offer__flap { transition: none; }
  .offer__stage { transform: none; }
}
