/* askannieanything.com — public page, /privacy, /404, /fonts.html.
   Tokens live in /tokens.css (linked separately). Black on white only. */

/* ---------- layout ---------- */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  /* bottom room so the fixed panel / sticky bar never sit on the last line */
  padding: 32px var(--gutter) 160px;
  overflow-wrap: anywhere;
}

.sub { margin: 0 0 10px; }
.right { text-align: right; }

/* text-style buttons ("another one", "undo?", "who is annie?" in the footer) */
.linkish {
  border: 0;
  background: transparent;
  padding: 8px 0;
  margin: -8px 0;
  min-height: 24px;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.linkish.active { background: transparent; color: var(--ink); }

/* ---------- hero ---------- */

.hero {
  text-align: center;
  font-family: var(--hero);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  margin: 0 0 20px;
  white-space: nowrap;
}
/* The real text is the sr-only span; this copy is decoration. It is fully
   visible by default so a browser without motion support still shows it. */
.hero .typed {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  width: auto;
}
.cursor {
  display: inline-block;
  width: .55em;
  height: .9em;
  margin-left: .1em;
  background: var(--ink);
  vertical-align: baseline;
}

/* the wrapper holds the finished width; the typed span grows inside it */
.hero .typed-wrap { display: inline-block; width: calc(var(--chars, 18) * 1ch + .75em); text-align: left; white-space: nowrap; }
@keyframes type-hero { from { width: 0; } to { width: calc(var(--chars, 18) * 1ch); } }
@keyframes blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: no-preference) {
  .hero .typed {
    width: 0;
    animation: type-hero 1.6s steps(var(--chars, 18), end) .2s forwards;
  }
  .cursor { animation: blink 1s steps(2, start) infinite; }
}

/* ---------- stuck line, theme, style toggle ---------- */

.theme { margin-top: 6px; }
.stuck { margin: 14px 0 6px; }
.stuck .prompt { text-align: left; }
.restored { margin: 6px 0; }

.style-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 18px 0 8px;
}
.style-toggle { display: flex; flex-wrap: wrap; gap: 6px; }
.style-toggle button {
  font-size: 15px;
  padding: 0 10px;
  min-height: var(--tap);
  white-space: nowrap; /* "Handwriting" must never break mid-word */
}
@media (max-width: 639.98px) {
  .style-toggle button { font-size: 14px; padding: 0 8px; flex: 1 1 auto; }
  /* thumb targets: the footer 'who is annie?' is the only sheet opener when the fixed bar is unreliable */
  .linkish { min-height: var(--tap); padding: 11px 0; margin: -11px 0; }
  /* keep the caret line clear of the sticky bar when Safari scrolls it into view */
  html { scroll-padding-bottom: 90px; }
}
/* the browser must not chase the caret when the textarea regrows */
.note textarea { overflow-anchor: none; }

/* ---------- the note ---------- */

.note {
  border: 2px solid var(--ink);
  background: var(--paper);
  padding: 24px;
  margin: 0 0 16px;
  font-family: var(--typewriter);
  font-size: 20px;
  line-height: 1.4;
}
.note .print {
  font-family: var(--typewriter);
  font-size: 20px;
  line-height: 1.4;
  white-space: nowrap;
}
.note .salutation { margin: 12px 0 4px; }

.row { display: flex; align-items: baseline; gap: .4em; }
.row-sign { justify-content: flex-end; }
.row-sign .field { text-align: right; }

.field {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 2px 0;
  margin: 0;
}
textarea.field {
  display: block;
  resize: none;
  overflow: hidden;
  border-bottom: 0;
  line-height: 1.4;
  min-height: 7em;
}
.field.locked {
  display: block;
  border-bottom: 0;
  white-space: pre-wrap;
  padding: 2px 0;
}
.row .field.locked { flex: 1 1 auto; }
.row-sign .field.locked { text-align: right; }

/* only the three typed fields change with the style; printed parts stay Special Elite */
.note[data-style="typewriter"] .field { font-family: var(--typewriter); font-size: 20px; }
.note[data-style="handwriting"] .field { font-family: var(--handwriting); font-weight: 600; font-size: 26px; }
.note[data-style="terminal"] .field { font-family: var(--terminal); font-size: 26px; }
.note[data-style="ui"] .field { font-family: var(--ui); font-size: 17px; }

.aside {
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.4;
  margin: 4px 0 10px;
}
.counter {
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.4;
  margin: 0 0 10px;
  min-height: 1.4em;
}
.note-foot {
  font-size: 12px !important;
  margin: 18px 0 0;
  text-align: right;
}

/* honeypot: off-screen, never display:none (some bots skip hidden inputs) */
.hp {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* sent state: the card locks; asides, counters and tools go away */
.note.locked .aside,
.note.locked .counter,
.note.locked .doodle-tools,
.note.locked .doodle-hint,
.note.locked .doodle-status { display: none; }
.note.locked .doodle canvas { pointer-events: none; border-color: transparent; }

/* ---------- drawing (classes come from doodle.js) ---------- */

.doodle-wrap { margin: 8px 0 14px; }
.doodle {
  position: relative;
  overscroll-behavior: contain;
}
.doodle canvas {
  display: block;
  width: 100%;
  /* cap the height at 60vh without breaking 4:3, so a thumb can still reach the page */
  max-width: calc(60vh * 4 / 3);
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  border: 1px dashed var(--ink);
  background: var(--paper);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.doodle-hint {
  position: absolute;
  top: 45%;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-family: var(--ui);
  font-size: 15px;
  color: var(--ghost);
  pointer-events: none;
}
.doodle-hint.hidden { display: none; }
.doodle-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.doodle-tools button {
  font-family: var(--ui);
  font-size: 15px;
  min-height: var(--tap);
  padding: 0 12px;
}
.doodle-status {
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.4;
  margin: 6px 0 0;
}
.doodle-status:empty { margin: 0; min-height: 0; }

/* ---------- under the card ---------- */

.honest { margin: 0 0 18px; }
.anon-block { margin: 0 0 12px; }
.anon { margin-bottom: 4px; }

details.fine, details.crisis { margin: 0 0 12px; }
summary {
  cursor: pointer;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  text-decoration: underline;
  text-underline-offset: 2px;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: '+ '; white-space: pre; }
details[open] > summary::before { content: '\2212 '; }
details p { margin: 6px 0; }
details.fine p, .crisis-body { font-size: 15px; }

.crisis-lines { list-style: none; padding: 0; margin: 8px 0; }
.crisis-lines li a,
.crisis-body p a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
}

.status { margin: 0 0 12px; }
.status:empty { margin: 0; min-height: 0; } /* stays in the accessibility tree so the first announcement is heard */

.send {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 0 0 20px;
  background: var(--ink);
  color: var(--paper);
  font-size: 17px;
}
.send:disabled { opacity: .6; }

/* ---------- sent ---------- */

.sent { margin: 0 0 24px; outline: none; }
.sent p { margin: 0 0 10px; }
.verdict {
  font-family: var(--hero);
  font-size: 24px;
  line-height: 1.2;
  margin: 0 0 12px !important;
  white-space: nowrap;
}
.verdict .typed {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  width: auto;
}
@keyframes type-verdict { from { width: 0; } to { width: calc(var(--chars, 18) * 1ch); } }
@media (prefers-reduced-motion: no-preference) {
  .verdict .typed { width: 0; animation: type-verdict .6s steps(var(--chars, 18), end) forwards; }
}
.sent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}
.sent-actions button { font-size: 15px; }
.sent .crisis { margin-top: 10px; }

/* paused */
.paused { margin: 24px 0; }
.socials a { margin-right: .5em; }

/* ---------- footer ---------- */

.site-foot {
  font-size: 14px;
  line-height: 1.6;
  margin-top: 48px;
}

.phone-only { display: none; }

/* ---------- sticky bar (phones) ---------- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 64px;
  border-top: 2px solid var(--ink);
  background: var(--paper);
  padding: 8px var(--gutter) calc(8px + env(safe-area-inset-bottom));
}
.bar-send {
  flex: 2 1 0;
  min-height: 48px;
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
}
.bar-who {
  flex: 1 1 0;
  min-height: 48px;
  margin: 0;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 15px;
}
body.has-bar .page { padding-bottom: 120px; }

/* ---------- who is annie? panel (desktop) ---------- */

.panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  width: 260px;
  border: 2px solid var(--ink);
  background: var(--paper);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
}
.panel.collapsed { width: auto; border: 0; background: transparent; }
.panel-tab { font-size: 15px; background: var(--paper); }
.panel-body { position: relative; padding: 16px 16px 14px; }
.panel-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border: 0;
  font-size: 24px;
  line-height: 1;
}
.panel-content h2 {
  font-family: var(--ui);
  font-weight: 400;
  font-size: 17px;
  margin: 0 36px 8px 0;
}
.panel-content p { margin: 0 0 8px; }
.panel-content p:last-child { margin-bottom: 0; }

/* ---------- bottom sheet (phones) ---------- */

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  max-height: 85dvh;
  overflow: auto;
  border: 0;
  border-top: 2px solid var(--ink);
  padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom));
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
}
.sheet::backdrop { background: rgba(0, 0, 0, .4); }
/* webviews without <dialog> would paint the sheet permanently */
.sheet:not([open]) { display: none; }
.sheet-close { margin-top: 14px; font-size: 15px; }
@keyframes rise { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: rise .25s ease-out; }
}

/* ---------- static pages: /privacy, /404, /fonts.html ---------- */

.prose h1 {
  font-family: var(--hero);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  margin: 0 0 20px;
}
.prose h2 {
  font-family: var(--ui);
  font-weight: 400;
  font-size: 17px;
  margin: 24px 0 4px;
}
.prose p { margin: 0 0 12px; }
.prose .back { margin-top: 32px; }

/* /fonts.html sampler */
.sampler .note { margin-bottom: 28px; }
.sampler .field.locked { white-space: pre-wrap; }
.export-card {
  /* the 1080x1920 export card at 50%: 840 wide, 48 pad, 2 border -> 420 / 24 / 1 */
  width: 420px;
  max-width: 100%;
  border: 1px solid var(--ink);
  padding: 24px;
  font-family: var(--typewriter);
  line-height: 1.4;
}
.export-card .x-subject { font-size: 28px; line-height: 1.25; margin: 0 0 12px; }
.export-card .x-sal { font-size: 22px; margin: 0 0 12px; }
.export-card .x-body { font-size: 22px; margin: 0 0 12px; white-space: pre-wrap; }
.export-card .x-sign { font-size: 22px; text-align: right; margin: 0 0 12px; }
.export-card .x-foot { font-size: 15px; display: flex; justify-content: space-between; margin: 0; }

/* ---------- breakpoints ---------- */

@media (max-width: 639.98px) {
  .hero { font-size: 28px; }
  .panel { display: none; }
  .phone-only { display: inline; }
  .page { padding-top: 24px; padding-bottom: 96px; }
  .style-row { justify-content: flex-start; }
}

@media (min-width: 640px) {
  .bar { display: none !important; }
  .sheet { display: none !important; }
}
