/* =====================================================================
   Landing — minimal, optimized.
   Used by: index.html, privacy.html, terms.html
   ===================================================================== */

/* ---- Page shell ----------------------------------------------------- */
html, body { overflow-x: hidden; overflow-y: auto; background: #000; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Smoother momentum scroll on iOS */
  -webkit-overflow-scrolling: touch;
  /* Prevent rubber-band over-scroll color flash */
  overscroll-behavior-y: none;
}
body > main   { flex: 1 0 auto; position: relative; z-index: 1; }
body > footer { flex-shrink: 0; position: relative; z-index: 1; }

/* ---- Background ambient blobs (animated) ---------------------------
   3 blobs only (was 5) with smaller blur radius for cheaper GPU work.
   `contain: strict` isolates layout/paint from the rest of the page. */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}
.hero-bg-blob {
  position: absolute;
  width: 55vw;
  height: 55vw;
  min-width: 320px;
  min-height: 320px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  will-change: opacity, transform;
  animation: blob-breathe 24s ease-in-out infinite;
}
.hero-bg-blob--1 {
  top: -20%; left: -18%;
  background: radial-gradient(circle, #555 0%, transparent 70%);
}
.hero-bg-blob--2 {
  top: 10%; right: -22%;
  background: radial-gradient(circle, #4a4a4a 0%, transparent 70%);
  animation-delay: -8s;
}
.hero-bg-blob--3 {
  bottom: -25%; left: 25%;
  background: radial-gradient(circle, #484848 0%, transparent 70%);
  animation-delay: -16s;
}
/* The 4th and 5th blob nodes from the markup are kept hidden so the HTML
   doesn't need touching, but they don't paint or animate. */
.hero-bg-blob--4,
.hero-bg-blob--5 { display: none; }

@keyframes blob-breathe {
  0%, 100% { opacity: 0;    transform: scale(0.92) translate3d(0, 0, 0); }
  50%      { opacity: 0.24; transform: scale(1.06) translate3d(1%, -1%, 0); }
}
@media (max-width: 600px) {
  .hero-bg-blob {
    width: 80vw; height: 80vw;
    filter: blur(60px);
  }
  @keyframes blob-breathe {
    0%, 100% { opacity: 0;    transform: scale(0.92) translate3d(0, 0, 0); }
    50%      { opacity: 0.18; transform: scale(1.06) translate3d(1%, -1%, 0); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .hero-bg-blob { animation: none; opacity: 0.12; }
}

/* ---- Header --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.78);
  border-bottom: 1px solid var(--border);
  /* backdrop-filter is GPU-expensive on mobile — use only on capable devices */
}
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  @media (min-width: 720px) {
    .site-header {
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: saturate(140%) blur(8px);
      -webkit-backdrop-filter: saturate(140%) blur(8px);
    }
  }
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-white);
  color: #000;
  font-size: 10px;
  line-height: 1;
}
.brand-domain { color: var(--text-secondary); }

/* ---- Layout root ---------------------------------------------------- */
.landing {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px 48px;
  width: 100%;
}
.landing--minimal {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 720px) {
  .landing { padding: 40px 20px 32px; }
}

/* ---- Hero ----------------------------------------------------------- */
.hero {
  position: relative;
  z-index: 1;
}
.hero--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero--minimal {
  padding-top: 16px;
  padding-bottom: 16px;
}
.hero-title {
  margin: 0 0 20px;
  font-size: clamp(38px, 7vw, 80px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.045em;
  max-width: 14ch;
  background: linear-gradient(180deg, #fff 0%, #b9b9b9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 0 0 32px;
  color: var(--text-secondary);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.55;
  max-width: 560px;
}
.unsupported {
  margin-top: 20px;
  color: var(--accent-warn);
  font-size: 13px;
}

/* =====================================================================
   Flip card (rcard) — front: generate, back: join by ID
   ===================================================================== */
.rcard {
  perspective: 1400px;
  width: 100%;
  max-width: 560px;
  margin: 24px auto 8px;
}
.rcard-inner {
  position: relative;
  width: 100%;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(.4, .2, .2, 1);
}
.rcard[data-side="back"] .rcard-inner { transform: rotateY(180deg); }

.rcard-face {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: border-color 200ms ease;
}
.rcard-face:hover { border-color: rgba(255, 255, 255, 0.07); }
.rcard-face--front { position: relative; z-index: 2; }
.rcard-face--back  { position: absolute; inset: 0; transform: rotateY(180deg); }

.rcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.rcard-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}
.rcard-flip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.rcard-flip:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-elevated);
}

/* ---- ID display (front) -------------------------------------------- */
.rid-display {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  width: 100%;
  padding: 18px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(13px, 2.4vw, 16px);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.rid-display:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }

.rid-block {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 1ch;
  white-space: nowrap;
}
.rid-sep { color: var(--text-secondary); opacity: 0.7; }

/* Per-character cell — used both for placeholder squares and rolling chars */
.rid-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.7em;
  height: 0.9em;
  line-height: 1;
  border-radius: 1px;
  font-variant-numeric: tabular-nums;
}
.rid-char--placeholder {
  background: var(--text-secondary);
  color: transparent;
  animation: ridPulse 2s ease-in-out infinite;
}
.rid-char--rolling  { color: var(--text-primary); background: transparent; }
.rid-char--settled  { color: var(--text-primary); background: transparent; animation: charSettle 180ms ease-out; }
@keyframes charSettle {
  from { transform: translateY(-2px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes ridPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.85; }
}

/* States — synced pulse on box + chars */
.rcard[data-state="idle"]  .rid-display,
.rcard[data-state="ready"] .rid-display {
  animation: ridBoxPulse 2s ease-in-out infinite;
}
.rcard[data-state="loading"] .rid-display { cursor: progress; }
@keyframes ridBoxPulse {
  0%, 100% { border-color: var(--border);       background: var(--bg-elevated); }
  50%      { border-color: var(--border-hover); background: #131313; }
}
/* Hover freezes pulse */
.rcard[data-state="idle"]  .rid-display:hover,
.rcard[data-state="ready"] .rid-display:hover {
  animation: none;
  border-color: rgba(255, 255, 255, 0.07);
  background: #111;
}
.rcard[data-state="idle"]  .rid-display:hover .rid-char--placeholder,
.rcard[data-state="ready"] .rid-display:hover .rid-char--placeholder {
  animation-play-state: paused;
  opacity: 0.65;
}
@media (prefers-reduced-motion: reduce) {
  .rid-char--placeholder,
  .rcard[data-state="idle"]  .rid-display,
  .rcard[data-state="ready"] .rid-display { animation: none; }
}

/* ---- Action buttons (icon-only) ------------------------------------ */
.rcard-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.rcard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 44px; height: 44px;
  padding: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease;
}
.rcard-btn:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: #1a1a1a;
}
.rcard-btn:active:not(:disabled) { transform: translateY(1px); }
.rcard-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rcard-btn--primary {
  background: var(--text-primary);
  color: #000;
  border-color: var(--text-primary);
}
.rcard-btn--primary:hover:not(:disabled) {
  background: #fff;
  border-color: #fff;
}
.rcard-btn--wide {
  width: auto;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 500;
}
.rcard-btn.is-copied {
  background: rgba(0, 200, 83, 0.14);
  border-color: rgba(0, 200, 83, 0.5);
  color: var(--accent-success);
}

.rcard-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
}

/* ---- ID input (back) ----------------------------------------------- */
.rid-input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 12px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.rid-input {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(13px, 2.4vw, 16px);
  text-align: center;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  outline: none;
  padding: 6px 4px;
  width: calc(1ch * var(--w, 4) + 14px);
  letter-spacing: 0.04em;
}
.rid-input[maxlength="8"]  { --w: 8;  }
.rid-input[maxlength="4"]  { --w: 4;  }
.rid-input[maxlength="12"] { --w: 12; }
.rid-input::placeholder { color: var(--text-disabled); opacity: 0.6; }
.rid-input:focus { color: var(--accent-blue); }

/* =====================================================================
   QR modal — scoped to #qr-* IDs to avoid base.css conflicts
   ===================================================================== */
#qr-modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#qr-modal[hidden] { display: none; }
#qr-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
#qr-dialog {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 340px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  isolation: isolate;
}
#qr-modal-title { margin: 0; font-size: 16px; font-weight: 500; }
#qr-frame {
  width: 240px; height: 240px;
  padding: 12px;
  background: #fff;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
#qr-frame canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#modal-link {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
  text-align: center;
  max-width: 100%;
}
body.modal-open { overflow: hidden; }
html:has(body.modal-open) { overflow: hidden; }

/* =====================================================================
   Footer — single centered row
   ===================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  background: #000;
}
.footer-bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-disabled);
  flex-wrap: wrap;
}
.footer-bar-copy   { white-space: nowrap; }
.footer-bar-group  { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.footer-status     { display: inline-flex; align-items: center; gap: 6px; }
.footer-sep        { color: var(--text-disabled); user-select: none; opacity: 0.5; }
.author-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 150ms ease;
}
.author-link:hover { color: var(--text-primary); text-decoration: none; }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-disabled);
  flex-shrink: 0;
  transition: background 150ms ease, box-shadow 150ms ease;
}
.status-dot[data-state="checking"] {
  background: var(--text-disabled);
  animation: dot-pulse 1.6s ease-in-out infinite;
}
.status-dot[data-state="ok"] {
  background: var(--accent-success);
  box-shadow: 0 0 8px rgba(0, 200, 83, 0.6);
  animation: dot-pulse 2.4s ease-in-out infinite;
}
.status-dot[data-state="down"] {
  background: var(--accent-error);
  box-shadow: 0 0 8px rgba(229, 57, 53, 0.6);
}
@keyframes dot-pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1;   }
}
@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none !important; }
}

/* ---- Mobile footer ------------------------------------------------- */
@media (max-width: 720px) {
  .footer-bar { gap: 8px; padding: 12px 16px; }
  .footer-sep { display: none; }
}

/* ---- Mobile flip card ---------------------------------------------- */
@media (max-width: 560px) {
  .rcard-face { padding: 20px; }
  .rid-display, .rid-input-group { font-size: 13px; padding: 14px 8px; }
  /* Back face: ensure enough room for inputs + button — absolute inset
     would clip if front is shorter, so set a floor height. */
  .rcard-face--back { min-height: 300px; }
  #qr-dialog { padding: 22px; }
  #qr-frame { width: 200px; height: 200px; }
}
