/* Values from /tokens.json. Three sizes: message, name, everything else. */

@font-face {
  font-family: Newsreader;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/newsreader-400.woff2") format("woff2");
}

@font-face {
  font-family: Newsreader;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/newsreader-600.woff2") format("woff2");
}

:root {
  --ink: #1C241C;
  --paper: #E6E0D6;
  --sheet: #F7F3EB;
  --muted: #8A8175;
  --line: #D3CCC0;
  --accent: #8C2F2C;
  --radius: 4px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --motion: 120ms;
  --size-message: 32px;
  --size-name: 24px;
  --size-ui: 16px;
  --font: Newsreader, "Iowan Old Style", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--size-ui);
  font-weight: 400;
  line-height: 1.4;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

.table {
  min-height: 100dvh;
  padding: var(--space-6) var(--space-4) var(--space-7);
}

.word {
  width: min(100%, 26rem);
  margin: 0 auto var(--space-5);
  font-size: var(--size-ui);
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
}

.stage {
  width: min(100%, 26rem);
  margin: 0 auto;
}

.card {
  display: grid;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--motion) linear;
}

.card.is-current {
  border-color: var(--accent);
}

.scene {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--sheet);
}

.face {
  grid-area: 1 / 1;
  align-self: end;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-4);
  background: var(--sheet);
}

.name,
.face input.name {
  margin: 0;
  width: 100%;
  font-size: var(--size-name);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.message,
.face textarea.message {
  margin: 0;
  width: 100%;
  font-size: var(--size-message);
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line {
  margin: 0;
  font-size: var(--size-ui);
  font-weight: 400;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.face input.line {
  color: var(--ink);
  font-size: var(--size-ui);
  font-weight: 400;
}

.face input,
.face textarea {
  display: block;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: var(--space-2) 0;
  outline: none;
  resize: none;
}

.face input:focus,
.face textarea:focus {
  border-bottom-color: var(--ink);
}

.face input::placeholder,
.face textarea::placeholder {
  color: var(--muted);
}

.action {
  appearance: none;
  margin: 0;
  padding: var(--space-3) 0;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: var(--size-ui);
  font-weight: 600;
  line-height: 1.3;
  color: var(--accent);
  text-align: left;
  cursor: pointer;
}

.greeting {
  appearance: none;
  margin: 0;
  padding: var(--space-2) 0;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: var(--size-ui);
  font-weight: 400;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.status {
  margin: 0;
  min-height: 0;
  font-size: var(--size-ui);
  font-weight: 400;
  color: var(--muted);
}

.status:empty { display: none; }

.others {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.others button {
  appearance: none;
  margin: 0;
  padding: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
  overflow: hidden;
  cursor: pointer;
}

.others img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--sheet);
}

.action:focus-visible,
.greeting:focus-visible,
.others button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}
