/* The two-factor recovery codes card that flips into view: the last step of turning on two-factor sign in for Halden,
   an invented account app, on black. Graphite glass with a fine grain, 1px edges that catch the light from above,
   layered shadows; ten codes in a monospace under a frosted cover. One accent: mint. Every size is in em on a font
   size that follows both the width and the height, so the card fits the phone's short preview box too. */
:root {
  --page: #000000;            /* the page */
  --card: #0f1114;            /* the card, graphite */
  --well: #08090b;            /* the well the codes sit in */
  --ink: #eef0f3;             /* the words */
  --muted: #8a909a;           /* the small words */
  --faint: #5a606a;           /* the used code, the locked button */
  --line: rgba(255, 255, 255, 0.075); /* the 1px edges */
  --accent: #8ff0c6;          /* the one accent: mint */
  --accent-ink: #04140d;      /* the words on the accent */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

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 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

/* the wrap is GSAP's (entrance), the card is CSS's */
.wrap {
  width: min(540px, 92vw);
  opacity: 0;
  font-size: clamp(9.5px, min(3.3vw, 2.45vh), 15px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.05em;
  padding: 1.45em 1.5em 1.35em;
  border-radius: 1.55em;
  background:
    radial-gradient(90% 60% at 18% -10%, rgba(143, 240, 198, 0.07), transparent 60%),
    radial-gradient(70% 50% at 100% 0%, rgba(255, 255, 255, 0.045), transparent 65%),
    linear-gradient(180deg, #14171b, var(--card) 40%);
  box-shadow:
    inset 0 0 0 1px var(--line),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 1px 1px rgba(0, 0, 0, 0.6),
    0 12px 24px -12px rgba(0, 0, 0, 0.8),
    0 40px 80px -30px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.9);
  isolation: isolate;
}

/* the light on the top edge */
.card::before {
  content: '';
  position: absolute;
  inset: 0 12% auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), rgba(143, 240, 198, 0.35), transparent);
  pointer-events: none;
}

/* the grain */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  opacity: 0.35;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .07 0'/></filter><rect width='160' height='160' filter='url(%23g)'/></svg>");
}

/* ---------------------------------------------------------------- the head */
.head {
  display: flex;
  align-items: center;
  gap: 0.95em;
}

.badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75em;
  height: 2.75em;
  border-radius: 0.85em;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(143, 240, 198, 0.14), rgba(143, 240, 198, 0.04));
  box-shadow:
    inset 0 0 0 1px rgba(143, 240, 198, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 6px 16px -8px rgba(143, 240, 198, 0.4);
}

.badge svg {
  width: 1.5em;
  height: 1.5em;
}

.head__txt {
  flex: 1;
  min-width: 0;
}

.head h1 {
  margin: 0;
  font-size: 1.3em;
  font-weight: 620;
  font-stretch: 104%;
  letter-spacing: -0.012em;
  line-height: 1.15;
}

.head p {
  margin: 0.25em 0 0;
  color: var(--muted);
  font-size: 0.95em;
  line-height: 1.3;
}

.chip {
  flex: none;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.35em 0.65em 0.35em 0.5em;
  border-radius: 99px;
  color: var(--accent);
  font-size: 0.8em;
  font-weight: 600;
  background: rgba(143, 240, 198, 0.08);
  box-shadow: inset 0 0 0 1px rgba(143, 240, 198, 0.16);
}

.chip svg {
  width: 1.1em;
  height: 1.1em;
}

/* ---------------------------------------------------------------- the vault with the codes */
.vault {
  position: relative;
  border-radius: 1.05em;
  background: var(--well);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 2px 6px rgba(0, 0, 0, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.codes {
  margin: 0;
  padding: 0.7em 0.8em;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 2.35em;
  column-gap: 0.6em;
}

/* the code is GSAP's (blur, highlight), the words inside are CSS's */
.code {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0 0.7em;
  border-radius: 0.6em;
}

.code + .code:nth-child(n + 3)::before {
  content: '';
  position: absolute;
  left: 0.7em;
  right: 0.7em;
  top: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.04);
}

.code__txt {
  position: relative;
  display: inline-flex;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: 1.12em;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* one letter: a window a line tall, the glyph rolls through it */
.flap {
  position: relative;
  display: inline-block;
  width: 0.66em;
  height: 1.35em;
  line-height: 1.35em;
  text-align: center;
  overflow: hidden;
}

.flap > span {
  display: block;
}

/* the hairline in the middle of each flap, like a split-flap board */
.flap::after {
  content: '';
  position: absolute;
  left: 0.04em;
  right: 0.04em;
  top: 50%;
  height: 1px;
  background: rgba(0, 0, 0, 0.55);
  opacity: var(--split, 0);
}

.flap--dash {
  width: 0.62em;
  color: var(--faint);
}

.flap--dash::after {
  display: none;
}

.code__strike {
  position: absolute;
  left: 0.6em;
  top: 50%;
  width: 6.7em;
  height: 1px;
  background: var(--muted);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.code__used {
  margin-left: auto;
  color: var(--faint);
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
}

.code.is-used .code__txt {
  color: var(--faint);
}

.code.is-hot {
  background: rgba(143, 240, 198, 0.08);
}

/* the frosted cover */
.cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.75em;
  background:
    radial-gradient(60% 70% at 50% 45%, rgba(15, 17, 20, 0.35), rgba(8, 9, 11, 0.7)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent);
  -webkit-backdrop-filter: blur(5px) saturate(120%);
  backdrop-filter: blur(5px) saturate(120%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.reveal {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  height: 2.75em;
  padding: 0 1.25em 0 1em;
  border: 0;
  border-radius: 99px;
  font: inherit;
  font-size: 1em;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 20px -8px rgba(0, 0, 0, 0.9);
  -webkit-tap-highlight-color: transparent;
}

.reveal svg {
  width: 1.35em;
  height: 1.35em;
  overflow: visible;
}

.cover__hint {
  color: var(--muted);
  font-size: 0.85em;
}

.vault__sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(143, 240, 198, 0.1) 48%, rgba(255, 255, 255, 0.08) 50%, transparent 62%);
  transform: translateX(-100%);
}

/* ---------------------------------------------------------------- meta line */
.meta {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin: -0.25em 0 -0.15em 0.2em;
  color: var(--muted);
  font-size: 0.85em;
}

.meta b {
  color: var(--ink);
  font-weight: 600;
}

.meta__sep {
  color: var(--faint);
}

/* ---------------------------------------------------------------- copy and download */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em;
}

.act {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  height: 2.9em;
  border: 0;
  border-radius: 0.9em;
  font: inherit;
  font-size: 1em;
  font-weight: 560;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.085),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 6px 14px -8px rgba(0, 0, 0, 0.9);
  -webkit-tap-highlight-color: transparent;
}

.act__icon {
  position: relative;
  width: 1.3em;
  height: 1.3em;
}

.act__icon svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.act .i-ok {
  color: var(--accent);
  opacity: 0;
}

.act__words {
  display: grid;
}

.act__words > span {
  grid-area: 1 / 1;
  white-space: nowrap;
}

.act__done {
  color: var(--accent);
  opacity: 0;
}

/* the .txt file that drops through the download button: the button clips it, so it never covers the words around */
.act {
  overflow: hidden;
  isolation: isolate;
}

.act__face {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}

.file {
  position: absolute;
  left: 50%;
  top: 50%;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.4em 0.65em 0.4em 0.5em;
  border-radius: 0.6em;
  color: var(--ink);
  font-size: 0.78em;
  font-weight: 560;
  white-space: nowrap;
  background: #1b1f24;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 20px -8px rgba(0, 0, 0, 0.95);
  opacity: 0;
  pointer-events: none;
}

.file svg {
  width: 1.05em;
  height: 1.3em;
  color: var(--accent);
}

/* ---------------------------------------------------------------- the foot */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8em;
  padding-top: 1.05em;
  border-top: 1px solid var(--line);
}

.tick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  min-width: 0;
  cursor: pointer;
  font-size: 0.95em;
  color: var(--muted);
  -webkit-tap-highlight-color: transparent;
}

.tick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.tick__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.45em;
  height: 1.45em;
  border-radius: 0.42em;
  color: var(--accent-ink);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.tick__box svg {
  width: 1.05em;
  height: 1.05em;
}

.tick input:focus-visible + .tick__box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tick__words {
  white-space: nowrap;
}

.go {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  height: 2.9em;
  padding: 0 1.05em 0 1.3em;
  border: 0;
  border-radius: 99px;
  font: inherit;
  font-size: 1em;
  font-weight: 620;
  color: var(--faint);
  cursor: not-allowed;
  overflow: hidden;
  isolation: isolate;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  -webkit-tap-highlight-color: transparent;
}

.go__glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%),
    var(--accent);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  opacity: 0;
}

.go {
  transition: color 0.35s ease, box-shadow 0.45s ease;
}

.go.is-on {
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 8px 22px -8px rgba(143, 240, 198, 0.55);
}

.go__arrow {
  width: 1.2em;
  height: 1.2em;
}

.reveal:focus-visible,
.act:focus-visible,
.go:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* the codes flying into the copy button */
.flyers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.flyer {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 1.35em;
  letter-spacing: 0.06em;
  text-indent: 0.03em;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: 1.12em;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(143, 240, 198, 0.45);
}

@media (hover: hover) {
  .reveal:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.07));
  }

  .act:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045));
  }

  .tick:hover .tick__box {
    box-shadow: inset 0 0 0 1px rgba(143, 240, 198, 0.55);
  }

  .tick:hover {
    color: var(--ink);
  }
}

/* narrow cards: the chip and the dot line give their room to the codes */
@media (max-width: 420px) {
  .chip {
    display: none;
  }
}
