/*
 * site.css — styles for the static public site.
 *
 * v2 (app-like): the home is a bare contacts agenda, the contact card is a
 * centered "call screen" (round selfie + online dot + big green call button),
 * and the marketing copy lives on /how-it-works.
 *
 * Constraints (Intel Mac 2015 / modest phones): no backdrop-blur, no CSS
 * filters, no costly effects. Mobile-first. Tap targets >= 44px. AA contrast.
 */

:root {
  --doa-pink: #ff65a3;
  --doa-blue: #56bdfa;
  --call-green: #25d366;
  --call-green-hover: #2fe377;
  --on-green: #06210f; /* near-black; AA on --call-green */
  --bg: #000;
  --surface: #111;
  --surface-2: #1a1a1a;
  --border: #2a2a2a;
  --text: #ffffff;
  --muted: #b3b3b3; /* AA on #000 and #111 */
  --dim: #8a8a8a;
  --maxw: 620px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

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

/* Any author display rule (flex, inline-flex, …) overrides the UA [hidden]
   rule — without this guard, hidden elements render anyway. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--doa-blue);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--doa-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2 {
  line-height: 1.25;
  font-weight: 800;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--doa-pink);
  color: #000;
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  max-width: var(--maxw);
  margin: 0 auto;
}

.logo {
  font-weight: 900;
  font-style: italic;
  letter-spacing: -1px;
  font-size: 20px;
  color: var(--doa-pink);
}

.logo:hover,
.logo:focus-visible {
  text-decoration: none;
}

.logo span {
  color: var(--doa-blue);
}

/* ---------- layout ---------- */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 48px;
}

/* ---------- home (agenda) ---------- */
.home-tagline {
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
  margin: 2px 0 8px;
}

/* Definitional subhead — subtle, app-like caption; also the home's citable line. */
.home-sub {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 22px;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.contact-item {
  border-bottom: 1px solid var(--border);
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 8px;
  min-height: 44px;
  color: var(--text);
  border-radius: 10px;
}

.contact-link:hover,
.contact-link:focus-visible {
  text-decoration: none;
  background: var(--surface);
}

.contact-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  flex: 0 0 auto;
}

.contact-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-name {
  font-weight: 700;
  font-size: 17px;
}

.contact-status {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--doa-blue);
  border: 1px solid rgba(86, 189, 250, 0.35);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}

.contact-call {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--call-green);
  background: rgba(37, 211, 102, 0.12);
  border-radius: 50%;
}

/* ---------- contact card (call screen) ---------- */
.call-screen {
  padding-top: 8px;
}

.card {
  text-align: center;
}

.card-selfie-wrap {
  position: relative;
  display: inline-block;
  margin: 8px auto 14px;
}

.card-selfie {
  width: 184px;
  height: 184px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 3px solid var(--surface-2);
}

/* Live 3D avatar host on merged pages — fills the selfie circle; main.js
   mounts #avatar-container (.avatar-in-card) here once the app boots. The
   z-indexes keep the online dot above the WebGL canvas (which is z-index:1). */
.site-avatar-viewport {
  position: absolute;
  inset: 3px; /* match the selfie's border so the circle sizes align */
  border-radius: 50%;
  overflow: hidden;
}

/* "Connecting…" state while the embedded app boots: site.js flags the wrap,
   the photo hides and a spinner takes the circle; main.js unflags on mount
   (or restores the photo if the boot fails). Transform-only animation —
   compositor-cheap, fine on legacy hardware. */
.card-selfie-wrap.is-booting .card-selfie {
  visibility: hidden;
}

.card-selfie-wrap.is-booting .site-avatar-viewport {
  background: var(--surface-2);
}

.card-selfie-wrap.is-booting .site-avatar-viewport::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--doa-pink);
  animation: doa-spin 0.9s linear infinite;
}

@keyframes doa-spin {
  to {
    transform: rotate(360deg);
  }
}

.online-dot {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--call-green);
  border: 4px solid var(--bg);
  z-index: 2;
}

.card-name {
  font-size: 27px;
  font-weight: 800;
  margin: 0;
}

/* Single line under the name: only the (curated) status. balance keeps a
   two-line wrap symmetric (an unbalanced wrap read as off-center). */
.card-status {
  color: var(--muted);
  font-size: 15px;
  max-width: 32ch;
  margin: 8px auto 0;
  text-wrap: balance;
}

.cta-call {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--call-green);
  color: var(--on-green);
  font-weight: 800;
  font-size: 18px;
  padding: 16px 28px;
  min-height: 56px;
  border-radius: 999px;
  width: 100%;
  max-width: 340px;
  margin: 20px auto 0;
}

.cta-call:hover,
.cta-call:focus-visible {
  text-decoration: none;
  background: var(--call-green-hover);
}

.cta-icon {
  flex: 0 0 auto;
}

.card-disclosure {
  color: var(--dim);
  font-size: 12px;
  margin: 10px 0 0;
}

.chips-label {
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 22px 0 0;
}

.card-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 8px 0 4px;
}

.about {
  text-align: left;
  margin-top: 28px;
}

.about h2 {
  font-size: 18px;
  margin: 0 0 10px;
}

.about p {
  color: var(--muted);
  margin: 0;
}

/* Per-avatar FAQ on the call screen — folded, left-aligned like About. */
.card-faq {
  text-align: left;
  margin-top: 22px;
}

.card-faq h2 {
  font-size: 18px;
  margin: 0 0 4px;
}

/* ---------- related ---------- */
/* "Also in your contacts" reuses the agenda row styles (.contact-list /
   .contact-item / .contact-link) so every surface shares one visual language. */
.related {
  margin-top: 36px;
}

.related h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.all-contacts {
  display: inline-block;
  margin-top: 16px;
  font-weight: 600;
}

/* ---------- how-it-works page ---------- */
.how-it-works h1 {
  font-size: 28px;
  margin: 8px 0 24px;
}

.how-it-works section {
  margin-top: 32px;
}

.how-it-works h2 {
  font-size: 19px;
  margin: 0 0 14px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.steps li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--muted);
}

.step-n {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--doa-pink);
  color: #000;
  font-weight: 800;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.feature-list li {
  color: var(--muted);
  padding-left: 18px;
  position: relative;
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--doa-blue);
}

.feature-list strong {
  color: var(--text);
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: '+';
  color: var(--doa-pink);
  font-weight: 800;
}

.faq-item[open] summary::before {
  content: '\2212'; /* minus */
}

.faq-item p {
  color: var(--muted);
  margin: 8px 0 0;
}

.cta-secondary {
  display: inline-block;
  margin-top: 32px;
  font-weight: 700;
  font-size: 17px;
  color: var(--doa-pink);
}

/* ---------- legal pages ---------- */
/* Restyles the app's /legal fragments (inline styles are stripped at build). */
.legal {
  padding-top: 8px;
}

.legal-content h3 {
  font-size: 24px;
  font-weight: 800;
  margin: 8px 0 16px;
}

.legal-content h4 {
  font-size: 18px;
  margin: 28px 0 8px;
}

.legal-content h5 {
  font-size: 15px;
  margin: 20px 0 6px;
  color: var(--text);
}

.legal-content p {
  color: var(--muted);
  margin: 0 0 12px;
}

.legal-content ul,
.legal-content ol {
  color: var(--muted);
  padding-left: 22px;
  margin: 0 0 12px;
}

.legal-content li {
  margin: 4px 0;
}

.legal-content a {
  color: var(--doa-blue);
}

.legal-content strong {
  color: var(--text);
}

.legal-content code {
  font-family: monospace;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}

.legal-content form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.legal-content input,
.legal-content textarea {
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  font: inherit;
}

.legal-content textarea {
  resize: vertical;
}

.legal-content button,
.legal-content .btn {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  min-height: 48px;
  background: var(--doa-pink);
  color: #000;
  font-weight: 800;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- merged contact pages (preloaded app) ---------- */
/* The full app rides inside #doa-app-root and boots hidden on page load
   (avatar + scene preloaded, like the original landings). visibility (not
   display) keeps layout so the 3D canvas sizes correctly, and hidden elements
   don't hit-test — the static card stays clickable. main.js flips .doa-in-app
   on the "Video call" click and the call starts in place. */
#doa-app-root {
  position: fixed;
  inset: 0;
  visibility: hidden;
}

body.doa-in-app #doa-app-root {
  visibility: visible;
}

body.doa-in-app #doa-site-root {
  display: none;
}

body.doa-in-app {
  overflow: hidden;
  /* Restore the app's typography baseline (site.css loads after the app CSS
     and would otherwise win the body cascade with its 16px/1.6). */
  font-size: var(--font-base, 13px);
  line-height: normal;
}

/* ---------- 404 ---------- */
.not-found h1 {
  font-size: 24px;
  margin-top: 24px;
}

/* ---------- footer ---------- */
.site-footer {
  max-width: var(--maxw);
  margin: 32px auto 0;
  padding: 24px 20px calc(36px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 13px;
}

.footer-links a {
  color: var(--muted);
}

.footer-note {
  color: var(--dim);
  font-size: 13px;
  margin: 14px 0 0;
}

/* ---------- larger screens ---------- */
@media (min-width: 720px) {
  .how-it-works h1 {
    font-size: 32px;
  }

  .card-name {
    font-size: 30px;
  }
}
