:root {
  --paper: #f2e6d0;
  --paper-pale: #f8efdf;
  --ink: #1a0f05;
  --rust: #c03a2b;
  --brown: #4a3b2a;
  --gold: #e8d6a8;
  --editorial: Georgia, "Times New Roman", serif;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(26, 15, 5, 0.035) 0 1px, transparent 2px),
    radial-gradient(circle at 73% 61%, rgba(26, 15, 5, 0.026) 0 1px, transparent 2px),
    linear-gradient(92deg, transparent 0 49%, rgba(74, 59, 42, 0.025) 50%, transparent 51%),
    var(--paper);
  background-size: 83px 79px, 119px 113px, 9px 100%;
  color: var(--ink);
  font-family: var(--ui);
  line-height: 1.5;
}

body::before {
  position: fixed;
  z-index: 20;
  inset: 0;
  background-image:
    repeating-linear-gradient(4deg, transparent 0 17px, rgba(26, 15, 5, 0.018) 18px),
    repeating-linear-gradient(86deg, transparent 0 29px, rgba(26, 15, 5, 0.012) 30px);
  content: "";
  opacity: 0.7;
  pointer-events: none;
}

button,
textarea,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--rust);
  outline-offset: 4px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.noscript {
  padding: 12px;
  border-bottom: 2px solid var(--ink);
  background: var(--rust);
  color: var(--paper);
  text-align: center;
}

header {
  border-bottom: 1px solid rgba(26, 15, 5, 0.42);
}

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 28px;
  align-items: center;
  width: min(1480px, calc(100% - 8vw));
  min-height: 84px;
  margin: 0 auto;
}

.wordmark {
  width: max-content;
  font-family: var(--editorial);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.wordmark::before {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 9px;
  border-radius: 62% 38% 48% 52%;
  background: var(--ink);
  box-shadow: 4px 2px 0 -2px var(--rust);
  content: "";
  transform: rotate(-18deg);
}

nav {
  display: flex;
  gap: 26px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

nav a {
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.live-stamp {
  justify-self: end;
  padding: 5px 10px;
  border: 1px solid var(--rust);
  color: var(--rust);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.18em;
  transform: rotate(1.5deg);
}

.live-stamp::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--rust);
  content: "";
  animation: pulse 2.4s ease-in-out infinite;
}

main {
  width: min(1480px, calc(100% - 8vw));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(350px, 0.78fr) minmax(520px, 1.22fr);
  gap: clamp(32px, 6vw, 92px);
  align-items: center;
  min-height: calc(100vh - 85px);
  padding: 64px 0 82px;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--rust);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-family: var(--editorial);
  font-size: clamp(72px, 9.4vw, 150px);
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 0.76;
}

.hero h1 em {
  display: block;
  color: var(--rust);
  font-weight: 400;
}

.hero h1 em::after {
  display: block;
  width: 82%;
  height: 9px;
  margin: 22px 0 0 8%;
  border-radius: 50%;
  background: var(--rust);
  content: "";
  opacity: 0.75;
  transform: rotate(-2deg) scaleY(0.28);
}

.deck {
  margin: 28px 0 0;
  font-family: var(--editorial);
  font-size: clamp(21px, 2.2vw, 32px);
  font-style: italic;
}

.hero-note {
  max-width: 370px;
  margin: 15px 0 0;
  color: var(--brown);
  font-size: 13px;
}

.specimen {
  position: relative;
  border: 1px solid var(--ink);
  background: rgba(248, 239, 223, 0.66);
  box-shadow: 13px 15px 0 rgba(74, 59, 42, 0.11);
  transform: rotate(1.15deg);
}

.specimen::before,
.specimen::after {
  position: absolute;
  z-index: 2;
  width: 13px;
  height: 13px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.specimen::before {
  top: 11px;
  left: 11px;
}

.specimen::after {
  right: 11px;
  bottom: 11px;
}

.specimen-heading {
  display: flex;
  justify-content: space-between;
  padding: 15px 22px 13px;
  border-bottom: 1px solid var(--ink);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

#ink-count {
  color: var(--rust);
}

#ink-game {
  display: block;
  width: 100%;
  height: clamp(360px, 43vw, 610px);
  background:
    radial-gradient(circle at 20% 27%, rgba(26, 15, 5, 0.035), transparent 28%),
    var(--gold);
  cursor: crosshair;
  touch-action: none;
  transition: filter 600ms ease;
}

.specimen.ready #ink-game {
  filter: sepia(0.18) brightness(0.82);
}

.specimen.ready #ink-count {
  animation: ink-ready 900ms ease-in-out infinite alternate;
}

.spec-caption {
  display: grid;
  gap: 13px;
  padding: 18px 22px 20px;
  border-top: 1px solid var(--ink);
}

.spec-caption small,
.entry > small,
#composer > label {
  display: block;
  margin-bottom: 5px;
  color: var(--rust);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#game-status {
  margin: 0;
  font-family: var(--editorial);
  font-size: 18px;
  font-style: italic;
}

#ink-meter {
  height: 9px;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--paper);
}

#ink-meter-fill {
  width: var(--ink-progress, 0%);
  height: 100%;
  background: var(--rust);
  transition: width 500ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.game-actions,
.paint-actions,
.composer-actions,
.composer-actions > div {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.game-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  align-items: center;
  justify-content: flex-end;
}

#game-help,
#paint-actions > p,
#quota {
  margin: 0;
  color: var(--brown);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#paint-message,
#clear-paint,
#cancel-paint,
#send-paint {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--rust);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

#swing-brush {
  min-width: 112px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transform: rotate(-0.8deg);
}

#swing-brush:active {
  transform: rotate(2deg) translateY(1px);
}

#clear-paint,
#cancel-paint {
  color: var(--brown);
}

#send-paint {
  color: var(--rust);
  font-weight: 850;
}

.specimen.painting #ink-game {
  filter: none;
  cursor: crosshair;
}

.specimen.painting .specimen-heading {
  background: var(--ink);
  color: var(--paper);
}

.specimen.painting #ink-count {
  color: var(--paper);
}

.earned-note {
  position: relative;
  display: grid;
  min-height: 78px;
  padding: 15px 17px 14px 50px;
  border: 1px solid rgba(26, 15, 5, 0.48);
  background:
    linear-gradient(92deg, transparent 0 27px, rgba(192, 58, 43, 0.18) 28px 29px, transparent 30px),
    rgba(255, 251, 239, 0.42);
}

.earned-note::before {
  position: absolute;
  top: 16px;
  left: 15px;
  width: 17px;
  height: 23px;
  border-radius: 52% 44% 58% 40%;
  background: var(--ink);
  box-shadow:
    7px 19px 0 -5px var(--ink),
    -3px 31px 0 -6px var(--rust);
  content: "";
  transform: rotate(12deg);
}

.earned-note.writing::after {
  align-self: end;
  width: 34%;
  height: 2px;
  margin-top: 9px;
  background: var(--rust);
  content: "";
  animation: writing-line 1.25s ease-in-out infinite alternate;
}

.earned-note.fresh {
  border-color: var(--rust);
  box-shadow: 5px 6px 0 rgba(192, 58, 43, 0.12);
  transform: rotate(-0.35deg);
}

#earned-note-text {
  margin: 0;
  font-family: var(--editorial);
  font-size: 17px;
  font-style: italic;
  line-height: 1.35;
}

@keyframes writing-line {
  to {
    width: 78%;
  }
}

@keyframes ink-ready {
  to {
    letter-spacing: 0.22em;
    text-shadow: 0 0 12px rgba(192, 58, 43, 0.42);
  }
}

.torn-transition {
  position: relative;
  left: 50%;
  display: grid;
  width: 100vw;
  height: 88px;
  place-items: center;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background:
    linear-gradient(135deg, transparent 8px, var(--paper-pale) 9px) 0 0 / 18px 18px repeat-x,
    var(--paper-pale);
  font-family: var(--editorial);
  font-size: 18px;
  font-style: italic;
  transform: translateX(-50%);
}

.torn-transition.awake {
  color: var(--rust);
}

.studio {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  gap: clamp(38px, 6vw, 90px);
  padding: 102px 0 94px;
}

.field-guide {
  align-self: start;
  padding-right: 30px;
  border-right: 1px solid var(--ink);
}

.field-guide h2,
.conversation-heading h2 {
  margin: 0;
  font-family: var(--editorial);
  font-size: clamp(31px, 4vw, 58px);
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.field-guide > p:not(.eyebrow) {
  margin: 19px 0 26px;
  color: var(--brown);
  font-size: 13px;
}

.modes {
  display: grid;
  gap: 8px;
}

.modes button {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(26, 15, 5, 0.34);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.modes button:hover {
  transform: translateX(4px);
}

.modes button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 5px 5px 0 var(--rust);
}

.modes button span {
  font-family: var(--editorial);
  font-size: 16px;
  font-weight: 700;
}

.modes button small {
  opacity: 0.66;
  font-size: 10px;
}

.model-facts {
  margin: 48px 0 0;
}

.model-facts div {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(26, 15, 5, 0.28);
}

.model-facts dt {
  color: var(--rust);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.model-facts dd {
  margin: 0;
  font-family: var(--editorial);
  font-size: 13px;
}

.conversation-book {
  min-width: 0;
  border: 1px solid var(--ink);
  background: rgba(248, 239, 223, 0.64);
  box-shadow: 11px 12px 0 rgba(74, 59, 42, 0.08);
}

.conversation-heading {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 30px 34px;
  border-bottom: 1px solid var(--ink);
}

.conversation-heading h2 {
  font-size: clamp(30px, 4vw, 54px);
}

.telemetry {
  display: grid;
  gap: 6px;
  min-width: max-content;
  color: var(--brown);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

#conversation.scrollable {
  min-height: 390px;
  max-height: 600px;
  overflow-y: auto;
  padding: 16px 34px 26px;
  scrollbar-color: var(--rust) transparent;
}

.entry {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 16px;
  padding: 24px 0;
  border-bottom: 1px solid rgba(26, 15, 5, 0.19);
}

.entry > small {
  padding-top: 5px;
}

.entry.user > small {
  color: var(--brown);
}

.entry p {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--editorial);
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.62;
}

.entry.user p {
  max-width: 720px;
  padding-left: 15px;
  border-left: 3px solid var(--rust);
  font-family: var(--ui);
  font-size: 14px;
}

.entry img {
  grid-column: 2;
  max-width: min(100%, 320px);
  max-height: 260px;
  margin-top: 13px;
  border: 1px solid var(--ink);
  object-fit: contain;
}

#composer {
  margin: 0 30px 30px;
  padding: 17px 19px 15px;
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--rust);
  transition: background 160ms ease, transform 160ms ease;
}

#composer.dragging {
  background: var(--gold);
  transform: rotate(-0.4deg);
}

#prompt {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--editorial);
  font-size: 17px;
  line-height: 1.45;
}

#prompt::placeholder {
  color: rgba(74, 59, 42, 0.52);
}

#attachment-preview {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px dashed var(--brown);
}

#attachment-preview[hidden] {
  display: none;
}

#attachment-image {
  width: 60px;
  height: 52px;
  border: 1px solid var(--ink);
  object-fit: cover;
}

#attachment-name {
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#remove-image,
#image-button {
  border: 0;
  background: transparent;
  color: var(--rust);
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
}

.composer-actions {
  padding-top: 11px;
  border-top: 1px solid rgba(26, 15, 5, 0.22);
}

#send-button,
#stop-button {
  padding: 10px 14px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

#stop-button {
  border-color: var(--rust);
  background: var(--rust);
}

#form-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--rust);
  font-size: 11px;
}

.thinking {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--rust);
  font-family: var(--editorial);
  font-style: italic;
}

.thinking::after {
  content: "Inkling is considering the edges…";
}

.error {
  border-color: var(--rust) !important;
}

footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 28px;
  width: min(1480px, calc(100% - 8vw));
  margin: 0 auto;
  padding: 34px 0 calc(34px + env(safe-area-inset-bottom));
  border-top: 2px solid var(--ink);
  color: var(--brown);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

footer strong {
  color: var(--ink);
  font-family: var(--editorial);
  font-size: 17px;
  letter-spacing: 0;
}

footer p {
  margin: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-copy {
    padding-top: 30px;
  }

  .hero h1 em {
    display: inline;
  }

  .specimen {
    transform: rotate(0.5deg);
  }

  .studio {
    grid-template-columns: 1fr;
  }

  .field-guide {
    padding: 0 0 42px;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .modes {
    grid-template-columns: repeat(3, 1fr);
  }

  .model-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

@media (max-width: 620px) {
  .masthead,
  main,
  footer {
    width: min(100% - 30px, 1480px);
  }

  .masthead {
    grid-template-columns: 1fr auto;
    min-height: 72px;
  }

  .masthead nav {
    display: none;
  }

  .hero {
    gap: 48px;
    padding: 52px 0 65px;
  }

  .hero h1 {
    font-size: clamp(62px, 22vw, 94px);
  }

  #ink-game {
    height: 380px;
  }

  .game-actions,
  .paint-actions,
  .composer-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-buttons {
    width: 100%;
    justify-content: flex-start;
  }

  #swing-brush {
    min-height: 42px;
  }

  .modes,
  .model-facts {
    grid-template-columns: 1fr;
  }

  .conversation-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px 20px;
  }

  #conversation.scrollable {
    min-height: 340px;
    padding: 10px 20px 22px;
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .entry img {
    grid-column: 1;
  }

  #composer {
    margin: 0 14px 20px;
  }

  footer {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body {
    background: #fff;
  }

  header,
  .specimen,
  #composer,
  .modes {
    display: none;
  }
}
