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

:root {
  --ink: #f2f0eb;
  --dim: #7d7a74;
  --hairline: #262624;
}

html, body {
  height: 100%;
  background: #000;
  color: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: "DM Mono", ui-monospace, Menlo, monospace;
  font-weight: 300;
  font-size: 16px; /* 12pt — the smallest size iPhones accept without zooming the page */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: fixed;
  inset: 0;
  cursor: text;
}

/* One line, at the exact centre of the screen. */
#line-form {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(280px, calc(100vw - 64px));
  transform: translate(-50%, -50%);
}

#line {
  display: block;
  width: 100%;
  padding: 6px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  color: var(--ink);
  caret-color: var(--ink);
  font: inherit;
  letter-spacing: 0.04em;
  text-align: center;
}

/* While empty, hide the native caret and placeholder; the ghost shows "ethos" and a caret after it. */
#line::placeholder { color: transparent; }
#line:placeholder-shown { caret-color: transparent; }

.ghost {
  position: absolute;
  inset: 0 0 1px 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

#line:placeholder-shown + .ghost { display: flex; }

.ghost span {
  color: var(--dim);
  font-style: italic;
}

.caret {
  display: inline-block;
  width: 1px;
  height: 1.15em;
  background: var(--ink);
  animation: blink 1.1s steps(1, end) infinite;
}

@keyframes blink {
  0%   { opacity: 1; }
  50%  { opacity: 0; }
  100% { opacity: 1; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
}
