/* beam™ — optical light design system
   paper-light surfaces, one spectral beam as the signature element */

:root {
  --paper: #F5F8FC;
  --card: #FFFFFF;
  --ink: #101724;
  --dim: #5C6B80;
  --line: #DEE6F0;
  --cyan: #2BD9FF;
  --violet: #7A5AFF;
  --amber: #FFA94D;
  --pulse: #5F49F5;
  --pulse-ink: #FFFFFF;
  --danger: #D6455D;
  --beam-grad: linear-gradient(90deg, var(--cyan), var(--violet) 52%, var(--amber));
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 23, 36, .04), 0 8px 28px rgba(16, 23, 36, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0B0F16;
    --card: #121826;
    --ink: #EDF2FA;
    --dim: #8C99AD;
    --line: #232D3F;
    --pulse: #7A63FF;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
  }
}

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

/* the hidden attribute must always win, whatever display rules say */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ---- the beam: one diagonal shaft of spectral light ---- */

.beamline {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.beamline__glow {
  position: absolute;
  top: 50%; left: 50%;
  width: 200vmax; height: 160px;
  transform: translate(-50%, -50%) rotate(-9deg);
  background: linear-gradient(90deg,
    transparent 8%,
    rgba(43, 217, 255, .13) 30%,
    rgba(122, 90, 255, .16) 52%,
    rgba(255, 169, 77, .12) 74%,
    transparent 92%);
  filter: blur(26px);
}

.beamline__core {
  position: absolute;
  top: 50%; left: 50%;
  width: 200vmax; height: 2px;
  transform: translate(-50%, -50%) rotate(-9deg);
  background: var(--beam-grad);
  opacity: .55;
}

.beamline__core::after {
  content: "";
  position: absolute;
  top: -1px; left: 0;
  width: 140px; height: 4px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 18px 4px rgba(122, 90, 255, .8), 0 0 36px 10px rgba(43, 217, 255, .45);
  animation: travel 7s linear infinite;
}

body.beaming .beamline__core::after { animation-duration: 1.4s; }
body.beaming .beamline__core { opacity: .9; }

@keyframes travel {
  from { transform: translateX(-160px); }
  to   { transform: translateX(200vmax); }
}

@media (prefers-reduced-motion: reduce) {
  .beamline__core::after { animation: none; display: none; }
  * { transition: none !important; }
}

/* the beam needs more light to read as one ray on dark surfaces */
@media (prefers-color-scheme: dark) {
  .beamline__glow {
    background: linear-gradient(90deg,
      transparent 6%,
      rgba(43, 217, 255, .24) 30%,
      rgba(122, 90, 255, .30) 52%,
      rgba(255, 169, 77, .22) 74%,
      transparent 94%);
    filter: blur(30px);
  }
  .beamline__core { opacity: .85; }
}

/* ---- shell ---- */

header, main, footer { position: relative; z-index: 1; }

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 22px clamp(20px, 5vw, 56px);
}

.wordmark {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -.01em;
  text-decoration: none;
  background: var(--beam-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wordmark sup { font-size: .5em; }

.header-note {
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  color: var(--dim);
}

.header-note a { color: inherit; text-decoration: none; }
.header-note a:hover { color: var(--ink); }

.footer-nav { margin-top: 10px; }
.footer-nav a { color: var(--pulse); text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }

main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(16px, 4vh, 48px) clamp(20px, 5vw, 56px) 40px;
}

section[hidden] { display: none; }

section {
  animation: rise .35s ease both;
}

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

h1 {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: clamp(1.55rem, 4.2vw, 2.5rem);
  line-height: 1.18;
  max-width: 17em;
  margin-bottom: .6em;
}

.sub {
  color: var(--dim);
  font-size: 1.05rem;
  max-width: 34em;
  margin-bottom: 2.2em;
}

h2 {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: 1.15rem;
  margin-bottom: .5em;
}

/* ---- cards ---- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .18s ease, transform .18s ease;
}

.card:hover { border-color: var(--violet); transform: translateY(-2px); }
.card:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

.card p { color: var(--dim); font-size: .95rem; margin-top: .45em; }

.card .go {
  display: inline-block;
  margin-top: 1.1em;
  font-family: "IBM Plex Mono", monospace;
  font-size: .85rem;
  font-weight: 600;
  color: var(--pulse);
}

/* ---- hero: copy left, live vignette right; stacks on small screens ---- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
  margin-bottom: clamp(22px, 4.5vh, 44px);
}

.hero .sub { margin-bottom: 0; }

@media (max-width: 840px) {
  .hero { grid-template-columns: 1fr; }
  .hero .howto { justify-self: start; max-width: 520px; }
}

/* ---- how-it-works vignette: laptop pairs with phone, packets fly both ways.
   One shared 10s timeline; every element keys off the same percentages. ---- */

.howto {
  width: 100%;
  max-width: 470px;
  justify-self: end;
}

.howto svg { width: 100%; height: auto; display: block; }

.hw-frame {
  fill: var(--card);
  stroke: var(--line);
  stroke-width: 2;
}

.hw-qrm rect { fill: var(--ink); }

.hw-code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .12em;
  fill: var(--dim);
}

.hw-phone { animation: hw-approach 10s ease-in-out infinite; }

.hw-scan path {
  fill: none;
  stroke: var(--pulse);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.hw-scan rect { fill: var(--dim); }
.hw-scan { animation: hw-scan 10s linear infinite; }

.hw-track {
  stroke: var(--line);
  stroke-width: 1.5;
  stroke-dasharray: 4 7;
  opacity: .8;
}

.hw-beam {
  stroke-width: 2.5;
  stroke-dasharray: 230;
  animation: hw-beam 10s linear infinite;
}

.hw-dot--file {
  fill: #7A5AFF;
  filter: drop-shadow(0 0 5px rgba(122, 90, 255, .95));
  animation: hw-dotfile 10s linear infinite;
}

.hw-dot--back {
  fill: #FFA94D;
  filter: drop-shadow(0 0 5px rgba(255, 169, 77, .95));
  animation: hw-dotback 10s linear infinite;
}

.hw-file rect:first-child, .hw-chip rect:first-child {
  fill: var(--card);
  stroke: var(--violet);
  stroke-width: 1.5;
}

.hw-chip rect:first-child { stroke: var(--amber); }
.hw-chipline { fill: var(--line); stroke: none; }

.hw-file, .hw-chip {
  transform-box: fill-box;
  transform-origin: center;
}

.hw-file { animation: hw-filecard 10s ease-out infinite; }
.hw-chip { animation: hw-chipcard 10s ease-out infinite; }

.hw-caption {
  position: relative;
  height: 1.5em;
  margin-top: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: .82rem;
  color: var(--dim);
}

.hw-caption span { position: absolute; inset: 0; opacity: 0; }
.hw-cap1 { animation: hw-cap1 10s linear infinite; }
.hw-cap2 { animation: hw-cap2 10s linear infinite; }
.hw-cap3 { animation: hw-cap3 10s linear infinite; }

@keyframes hw-approach {
  0% { transform: translateX(16px); }
  10%, 100% { transform: translateX(0); }
}

@keyframes hw-scan {
  0%, 5% { opacity: 0; }
  9%, 15% { opacity: 1; }
  20%, 100% { opacity: 0; }
}

@keyframes hw-beam {
  0%, 12% { stroke-dashoffset: 230; opacity: 0; }
  13% { opacity: .9; }
  21% { stroke-dashoffset: 0; }
  95% { stroke-dashoffset: 0; opacity: .9; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes hw-dotfile {
  0%, 24% { opacity: 0; transform: translateX(0); }
  26% { opacity: 1; }
  40% { opacity: 1; transform: translateX(230px); }
  43%, 100% { opacity: 0; transform: translateX(230px); }
}

@keyframes hw-filecard {
  0%, 39% { opacity: 0; transform: scale(.5); }
  46% { opacity: 1; transform: scale(1); }
  95% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes hw-dotback {
  0%, 56% { opacity: 0; transform: translateX(0); }
  58% { opacity: 1; }
  72% { opacity: 1; transform: translateX(-230px); }
  75%, 100% { opacity: 0; transform: translateX(-230px); }
}

@keyframes hw-chipcard {
  0%, 71% { opacity: 0; transform: scale(.5); }
  78% { opacity: 1; transform: scale(1); }
  95% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

@keyframes hw-cap1 {
  0%, 20% { opacity: 1; }
  24%, 100% { opacity: 0; }
}

@keyframes hw-cap2 {
  0%, 22% { opacity: 0; }
  26%, 50% { opacity: 1; }
  54%, 100% { opacity: 0; }
}

@keyframes hw-cap3 {
  0%, 52% { opacity: 0; }
  56%, 94% { opacity: 1; }
  98%, 100% { opacity: 0; }
}

/* on dark surfaces the devices need their own light to read instantly */
@media (prefers-color-scheme: dark) {
  .hw-frame { fill: #151D2E; stroke: #3B475F; }
  .hw-file rect:first-child, .hw-chip rect:first-child { fill: #1C2540; }
  .hw-track { opacity: 1; }
}

/* static fallback: everything visible, plain caption */
@media (prefers-reduced-motion: reduce) {
  .hw-phone, .hw-beam, .hw-dot--file, .hw-dot--back,
  .hw-file, .hw-chip, .hw-scan, .hw-caption span { animation: none; }
  .hw-beam { stroke-dashoffset: 0; opacity: .9; }
  .hw-scan { opacity: 0; }
  .hw-dot--file, .hw-dot--back { opacity: 1; transform: translateX(115px); }
  .hw-dot--back { transform: translateX(-115px); }
  .hw-file, .hw-chip { opacity: 1; }
  .hw-caption { height: auto; }
  .hw-caption span { position: static; opacity: 0; display: none; }
  .hw-caption .hw-cap3 { display: block; opacity: 1; }
}

.join-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--dim);
  font-size: .95rem;
}

/* ---- inputs & buttons ---- */

input[type="text"], textarea, select {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .6em .8em;
}

input[type="text"]:focus-visible, textarea:focus-visible, select:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 1px;
}

#join-code {
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .18em;
  width: 9.5em;
}

.btn {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 11px;
  padding: .68em 1.35em;
  cursor: pointer;
  background: var(--pulse);
  color: var(--pulse-ink);
  transition: transform .15s ease, filter .15s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn--ghost:hover { border-color: var(--violet); filter: none; }

.back {
  display: inline-block;
  margin-bottom: 1.4em;
  color: var(--dim);
  font-size: .9rem;
  text-decoration: none;
}

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

/* ---- host / pairing view ---- */

.pairing {
  display: flex;
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
  flex-wrap: wrap;
}

.qr-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
  line-height: 0;
}

.qr-card svg { width: clamp(180px, 30vw, 240px); height: auto; }

.pair-info { max-width: 24em; }

.big-code {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: .32em;
  margin: .35em 0 .5em;
  padding-left: .1em;
}

.status {
  font-family: "IBM Plex Mono", monospace;
  font-size: .82rem;
  color: var(--dim);
  margin: 1em 0 1.4em;
}

.status.live { color: var(--pulse); }

/* ---- transfer view ---- */

/* layout state lives in one place: JS toggles .solo together with [hidden] */
.link-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-areas:
    "main invite"
    "transfers invite";
  gap: 4px 24px;
  align-items: start;
}

.link-main { grid-area: main; }
.invite { grid-area: invite; }
.transfers { grid-area: transfers; }

.link-grid.solo {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main" "transfers";
}

.invite .qr-card { padding: 12px; display: inline-block; }
.invite .qr-card svg { width: 100%; max-width: 196px; }

.invite-code {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: .28em;
  margin: 10px 0 6px;
}

@media (max-width: 720px) {
  .link-grid,
  .link-grid.solo {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main" "invite" "transfers";
  }
  .invite:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }
  .invite .qr-card svg { max-width: 120px; }
  .invite .note { flex: 1; min-width: 12em; }
  .invite-code { margin: 0; }
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: clamp(28px, 6vh, 52px) 24px;
  text-align: center;
  color: var(--dim);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  margin-bottom: 16px;
}

.dropzone.over, .dropzone:hover { border-color: var(--violet); }
.dropzone strong { color: var(--ink); }

/* whole-window drop affordance while a drag is in flight */
body.dragging .dropzone { border-color: var(--violet); }

body.dragging::after {
  content: "Drop anywhere to beam";
  position: fixed;
  inset: 12px;
  z-index: 25;
  border: 2px dashed var(--violet);
  border-radius: 18px;
  background: rgba(122, 90, 255, .07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Unbounded", sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--pulse);
  pointer-events: none;
}

/* in a chat room the drop sends into the conversation */
body.chatting.dragging::after { content: "Drop anywhere to send"; }

.textrow { display: flex; gap: 10px; margin-bottom: 22px; }
.textrow input { flex: 1; min-width: 0; }

.transfers { display: flex; flex-direction: column; gap: 10px; }

.tx {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: .95rem;
  overflow-wrap: anywhere;
}

.tx .meta { flex: 1; min-width: 0; }
.tx .name { font-weight: 700; }
.tx .detail { font-family: "IBM Plex Mono", monospace; font-size: .75rem; color: var(--dim); }
.tx .bar { height: 3px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.tx .bar i { display: block; height: 100%; width: 0; background: var(--beam-grad); transition: width .2s linear; }
.tx a { color: var(--pulse); font-weight: 700; text-decoration: none; white-space: nowrap; }
.tx .txt { white-space: pre-wrap; word-break: break-word; }

/* ---- private chat ---- */

/* app mode: the chat fills the viewport — log flexes, composer stays pinned */
body.chatting footer { display: none; }

body.chatting main {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 72px);
  padding-top: 4px;
  padding-bottom: 14px;
  overflow: hidden;
}

body.chatting #view-chat {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.chatting #view-chat .back { margin-bottom: .6em; }
body.chatting #chat-title { font-size: 1.05rem; margin-bottom: .2em; }
body.chatting #chat-status { margin: .2em 0 .8em; }

.chat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.chat-top .members { margin-bottom: 0; }

.nickchip {
  font-family: "IBM Plex Mono", monospace;
  font-size: .74rem;
  width: 9em;
  flex: none;
  padding: .4em .8em;
  border-radius: 999px;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--dim);
}

.nickchip:focus-visible { color: var(--ink); border-style: solid; }

/* the shared .invite class carries grid-area: invite — every grid hosting it
   must name that area explicitly or the item lands in implicit tracks */
.chat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  grid-template-areas: "main invite";
  grid-template-rows: minmax(0, 1fr);
  gap: 20px 24px;
  align-items: stretch;
  margin-top: 6px;
  flex: 1;
  min-height: 0;
}

.chat-grid .invite { align-self: start; }

.chat-main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-grid:has(.invite[hidden]) {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main";
}

.members {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 1.6em;
}

.member {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "IBM Plex Mono", monospace;
  font-size: .74rem;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .25em .8em;
  background: var(--card);
}

.member i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  flex: 1 1 auto;
  min-height: 160px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.msg { max-width: 78%; align-self: flex-start; }
.msg.mine { align-self: flex-end; text-align: right; }

.msg .who {
  font-family: "IBM Plex Mono", monospace;
  font-size: .68rem;
  font-weight: 600;
  margin-bottom: 3px;
}

.msg .bubble {
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .5em .85em;
  font-size: .95rem;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

.msg.mine .bubble {
  background: var(--pulse);
  border-color: var(--pulse);
  color: var(--pulse-ink);
}

.chat-sys {
  align-self: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  color: var(--dim);
}

.msg .ts { opacity: .65; font-weight: 400; }
.msg.mine .who { color: var(--dim); }

.chat-img {
  display: block;
  max-width: min(280px, 100%);
  max-height: 320px;
  border-radius: 9px;
  cursor: zoom-in;
}

.bubble.media { padding: 5px; line-height: 0; }

.msg .bubble a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.chat-typing {
  min-height: 1.3em;
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  color: var(--dim);
  margin-bottom: 6px;
}

.btn--icon {
  padding: .68em .95em;
  font-weight: 700;
  flex: none;
}

.chat-row { display: flex; gap: 10px; }
.chat-row input { flex: 1; min-width: 0; }

.chat-nickrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.chat-nickrow input { width: 16em; max-width: 100%; }

@media (max-width: 720px) {
  .chat-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "invite" "main";
  }
  .chat-grid:has(.invite[hidden]) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
  }
  .chat-grid .invite:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
  }
  .chat-grid .invite .qr-card svg { max-width: 110px; }
  .msg { max-width: 92%; }
}

/* ---- secrets ---- */

textarea#secret-text {
  width: 100%;
  min-height: 9.5em;
  resize: vertical;
  margin-bottom: 14px;
}

.secret-opts {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  color: var(--dim);
  font-size: .95rem;
}

.linkbox {
  display: flex;
  gap: 10px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}

.linkbox input {
  flex: 1;
  min-width: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: .82rem;
}

.note { color: var(--dim); font-size: .9rem; }
.note.warn { color: var(--danger); }

.reveal-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 40em;
}

#reveal-text {
  font-family: "IBM Plex Mono", monospace;
  font-size: .92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 1em 0;
}

/* reveal ceremony: sealed while waiting, decrypt once, consequence lands last */

.seal { margin-bottom: 16px; width: 56px; }
.seal svg { width: 100%; height: auto; display: block; }

.seal-ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
  stroke-dasharray: 4 7;
  transform-box: fill-box;
  transform-origin: center;
}

.seal-shackle {
  fill: none;
  stroke: var(--pulse);
  stroke-width: 4;
  stroke-linecap: round;
}

.seal-body { fill: var(--pulse); }
.seal-dot { fill: var(--paper); }

@media (prefers-reduced-motion: no-preference) {
  .seal-ring { animation: seal-turn 40s linear infinite; }
  .seal svg { animation: seal-breathe 3.5s ease-in-out infinite; }

  #reveal-text.materialize { animation: materialize .7s ease-out both; }

  #reveal-out .note.warn {
    opacity: 0;
    animation: warn-in .5s ease-out .9s forwards;
  }
}

@keyframes seal-turn { to { transform: rotate(360deg); } }

@keyframes seal-breathe {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(122, 90, 255, .3)); }
  50% { filter: drop-shadow(0 0 10px rgba(122, 90, 255, .65)); }
}

@keyframes materialize {
  from { opacity: 0; filter: blur(8px); }
  to { opacity: 1; filter: none; }
}

@keyframes warn-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---- faq ---- */

.faq {
  margin-top: clamp(34px, 7vh, 64px);
  max-width: 46em;
}

.faq h2 { margin-bottom: .7em; }

.faq details {
  border-top: 1px solid var(--line);
  padding: 15px 0;
}

.faq details:last-of-type { border-bottom: 1px solid var(--line); }

.faq summary {
  cursor: pointer;
  font-weight: 700;
}

.faq summary::marker { color: var(--pulse); }

.faq summary:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.faq details p {
  color: var(--dim);
  margin-top: 10px;
  max-width: 44em;
}

/* ---- QR scanner ---- */

#scanner {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(8, 11, 18, .7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.scan-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  width: min(440px, 100%);
  text-align: center;
}

.scan-panel video {
  width: 100%;
  max-height: 60dvh;
  border-radius: 10px;
  background: #000;
}

.scan-panel .note { margin: 12px 0; }

/* ---- preview lightbox ---- */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(8, 11, 18, .6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

#lightbox[hidden] { display: none; }

.lb-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(920px, 100%);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}

.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.lb-body {
  overflow: auto;
  padding: 14px;
  display: flex;
  justify-content: center;
}

.lb-body img, .lb-body video {
  max-width: 100%;
  max-height: 64dvh;
  border-radius: 8px;
}

.lb-body iframe {
  width: 100%;
  height: 64dvh;
  border: 0;
}

.lb-body audio { width: 100%; align-self: center; }

.lb-body pre {
  width: 100%;
  max-height: 64dvh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: .82rem;
}

.lb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}

.lb-foot .btn { text-decoration: none; }

/* ---- secret lifecycle vignette: write → encrypt → link → burn ---- */

.secret-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

@media (max-width: 840px) {
  .secret-grid { grid-template-columns: 1fr; }
  .secret-viz { max-width: 340px; }
}

.secret-viz svg { width: 100%; height: auto; display: block; }

.sv-frame {
  fill: var(--card);
  stroke: var(--line);
  stroke-width: 2;
}

.sv-line { fill: var(--dim); }
.sv-cipher rect { fill: var(--violet); opacity: .85; }
.sv-cipher { opacity: 0; animation: sv-cipher 12s linear infinite; }

.sv-cardg { animation: sv-cardg 12s ease-in-out infinite; }
.sv-lines { animation: sv-lines 12s linear infinite; }

.sv-line {
  transform-box: fill-box;
  transform-origin: left center;
  animation: sv-linegrow 12s ease-out infinite;
}

.sv-l2 { animation-name: sv-linegrow2; }
.sv-l3 { animation-name: sv-linegrow3; }
.sv-l4 { animation-name: sv-linegrow4; }

.sv-burn { opacity: 0; animation: sv-burn 12s linear infinite; }

.sv-lock rect { fill: var(--pulse); }
.sv-lock circle { fill: var(--paper); }
.sv-shackle {
  fill: none;
  stroke: var(--pulse);
  stroke-width: 4;
  stroke-linecap: round;
}

.sv-lock {
  transform-box: fill-box;
  transform-origin: center;
  animation: sv-lock 12s ease-out infinite;
}

.sv-chip rect {
  fill: var(--card);
  stroke: var(--violet);
  stroke-width: 1.5;
}

.sv-chip circle { fill: var(--violet); }

.sv-chip text {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  fill: var(--ink);
}

.sv-chip {
  transform-box: fill-box;
  transform-origin: center;
  animation: sv-chip 12s ease-out infinite;
}

.sv-caption {
  position: relative;
  height: 1.5em;
  margin-top: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: .82rem;
  color: var(--dim);
  text-align: center;
}

.sv-caption span { position: absolute; inset: 0; opacity: 0; }
.sv-cap1 { animation: sv-cap1 12s linear infinite; }
.sv-cap2 { animation: sv-cap2 12s linear infinite; }
.sv-cap3 { animation: sv-cap3 12s linear infinite; }
.sv-cap4 { animation: sv-cap4 12s linear infinite; }

@keyframes sv-cardg {
  0% { opacity: 0; transform: translateY(8px); }
  5%, 84% { opacity: 1; transform: none; }
  93%, 100% { opacity: 0; transform: translateY(-10px); }
}

@keyframes sv-linegrow  { 0% { transform: scaleX(0); } 4%  { transform: scaleX(0); } 8%  { transform: scaleX(1); } 100% { transform: scaleX(1); } }
@keyframes sv-linegrow2 { 0% { transform: scaleX(0); } 6%  { transform: scaleX(0); } 10% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
@keyframes sv-linegrow3 { 0% { transform: scaleX(0); } 8%  { transform: scaleX(0); } 12% { transform: scaleX(1); } 100% { transform: scaleX(1); } }
@keyframes sv-linegrow4 { 0% { transform: scaleX(0); } 10% { transform: scaleX(0); } 14% { transform: scaleX(1); } 100% { transform: scaleX(1); } }

@keyframes sv-lines {
  0%, 20% { opacity: 1; }
  26%, 100% { opacity: 0; }
}

@keyframes sv-cipher {
  0%, 21% { opacity: 0; }
  27%, 100% { opacity: 1; }
}

@keyframes sv-lock {
  0%, 19% { opacity: 0; transform: scale(.4); }
  24%, 86% { opacity: 1; transform: scale(1); }
  93%, 100% { opacity: 0; transform: scale(1); }
}

@keyframes sv-chip {
  0%, 33% { opacity: 0; transform: scale(.6); }
  38%, 58% { opacity: 1; transform: scale(1); }
  61% { transform: scale(1.07); }
  64%, 68% { opacity: 1; transform: scale(1); }
  78%, 100% { opacity: .15; transform: scale(1); }
}

@keyframes sv-burn {
  0%, 64% { opacity: 0; }
  76%, 84% { opacity: .9; }
  93%, 100% { opacity: 0; }
}

@keyframes sv-cap1 { 0%, 16% { opacity: 1; } 20%, 100% { opacity: 0; } }
@keyframes sv-cap2 { 0%, 18% { opacity: 0; } 22%, 30% { opacity: 1; } 34%, 100% { opacity: 0; } }
@keyframes sv-cap3 { 0%, 32% { opacity: 0; } 36%, 56% { opacity: 1; } 60%, 100% { opacity: 0; } }
@keyframes sv-cap4 { 0%, 58% { opacity: 0; } 62%, 88% { opacity: 1; } 94%, 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .sv-cardg, .sv-lines, .sv-line, .sv-cipher, .sv-lock, .sv-chip,
  .sv-burn, .sv-caption span { animation: none; }
  .sv-cardg, .sv-cipher, .sv-lock, .sv-chip { opacity: 1; }
  .sv-lines { opacity: 0; }
  .sv-caption { height: auto; }
  .sv-caption span { display: none; position: static; }
  .sv-caption .sv-cap4 { display: block; opacity: 1; }
}

.charcount {
  text-align: right;
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  color: var(--dim);
  margin: -8px 0 10px;
}

.charcount.warn { color: var(--danger); }

/* ---- article pages (docs, security) ---- */

.page { max-width: 46em; padding-bottom: 20px; }

.page h1 {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  margin-bottom: .5em;
}

.page .lede { color: var(--dim); font-size: 1.05rem; margin-bottom: 2.2em; }

.page h2 {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: 1.15rem;
  margin: 2em 0 .6em;
}

.page h3 { font-size: 1rem; margin: 1.5em 0 .4em; }

.page p { margin: .8em 0; }
.page ul, .page ol { margin: .8em 0 .8em 1.5em; }
.page li { margin: .5em 0; }
.page li::marker { color: var(--pulse); }

.page a { color: var(--pulse); text-decoration: none; }
.page a:hover { text-decoration: underline; }

.page code {
  font-family: "IBM Plex Mono", monospace;
  font-size: .85em;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .08em .35em;
}

.page table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: .92rem;
}

.page th {
  font-family: "IBM Plex Mono", monospace;
  font-size: .72rem;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.page th, .page td {
  text-align: left;
  padding: .55em .8em .55em 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

/* ---- SEO prose band: ways to use beam ---- */

.uses {
  margin-top: clamp(38px, 8vh, 72px);
  max-width: 60em;
}

.uses h2 {
  font-family: "Unbounded", sans-serif;
  font-weight: 500;
  font-size: 1.15rem;
  margin-bottom: .5em;
}

.uses-lede {
  color: var(--dim);
  max-width: 42em;
  margin-bottom: 1.8em;
}

.uses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.uses-grid article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
}

.uses-grid h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .4em;
}

.uses-grid p { color: var(--dim); font-size: .93rem; }

.uses-foot {
  color: var(--dim);
  font-size: .93rem;
  margin-top: 1.6em;
  max-width: 42em;
}

.uses a { color: var(--pulse); text-decoration: none; }
.uses a:hover { text-decoration: underline; }

/* ---- footer & toast ---- */

footer {
  padding: 26px clamp(20px, 5vw, 56px) 34px;
  color: var(--dim);
  font-size: .82rem;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

footer .fine { max-width: 52em; }

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--paper);
  padding: .7em 1.2em;
  border-radius: 10px;
  font-size: .92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 10;
  max-width: min(90vw, 34em);
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .pairing { justify-content: center; text-align: center; }
  .big-code { letter-spacing: .22em; }
  .textrow { flex-direction: column; }
}
