/* The frosted glass that opens when you draw a circle: the invitation of a made-up school (Brightwell) on a deep
   green page. Over the whole page a WebGL canvas draws a pane of frost; the invitation underneath is the real one,
   crisp, and shows wherever the frost has been wiped. Without WebGL a CSS layer with backdrop-filter takes its place. */
:root {
  --page: #07100d;          /* the page */
  --glow: #1c4839;          /* the green light low on the page */
  --card: #0e1915;          /* the body of the invitation */
  --edge: rgba(255, 255, 255, 0.09); /* its edge */
  --ink: #edf3ef;           /* the words */
  --muted: #8ea39a;         /* the small words */
  --accent: #c5ffcb;        /* mint: the front of the frost, the seat, the button */
  --accent-ink: #0a1a10;    /* the words on the button */
  --ice-dark: #5d7a73;      /* the frost where it is thin */
  --ice-light: #e4f3ee;     /* the frost where it is thick */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow: hidden;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  background:
    radial-gradient(ellipse 90% 70% at 50% 115%, color-mix(in srgb, var(--glow) 85%, transparent), transparent 70%),
    var(--page);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* ------------------------------------------------------------------ the invitation */
.wrap {
  grid-area: 1 / 1;
  position: relative;
  width: min(340px, 88vw);
  margin-bottom: calc(clamp(26px, 7vh, 32px) + clamp(8px, 2vh, 12px));
}

.invite {
  position: relative;
  padding: clamp(16px, 4.6vh, 24px) clamp(18px, 5.4vw, 24px);
  border-radius: 22px;
  background-color: var(--card);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 40%);
  border: 1px solid var(--edge);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 60px -28px rgba(0, 0, 0, 0.75),
    0 8px 22px -10px rgba(0, 0, 0, 0.55);
}

/* the thin mint line along the top edge that draws itself when the seat opens */
.invite__edge {
  position: absolute;
  left: 18px;
  right: 18px;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
  transform: scaleX(0);
  opacity: 0;
}

.invite__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.invite__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.invite__mark {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.invite__chip {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.03);
}

.invite__over {
  margin: clamp(14px, 4vh, 22px) 0 0;
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.invite__title {
  margin: clamp(4px, 1.2vh, 8px) 0 0;
  font-family: 'Newsreader Variable', Georgia, serif;
  font-variation-settings: 'opsz' 60;
  font-weight: 420;
  font-size: clamp(26px, 7.6vh, 34px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.invite__line {
  margin: clamp(6px, 1.6vh, 10px) 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.invite__facts {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  margin: clamp(12px, 3.4vh, 18px) 0 0;
  padding: clamp(9px, 2.4vh, 12px) 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.invite__fact dt {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.invite__fact dd {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.lock {
  width: 13px;
  height: 13px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  color: var(--muted);
}

.lock__shackle {
  transform-box: fill-box;
  transform-origin: 100% 100%;
}

.seat__word {
  display: inline-block;
  color: var(--muted);
}

.invite__fact--seat.is-open .lock,
.invite__fact--seat.is-open .seat__word {
  color: var(--accent);
}

/* ------------------------------------------------------------------ the button */
.claim {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(40px, 11vh, 46px);
  margin: clamp(12px, 3.4vh, 18px) 0 0;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background-color: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  font-stretch: 100%;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 18px -8px rgba(197, 255, 203, 0.35);
  transition: box-shadow 0.35s ease, font-stretch 0.35s cubic-bezier(0.3, 1.4, 0.5, 1), filter 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}

.invite.is-locked .claim {
  filter: saturate(0.15) brightness(0.62);
  pointer-events: none;
}

.claim__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
}

.claim__icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.claim__check {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.claim__arrow {
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

/* the sheen that crosses the button once when it wakes up */
.claim__sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.75) 50%, transparent 70%);
  transform: translateX(-120%);
  pointer-events: none;
}

.claim.is-hover {
  font-stretch: 112%;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 10px 26px -8px rgba(197, 255, 203, 0.5);
}

.claim.is-hover .claim__arrow {
  transform: translateX(2px);
}

@media (hover: hover) {
  .claim:hover {
    font-stretch: 112%;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 10px 26px -8px rgba(197, 255, 203, 0.5);
  }
  .claim:hover .claim__arrow {
    transform: translateX(2px);
  }
  .refreeze:hover {
    color: var(--ink);
    border-color: rgba(255, 255, 255, 0.22);
  }
}

.claim:focus-visible,
.refreeze:focus-visible,
.skip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ frost it again */
.refreeze {
  position: absolute;
  left: 50%;
  top: calc(100% + clamp(8px, 2vh, 12px));
  height: clamp(26px, 7vh, 32px);
  padding: 0 13px 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  translate: -50% 0;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: color 0.25s ease, border-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.refreeze svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.refreeze.is-hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.22);
}

/* ------------------------------------------------------------------ the glass */
.glass,
.glass-css {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.glass-css {
  display: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.10), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(214, 238, 230, 0.30), rgba(160, 196, 186, 0.20));
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-mask-image: radial-gradient(circle var(--r, 0px) at var(--x, 50%) var(--y, 50%), transparent 55%, #000 100%);
  mask-image: radial-gradient(circle var(--r, 0px) at var(--x, 50%) var(--y, 50%), transparent 55%, #000 100%);
}

.no-gl .glass {
  display: none;
}

.no-gl .glass-css {
  display: block;
}

/* ------------------------------------------------------------------ the hint */
.hint {
  grid-area: 1 / 1;
  position: relative;
  margin-bottom: calc(clamp(26px, 7vh, 32px) + clamp(8px, 2vh, 12px));
  display: grid;
  justify-items: center;
  pointer-events: none;
  opacity: 0;
  --d: min(40vh, 56vw, 230px);
}

.hint__ring {
  position: relative;
  width: var(--d);
  height: var(--d);
}

.hint__track {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.hint__comet {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(closest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px), #000 calc(100% - 0.5px), transparent);
  mask-image: radial-gradient(closest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px), #000 calc(100% - 0.5px), transparent);
}

.hint__arm {
  position: absolute;
  left: 50%;
  top: 0;
  width: 0;
  height: 50%;
  transform-origin: 50% 100%;
}

.hint__dot {
  position: absolute;
  left: 0;
  top: 0;
  width: min(2vh, 9px);
  height: min(2vh, 9px);
  translate: -50% -50%;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.hint__words {
  position: absolute;
  top: calc(100% + clamp(8px, 2.4vh, 14px));
  display: grid;
  justify-items: center;
  gap: 3px;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.hint__big {
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff;
}

.hint__small {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

/* ------------------------------------------------------------------ keyboard, pointer */
.skip {
  position: absolute;
  left: 50%;
  bottom: 10px;
  translate: -50% 0;
  padding: 8px 14px;
  border-radius: 99px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
}

.skip:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  z-index: 10;
  fill: #0a0f0d;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
  pointer-events: none;
  opacity: 0;
}
