:root {
  --night: #0A0A0C;
  --day: #F2F0EB;
  --ink: #0E0E10;
  --leaf: #90EE90;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--night); }

body {
  font-family: "Geist", system-ui, sans-serif;
  color: var(--day);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#film { position: fixed; inset: 0; display: block; }
#track { width: 1px; }

/* Everything is flat, like the Harwood Leon mark: solid fills, no blur, no highlights, no rims. */

.chrome {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  pointer-events: none;
}
.chrome > * { pointer-events: auto; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border-radius: 19px;
  font: 500 14px/1 "Geist", system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.pill-go {
  background: var(--leaf);
  color: var(--ink);
}

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

/* Invites the first scroll, then rises out of view as soon as the page moves. */
.hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(28px, env(safe-area-inset-bottom));
  height: 44px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px 0 16px;
  border-radius: 22px;
  background: #1C1C1F;
  color: var(--day);
  font: 500 14px/1 "Geist", system-ui, sans-serif;
  transition: transform 0.7s cubic-bezier(0.45, 0, 0.15, 1);
}
.hint-track {
  position: relative;
  width: 2px;
  height: 16px;
  border-radius: 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
}
.hint-track i {
  position: absolute;
  inset: 0;
  border-radius: 1px;
  background: var(--leaf);
  animation: hint-down 1.8s cubic-bezier(0.45, 0, 0.15, 1) infinite;
}
@keyframes hint-down {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .hint-track i { animation: none; transform: none; }
}

#hits a { position: fixed; z-index: 2; border-radius: 28px; }

/* An invisible button laid exactly over the "New idea" pill drawn in the film. */
.start {
  position: fixed;
  z-index: 2;
  display: none;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  touch-action: pan-y; /* vertical swipes still scroll the page; sideways drags move the knob */
  -webkit-user-select: none;
  user-select: none;
}
.start:active { cursor: grabbing; }

/* Visually hidden, still read aloud and indexed. */
.story {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 420px) {
  .pill { padding: 0 13px; font-size: 13px; height: 34px; }
}

/* ------------------------------------------------ "Talk to us": the button grows into a full-screen chat */

.chat-on, .chat-on body { overflow: hidden; }
.chat { position: fixed; inset: 0; z-index: 10; color: var(--ink); }
.chat[hidden] { display: none; }
.chat-bg { position: absolute; inset: 0; background: var(--leaf); }

.chat-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 760px);
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity 0.18s linear, transform 0.18s linear;
}
.chat.is-in .chat-ui {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.45s cubic-bezier(0.45, 0, 0.15, 1), transform 0.6s cubic-bezier(0.45, 0, 0.15, 1);
}

.chat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 12px; }
.chat-brand { display: inline-flex; align-items: center; gap: 14px; }
.chat-brand svg { width: 34px; height: 34px; fill: var(--ink); }
.chat-brand img { height: 11px; width: auto; display: block; }
.chat-close {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}
.chat-close span::before, .chat-close span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--day);
  transform: translate(-50%, -50%) rotate(45deg);
}
.chat-close span::after { transform: translate(-50%, -50%) rotate(-45deg); }

.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 2px 18px;
  /* messages fade out under the header and above the input instead of being cut off */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 14px), transparent 100%);
}
.msg {
  max-width: 82%;
  padding: 13px 18px;
  border-radius: 22px;
  font: 500 17px/1.42 "Geist", system-ui, sans-serif;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.ai { align-self: flex-start; background: var(--ink); color: var(--day); border-bottom-left-radius: 8px; }
.msg.me { align-self: flex-end; background: var(--day); color: var(--ink); border-bottom-right-radius: 8px; }
.msg.err { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.msg:first-child { transform-origin: 0 100%; }
.chat.is-in .msg:first-child { animation: chat-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes chat-pop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }

.msg.is-typing { display: inline-flex; gap: 5px; padding: 18px 18px; }
.msg.is-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--day); animation: chat-dot 1.1s ease-in-out infinite; }
.msg.is-typing i:nth-child(2) { animation-delay: 0.15s; }
.msg.is-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 60%, 100% { transform: none; opacity: 0.35; } 30% { transform: translateY(-4px); opacity: 1; } }

.msg.book { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.book-btn {
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 22px;
  border-radius: 23px;
  background: var(--leaf);
  color: var(--ink);
  font: 600 16px/1 "Geist", system-ui, sans-serif;
  text-decoration: none;
}
.book-btn::after { content: "→"; margin-left: 10px; }

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 20px;
  border-radius: 28px;
  background: var(--day);
}
.chat-form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  padding: 11px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: 500 17px/1.3 "Geist", system-ui, sans-serif;
}
.chat-form textarea::placeholder { color: rgba(14, 14, 16, 0.45); }
.chat-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
}
.chat-send svg { width: 20px; height: 20px; fill: none; stroke: var(--day); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chat-send:disabled { opacity: 0.3; cursor: default; }
.chat-alt { margin: 10px 0 0; text-align: center; font: 500 13px/1.3 "Geist", system-ui, sans-serif; color: rgba(14, 14, 16, 0.7); }
.chat-alt a { color: var(--ink); }
.chat :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.chat-form textarea:focus-visible { outline: 0; }
.chat-form:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .chat-ui, .chat.is-in .chat-ui { transition: none; }
  .chat.is-in .msg:first-child, .msg.is-typing i { animation: none; }
}
