/* startuplogline. One page, one light theme, no build step. */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #faf9f5;        /* the cream of anthropic.com's page background */
  --ink: #1c1b19;
  --muted: #6b6a64;        /* small print and placeholder: 5 to 1 on the paper */
  --rule: #dedcd2;
  --rule-strong: #8f8d85;  /* the line under the box while it has focus: 3 to 1 */
  --accent: #2743b8;       /* blue ink */
  --error: #b3261e;
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --column: 44rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 5vw, 3.5rem);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

p {
  margin: 0;
}

button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Name of the site */

.top {
  text-align: center;
}

.logo {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.6rem;
  line-height: 1;
  text-decoration: none;
}

.logo-mark {
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 0.14em;
  vertical-align: -0.12em;
  background: var(--accent);
}

/* The one box */

main {
  flex: 1;
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding-top: clamp(3rem, 17vh, 10rem);
  padding-bottom: 2rem;
  text-align: center;
}

.eyebrow {
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ask {
  position: relative;
  border-bottom: 1.5px solid var(--rule);
  transition: border-color 0.15s;
}

.ask:focus-within {
  border-color: var(--rule-strong);
}

#q {
  display: block;
  width: 100%;
  padding: 0.1em 3.4rem 0.22em;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  caret-color: var(--accent);
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6.5vw, 3.4rem);
  line-height: 1.15;
  text-align: center;
  transition: color 0.15s;
}

#q::placeholder {
  color: var(--muted);
  opacity: 1;
}

#q.answered {
  color: var(--accent);
}

/* A long name gets smaller type so that it still fits the box. */
.ask.long #q {
  font-size: clamp(1.5rem, 4.2vw, 2.2rem);
}

.go {
  position: absolute;
  top: 50%;
  right: 0;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-50%);
  transition: opacity 0.15s, background-color 0.15s;
}

.go:hover {
  background: var(--accent);
}

/* The arrow only appears once something is typed. */
#q:placeholder-shown + .go {
  visibility: hidden;
  opacity: 0;
}

/* What comes back. Exactly one group shows, chosen by data-state. */

.out {
  min-height: 10rem;
  margin-top: 2rem;
  transition: opacity 0.2s;
}

.out.stale {
  opacity: 0.35;
}

.out > * {
  display: none;
}

.out[data-state="idle"] .try,
.out[data-state="loading"] .wait,
.out[data-state="answer"] .line,
.out[data-state="answer"] .actions,
.out[data-state="error"] .note,
.out[data-state="hint"] .note {
  display: block;
}

.out[data-state="loading"] .wait,
.out[data-state="answer"] .line,
.out[data-state="error"] .note {
  animation: rise 0.18s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.25rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.try button,
.actions button {
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 0.1s, text-decoration-color 0.1s;
}

.try button {
  color: var(--ink);
}

.try button:hover,
.actions button:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.wait {
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3.4vw, 2rem);
  font-style: italic;
  line-height: 1.28;
}

.dots i {
  font-style: normal;
  animation: dot 1.2s infinite both;
}

.dots i:nth-child(2) {
  animation-delay: 0.2s;
}

.dots i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot {
  0%,
  20%,
  100% {
    opacity: 0.15;
  }
  50% {
    opacity: 1;
  }
}

/* The sentence is laid out whole but hidden, then shown letter by letter, so nothing reflows as it appears. */

.line {
  max-width: 40rem;
  margin: 0 auto;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 3.4vw, 2rem);
  line-height: 1.28;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.rest {
  visibility: hidden;
}

.caret {
  position: relative;
}

.caret::after {
  content: "";
  position: absolute;
  top: 0.1em;
  left: 0;
  width: max(2px, 0.06em);
  height: 1em;
  background: var(--accent);
}

/* When the sentence is done the caret blinks twice and leaves, so the only caret left is the box's own. */
.line.done .caret::after {
  opacity: 0;
  animation: caret-leave 1.6s ease-in-out;
}

@keyframes caret-leave {
  0%,
  50% {
    opacity: 1;
  }
  25%,
  75%,
  100% {
    opacity: 0;
  }
}

.note {
  max-width: 34rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.out[data-state="error"] .note {
  color: var(--error);
}

.actions {
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Small print */

.bottom {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  text-wrap: balance;
}

.noscript {
  margin-top: 1rem;
  color: var(--error);
  text-align: center;
}

@media (max-width: 34rem) {
  .logo {
    font-size: 1.45rem;
  }

  main {
    padding-top: clamp(2.5rem, 12vh, 6rem);
  }

  #q {
    padding-right: 3rem;
    padding-left: 3rem;
  }

  .go {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
