/* lenslibrary.app (DESIGN-social.md §17): DESIGN.md §15 tokens, system fonts (W1), light only, the logo palette: forest green #173B2C, cream #F1EAD8, gold #C9A44A for the mark, the header rule and the selected-choice ring, never text (§17.5),
   WCAG 2.2 AA (§17.4). Icons are Lucide (lucide.dev, ISC License), inlined in the pages as SVG. */
:root {
  color-scheme: light;
  --canvas: #F1EAD8;
  --surface: #FBF8F0;
  --surface-sunken: #E9E1CC;
  --field: #FFFDF8;
  --hairline: #E2D8C0;
  --border-strong: #8C7A55;
  --ink: #1F2328;
  --ink-muted: #5F5E59;
  --primary: #173B2C;
  --active: #0F2A1F;
  --on-primary: #F1EAD8;
  --gold: #C9A44A;
  --positive: #2F6E52;
  --critical: #A8433A;
  --tint-critical: #F7E7E4;
}
@media (prefers-contrast: more) {
  :root {
    --hairline: var(--border-strong);
    --ink-muted: var(--ink);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
}
h1, h2, p, ul, fieldset { margin: 0; }
a { color: var(--primary); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* Layout (§17.1) */
.page { max-width: 560px; margin: 0 auto; padding: 0 16px 32px; }
.masthead { padding: 8px 0 8px; border-bottom: 2px solid var(--gold); }
.wordmark {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  font-size: 1.0625rem; font-weight: 600; color: var(--ink); text-decoration: none;
}
.logo { flex: none; }
.display { margin-top: 16px; font-size: 1.75rem; font-weight: 700; line-height: 1.2; color: var(--primary); }
.lede { margin-top: 12px; font-size: 1.0625rem; color: var(--ink-muted); }
.points { display: grid; gap: 12px; margin: 24px 0; padding: 0; list-style: none; }
.points li { display: flex; gap: 12px; align-items: flex-start; }
.icon { flex: none; }
.points .icon { margin-top: 1px; color: var(--primary); }
.card { margin-top: 24px; padding: 16px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; }
.points + .card { margin-top: 0; }
.prose { display: grid; gap: 12px; }
.actions { margin-top: 24px; }
.footer { margin-top: 32px; font-size: 0.8125rem; color: var(--ink-muted); }
.footer ul { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; padding: 0; list-style: none; }
.footer li { display: inline-flex; align-items: center; }
.footer li + li::before { content: "·"; content: "·" / ""; margin-right: 8px; }
.footer a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; }
@media (min-width: 768px) {
  .page { padding: 0 24px 48px; }
  .display { font-size: 2.125rem; }
  .card { padding: 24px; }
}

/* Form (§17.2) */
form { display: grid; gap: 16px; }
.field { display: grid; gap: 8px; min-width: 0; padding: 0; border: 0; }
label, legend { font-size: 0.9375rem; font-weight: 600; }
legend { margin-bottom: 8px; padding: 0; }
.optional { font-weight: 400; color: var(--ink-muted); }
input[type="email"], input[type="text"], select {
  width: 100%; min-height: 48px; padding: 0 12px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--field); border: 1px solid var(--border-strong); border-radius: 10px;
}
[aria-invalid="true"] { border-color: var(--critical); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--field); border: 1px solid var(--border-strong); border-radius: 10px; }
.segmented label {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 8px;
  font-weight: 400; text-align: center; cursor: pointer;
}
.segmented label + label { border-left: 1px solid var(--border-strong); }
.segmented label:first-child { border-radius: 9px 0 0 9px; }
.segmented label:last-child { border-radius: 0 9px 9px 0; }
.segmented input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.segmented label:has(input:checked) { background: var(--primary); color: var(--on-primary); font-weight: 600; box-shadow: inset 0 0 0 2px var(--gold); }
.segmented label:has(input:focus-visible) { z-index: 1; outline: 2px solid var(--primary); outline-offset: 2px; }
.check { grid-template-columns: auto 1fr; align-items: center; gap: 0 12px; }
.check input { width: 24px; height: 24px; margin: 0; accent-color: var(--primary); }
.check label { display: flex; align-items: center; min-height: 44px; }
.check .field-error { grid-column: 1 / -1; }
/* The honeypot (§17.2): off-screen, never display:none, so naive bots still fill it. */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.note { font-size: 0.8125rem; color: var(--ink-muted); }
.field-error { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8125rem; color: var(--critical); }
.field-error .icon { width: 16px; height: 16px; margin-top: 2px; }
.error-summary { padding: 12px 16px; border: 2px solid var(--critical); border-radius: 10px; }
.error-summary ul { display: grid; gap: 4px; margin-top: 8px; padding-left: 20px; }
.error-summary a { display: inline-flex; align-items: center; min-height: 44px; color: var(--critical); }
.banner { display: flex; gap: 8px; align-items: flex-start; padding: 12px; background: var(--tint-critical); border-radius: 10px; }
.banner .icon { margin-top: 1px; color: var(--critical); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  font: inherit; font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; border-radius: 10px;
}
.primary { width: 100%; background: var(--primary); color: var(--on-primary); }
.primary:hover { background: var(--active); }
.primary:disabled { cursor: progress; }
.secondary { background: transparent; color: var(--primary); border-color: var(--border-strong); }

/* States (§17.3) */
.panel { display: grid; gap: 12px; justify-items: start; }
.panel > .icon, .panel .positive .icon { width: 32px; height: 32px; color: var(--primary); }
.positive, .panel .positive .icon { color: var(--positive); }
.panel .button { width: 100%; }
.busy-line { grid-auto-flow: column; justify-content: start; align-items: center; }
.title-sm { font-size: 0.9375rem; font-weight: 600; }
.title-lg { font-size: 1.375rem; font-weight: 600; line-height: 1.3; color: var(--primary); }
.noscript { font-weight: 600; }
.share-link { font-size: 0.9375rem; overflow-wrap: anywhere; user-select: all; }
.busy {
  display: none; width: 16px; height: 16px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
[aria-busy="true"] .busy { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .busy { width: 8px; height: 8px; border: 0; background: currentColor; }
}
