@font-face {
  font-family: "Shrikhand";
  src: url("/fonts/shrikhand.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --tomato: #cf2f1c;
  --tomato-deep: #a42110;
  --blush: #ffe1da;
  --ink: #17173f;
  --mist: #e9ebfb;
  --slate: #4c4e7d;
  --white: #fff;
  --display: "Shrikhand", Georgia, serif;
  --text: "Atkinson Hyperlegible Next", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font: 400 1.0625rem/1.5 var(--text);
}

[hidden] { display: none !important; }

p { margin: 0; }

a { color: inherit; }

.column {
  width: min(100%, 44rem);
  margin-inline: auto;
  padding-inline: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.hero :focus-visible { outline-color: var(--white); }
.hero .composer :focus-visible { outline-color: var(--tomato); }

/* The hero: an oversized name, then one big speech bubble to type into. */

.hero {
  background: var(--tomato);
  color: var(--white);
  padding-block: 1.5rem 2.75rem;
}

h1 {
  margin: 0;
  /* Sized to fill the column on one line: the word is about 4.3em wide. */
  font: 400 min(9.75rem, calc((100vw - 2rem) / 4.3))/1 var(--display);
  letter-spacing: -0.01em;
  padding-bottom: 0.08em;
}

h1 a { text-decoration: none; }

/* The logo's text box is taller than its line, so these sit above it to stay clickable. */
.owner-bar,
.composer {
  position: relative;
}

.owner-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  font-weight: 600;
}

.owner-bar .text-button { color: var(--white); }

.composer {
  margin-top: 0.75rem;
  padding: 1.25rem;
  background: var(--white);
  color: var(--ink);
  border-radius: 1.75rem 1.75rem 1.75rem 0.25rem;
}

.composer-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: clamp(1.25rem, 4vw, 1.625rem);
  font-weight: 700;
  line-height: 1.25;
}

textarea,
input {
  display: block;
  width: 100%;
  color: var(--ink);
  font: inherit;
}

.composer textarea {
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: none;
  font-size: 1.1875rem;
  resize: vertical;
}

.composer textarea:focus-visible {
  outline: 0;
  border-bottom-color: var(--tomato);
  box-shadow: 0 2px 0 var(--tomato);
}

.composer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
}

.hint {
  flex: 1 1 16rem;
  color: var(--slate);
  font-size: 0.9375rem;
}

#counter { display: block; color: var(--tomato); font-weight: 700; }
#counter:empty { display: none; }

.ask-status {
  min-height: 1.5em;
  margin-top: 0.75rem;
  font-weight: 700;
}

/* A bot-only field, moved off screen rather than hidden so bots still fill it in. */
.hp {
  position: absolute;
  left: -9999px;
}

.button {
  min-height: 2.75rem;
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 1.5rem;
  background: var(--ink);
  color: var(--white);
  font: 700 1rem/1.2 var(--text);
  cursor: pointer;
}

.button:hover { background: var(--tomato-deep); }
.button:disabled { opacity: 0.6; cursor: progress; }

.text-button {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 0.9375rem/1.2 var(--text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.text-button.danger { color: var(--tomato-deep); }

/* The feed: a question from the left, Tom's reply answering from the right. */

.feed-column { padding-block: 1.75rem 2.5rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-bottom: 1.75rem;
}

.filters button {
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--slate);
  font: 600 1.0625rem/1.2 var(--text);
  cursor: pointer;
}

.filters button:hover { color: var(--ink); }

.filters button[aria-pressed="true"] {
  border-bottom-color: var(--tomato);
  color: var(--ink);
  font-weight: 700;
}

.count { font-weight: 400; }

.exchange + .exchange { margin-top: 2.25rem; }

.bubble {
  max-width: 92%;
  width: fit-content;
  padding: 0.875rem 1.125rem 1rem;
}

.body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.625rem;
  margin-bottom: 0.25rem;
}

.when { font-size: 0.875rem; }

.ask {
  background: var(--white);
  border-radius: 1.25rem 1.25rem 1.25rem 0.25rem;
}

.ask .body { font-size: 1.1875rem; line-height: 1.4; }
.ask .when { color: var(--slate); }

.asker { font-weight: 700; }

.reply {
  margin-top: 0.5rem;
  margin-left: auto;
  background: var(--tomato);
  color: var(--white);
  border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
}

.tom {
  font: 400 1.5rem/1.1 var(--display);
}

.waiting {
  margin-top: 0.5rem;
  color: var(--slate);
  font-size: 0.9375rem;
  text-align: right;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 1.25rem;
}

.owner-tools { justify-content: flex-end; }

.reply-editor {
  margin-top: 0.5rem;
  margin-left: auto;
  width: min(100%, 36rem);
}

.reply-editor textarea {
  padding: 0.75rem 1rem;
  border: 2px solid var(--tomato);
  border-radius: 1.25rem 1.25rem 0.25rem 1.25rem;
  background: var(--white);
  resize: vertical;
}

.reply-editor textarea:focus-visible {
  outline: 0;
  border-color: var(--ink);
}

.reply-editor .row {
  justify-content: flex-start;
  margin-top: 0.5rem;
  flex-direction: row-reverse;
}

.form-error {
  color: var(--tomato-deep);
  font-size: 0.9375rem;
  font-weight: 600;
}

.form-error:empty { display: none; }

.feed-status {
  color: var(--slate);
  font-size: 1.1875rem;
}

.feed-status:empty { display: none; }

.more {
  display: block;
  margin: 2.25rem auto 0;
}

.site-foot {
  padding-bottom: 2rem;
  color: var(--slate);
  font-size: 0.9375rem;
}

/* The one moment of motion: your question drops in after you post it. */

.is-new .ask {
  animation: arrive 420ms cubic-bezier(0.2, 1.3, 0.4, 1);
  transform-origin: bottom left;
}

@keyframes arrive {
  from { opacity: 0; transform: scale(0.85) translateY(0.75rem); }
}

@media (prefers-reduced-motion: reduce) {
  .is-new .ask { animation: none; }
}

/* Login */

.login-page {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 1rem;
  background: var(--tomato);
  color: var(--white);
}

.login-page :focus-visible { outline-color: var(--white); }
.login-page .composer :focus-visible { outline-color: var(--tomato); }

.login-box { width: min(100%, 24rem); }

.login-box h1 { font-size: min(5.5rem, calc((100vw - 2rem) / 4.3)); }

.field-label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.login-box input {
  min-height: 2.75rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--ink);
  border-radius: 0.75rem;
}

.login-box .form-error { margin-bottom: 1rem; }
