/* docs/css/style.css */
/* The Lamp theme: indigo for depth, amber for the moment something becomes clear. The fonts are
   served by Cognisophia itself (docs/vendor/fonts, fetched by scripts/vendor.sh), never by a third
   party. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/vendor/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/vendor/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 500; font-display: swap; src: url('/vendor/fonts/space-grotesk-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('/vendor/fonts/space-grotesk-latin-700-normal.woff2') format('woff2'); }
:root {
  --primary: #2E2A6B;
  --primary-dark: #1C1945;
  --primary-tint: #ECEBF6;
  --accent: #E8A93B;
  --accent-dark: #D2932A;
  --green: #739958;
  --green-tint: #EEF4EA;
  --red: #A57373;
  --red-dark: #8A5858;
  --red-tint: #F6EEEE;
  --ink: #1C1945;
  --text: #34315C;
  --muted: #5A5780;
  --line: #E3E1F0;
  --page: #FFFFFF;
  --soft: #F7F6FB;
  --bar-text: #D9D6EE;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--primary-dark);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

header {
  position: fixed;
  top: 0;
  width: 100%;
  height: 64px;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: #FFFFFF;
}

.brand img {
  height: 34px;
  width: 34px;
}

footer {
  padding: 0 84px;
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 52px;
  background-color: var(--soft);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  font-size: 0.875rem;
  z-index: 10000;
}

footer p {
  margin: 0;
}

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

footer a:hover {
  color: var(--primary);
}

.content {
  padding: 112px 48px 104px;
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.0625rem;
  line-height: 1.7;
}

.content h1 {
  color: var(--ink);
  font-size: 2.5rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
}

.content h2 {
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
}

.content h3 {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 12px;
}

.content p {
  margin: 0 0 18px;
}

.lead {
  font-size: 1.25rem;
  color: var(--muted);
  margin: 0 0 32px;
}

nav {
  position: relative;
  display: flex;
  align-items: center;
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

nav ul li {
  margin-left: 22px;
}

nav a {
  color: var(--bar-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

nav a:hover {
  color: #FFFFFF;
}

nav a.active {
  color: #FFFFFF;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
}

nav a.nav-cta {
  background: var(--accent);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 6px;
}

nav a.nav-cta:hover,
nav a.nav-cta.active {
  background: var(--accent-dark);
  color: var(--ink);
  border-bottom: none;
  padding-bottom: 8px;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle .bar {
  width: 24px;
  height: 2px;
  margin: 3px 0;
  background-color: var(--bar-text);
}

button,
.btn {
  display: inline-block;
  background-color: var(--accent);
  color: var(--ink);
  border: none;
  padding: 12px 22px;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  line-height: 1.3;
}

button:hover,
.btn:hover {
  background-color: var(--accent-dark);
  color: var(--ink);
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-plain {
  background: #FFFFFF;
  color: var(--ink);
  border: 1px solid #B9C9D5;
}

.btn-plain:hover {
  background: var(--soft);
}

.btn-danger {
  background: var(--red);
  color: #FFFFFF;
}

.btn-danger:hover {
  background: var(--red-dark);
  color: #FFFFFF;
}

.menu-toggle,
.menu-toggle:hover {
  background: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 24px;
}

form.panel {
  background-color: var(--soft);
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 24px;
}

form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}

form .hint {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.875rem;
}

form input[type="text"],
form input[type="search"],
form textarea,
form select {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 18px;
  border: 1px solid #B9C9D5;
  border-radius: 6px;
  color: var(--ink);
  background-color: #FFFFFF;
  font-family: inherit;
  font-size: 1rem;
}

form textarea {
  min-height: 180px;
  resize: vertical;
}

form input:focus,
form textarea:focus,
form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}

fieldset.choices {
  border: none;
  margin: 0 0 18px;
  padding: 0;
}

fieldset.choices legend {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 8px;
  padding: 0;
}

.choices .options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choices label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid #B9C9D5;
  border-radius: 6px;
  background: #FFFFFF;
  font-weight: 500;
  cursor: pointer;
}

.choices label:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-tint);
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  margin-bottom: 20px;
}

.check input {
  margin-top: 5px;
}

.search {
  display: flex;
  gap: 10px;
  margin: 0 0 8px;
}

.search input[type="search"] {
  flex: 1;
  width: auto;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #B9C9D5;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
}

.error-message {
  background-color: var(--red-tint);
  color: var(--red-dark);
  border-left: 4px solid var(--red);
  padding: 10px 15px;
  margin: 15px 0;
  font-weight: 500;
}

.notice {
  background: var(--primary-tint);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  margin: 0 0 24px;
  color: var(--ink);
}

.listings {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.listings > li {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.listings h2 {
  font-size: 1.25rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.listings h2 a {
  color: var(--ink);
  text-decoration: none;
}

.listings h2 a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.listings p {
  margin: 0 0 10px;
  white-space: pre-line;
}

.badge-yours {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#listings > li.mine {
  border-left: 4px solid var(--accent);
  padding-left: 14px;
}

.page-loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #FFFFFF;
  color: var(--muted);
  font-weight: 600;
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
}

.is-busy {
  position: relative;
}

.is-busy > :not(.busy-spinner) {
  filter: blur(2px);
  opacity: 0.6;
  pointer-events: none;
  user-select: none;
}

.busy-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -22px 0 0 -22px;
}

.notify-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  background: #E7F1F7;
  border: 1px solid #C9DDEA;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 20px;
  font-weight: 600;
}

.notify-bar span {
  flex: 1 1 260px;
}

.unread-bar {
  background: var(--accent);
  color: var(--ink);
  text-align: center;
  padding: 10px 16px;
  margin: 0 0 20px;
  border-radius: 8px;
  font-weight: 600;
}

.unread-bar a {
  color: var(--ink);
}

.badge-unread {
  display: inline-block;
  vertical-align: middle;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 700;
}

.conversations {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.conversations > li {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.conversations > li.unread {
  border-left: 4px solid var(--primary);
  padding-left: 14px;
}

.conversations h2 {
  font-size: 1.15rem;
  margin: 0 0 6px;
}

.conversations h2 a {
  color: var(--ink);
  text-decoration: none;
}

.chat {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat li {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
}

.chat li.theirs {
  align-self: flex-start;
  background: #EEF2F5;
  border-bottom-left-radius: 4px;
}

.chat li.mine {
  align-self: flex-end;
  background: var(--primary);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
}

.chat p {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.chat time {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  opacity: 0.75;
}

.rate {
  margin: 24px 0;
}

.rate h3 {
  margin-top: 0;
}

.rate-stars {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rate-stars button {
  background: #FFFFFF;
  color: var(--ink);
  border: 1px solid var(--line);
  min-width: 56px;
}

.rate-stars button.chosen {
  background: var(--accent);
  border-color: var(--accent-dark);
}

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

.message-form textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
  padding: 0;
  list-style: none;
}

.meta .trust {
  color: var(--green);
  font-weight: 600;
}

.meta .new-member {
  color: var(--red-dark);
  font-weight: 600;
}

.listing-body {
  white-space: pre-line;
  margin: 24px 0;
}

.empty {
  color: var(--muted);
  padding: 32px 0;
}

.facts {
  margin: 0 0 24px;
  border-top: 1px solid var(--line);
}

.facts div {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.facts dt {
  font-weight: 600;
  color: var(--ink);
}

.facts dd {
  margin: 0;
}

.providers {
  display: grid;
  gap: 12px;
  max-width: 360px;
  margin: 24px 0;
}

.providers .btn {
  text-align: center;
}

.rules h3 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.rules ul {
  padding-left: 22px;
}

.rules li {
  margin-bottom: 8px;
}

.form-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 20px;
}

.steps {
  padding-left: 22px;
}

.steps li {
  margin-bottom: 10px;
}

.updated {
  color: var(--muted);
  font-size: 0.95rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.verify-step h2 {
  font-size: 1.25rem;
  margin: 0 0 12px;
}

label.btn {
  text-align: center;
}

.verify-step .actions {
  align-items: center;
}

.verify-preview {
  display: block;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 16px 0;
}

.camera {
  margin: 16px 0;
}

.camera video {
  display: block;
  width: 100%;
  max-width: 480px;
  border-radius: 10px;
  background: var(--ink);
  transform: scaleX(-1);
}

.scan-view {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 10px;
  background: var(--ink);
  margin: 16px 0 8px;
}

.scan-view video {
  position: absolute;
  max-width: none;
  border-radius: 0;
  transform: none;
}

.scan-view canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scan-guide {
  position: absolute;
  inset: 3%;
  border: 3px dashed var(--accent);
  border-radius: 12px;
  pointer-events: none;
}

.scanner .actions {
  margin-top: 8px;
}

.face-view {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 14px;
  background: var(--ink);
  margin: 16px 0 8px;
}

.face-view video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: scaleX(-1);
}

.face-view canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.face-oval {
  position: absolute;
  left: 20%;
  top: 12.5%;
  width: 60%;
  height: 75%;
  border: 3px dashed var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(14, 42, 58, 0.45);
  pointer-events: none;
}

.face-oval.inside {
  border-style: solid;
  border-color: var(--green);
}

#scan-debug {
  white-space: pre;
  overflow-x: auto;
  font-family: ui-monospace, 'DejaVu Sans Mono', Menlo, monospace;
  font-size: 0.8rem;
}

nav .nav-signout {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--bar-text);
  cursor: pointer;
}

nav .nav-signout:hover,
nav .nav-signout:focus-visible {
  color: #FFFFFF;
}

.face-turns {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4%;
  pointer-events: none;
}

.turn-arrow {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(14, 42, 58, 0.65);
  color: var(--accent);
  font-size: 1.8rem;
  animation: turn-pulse 0.9s ease-in-out infinite alternate;
}

.turn-arrow.done {
  background: var(--green);
  color: #FFFFFF;
  animation: none;
}

@keyframes turn-pulse {
  from { transform: scale(0.9); opacity: 0.7; }
  to { transform: scale(1.1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .turn-arrow { animation: none; }
}

.install-steps {
  font: inherit;
  color: var(--ink);
  max-width: 420px;
  border: none;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(14, 42, 58, 0.25);
}

.install-steps::backdrop {
  background: rgba(14, 42, 58, 0.45);
}

.install-steps h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.install-steps ol {
  padding-left: 20px;
}

.install-steps li {
  margin-bottom: 8px;
}

.notify {
  margin: 28px 0;
}

.notify h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.notify h3 {
  font-size: 1rem;
  margin: 20px 0 8px;
}

.check {
  display: block;
  margin: 10px 0;
}

.check input {
  margin-right: 8px;
}

#notify-ways {
  margin-left: 26px;
}

#notify-ways .junk-hint {
  margin: -4px 0 8px 26px;
}

#notify-ways.off {
  opacity: 0.5;
}

.qr {
  display: block;
  width: 232px;
  height: 232px;
  margin: 12px 0;
  image-rendering: pixelated;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
}

.content-wide {
  max-width: 1100px;
}

.how-grid {
  list-style: none;
  padding: 0;
  margin: 28px 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.how-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #FFFFFF;
}

.how-card img {
  display: block;
  width: 100%;
  height: auto;
}

.how-text {
  padding: 16px 18px 20px;
}

.how-step {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
}

.how-text h2 {
  font-size: 1.15rem;
  margin: 10px 0 6px;
}

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

@media (max-width: 900px) {
  .how-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .how-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .menu-toggle {
    display: flex;
  }

  nav ul {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 52px;
    background-color: var(--primary-dark);
    flex-direction: column;
    align-items: stretch;
    width: 220px;
    transform: translateX(200%);
    transition: transform 0.3s ease-in-out;
    z-index: 9999;
    overflow-y: auto;
  }

  nav ul.show {
    transform: translateX(0);
  }

  nav ul li {
    margin: 0;
    border-bottom: 1px solid var(--primary);
  }

  nav ul li a,
  nav ul li .nav-signout {
    display: block;
    width: 100%;
    text-align: left;
    padding: 15px 18px;
  }

  nav a.active {
    border-bottom: none;
    padding-bottom: 15px;
    background: var(--primary);
  }

  nav a.nav-cta {
    border-radius: 0;
    padding: 15px 18px;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 96px 20px 96px;
    font-size: 1rem;
  }

  .content h1 {
    font-size: 2rem;
  }

  .lead {
    font-size: 1.125rem;
  }

  form.panel {
    padding: 20px;
  }

  .facts div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  footer {
    font-size: 0.75rem;
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  nav ul {
    transition: none;
  }
}

/* Cognisophia: headings and the brand in Space Grotesk */
h1, h2, h3, .brand span {
  font-family: var(--heading);
  letter-spacing: -0.01em;
}

.understanding-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 28px;
  background: var(--soft);
}

.promise {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--ink);
  border-left: 4px solid var(--accent);
  padding: 4px 0 4px 18px;
  margin: 24px 0;
}

.how-steps {
  list-style: none;
  counter-reset: step;
  margin: 28px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.how-steps li {
  counter-increment: step;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.how-steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #FFFFFF;
  font-family: var(--heading);
  font-weight: 700;
}

.how-steps h2 {
  font-size: 1.15rem;
  margin: 12px 0 6px;
}

.how-steps p {
  margin: 0;
}
