/* The prompt field to chat transition with the aurora: the home of Nacre, a made-up AI assistant for developers, on a
   soft near black page. The prompt field is one element (.prompt) that the script places on top of everything,
   between two empty slots: the one in the hero and the dock at the bottom of the chat. The chat is a full page surface
   whose clip follows the field. The aurora is a small canvas drawn by the script, blurred here and blended in screen. */
:root {
  --page: #09090d;          /* the page */
  --page-2: #12111a;        /* the light at the top of the page */
  --ink: #ecebf3;           /* the words */
  --ink-2: #d4d2df;         /* the words of the answer */
  --muted: #8b899b;         /* the small words */
  --edge: rgba(255, 255, 255, 0.08); /* hairlines */
  --violet: #8f7bff;        /* the iridescence: violet */
  --cyan: #5fd6e8;          /* cyan */
  --rose: #ff86c0;          /* rose */
  --amber: #ffc993;         /* and a warm amber */
  --keyword: #b8a9ff;       /* keywords in the code */
  --func: #86dfec;          /* function names in the code */
  --grain: 0.07;            /* how strong the grain is (the script sets it from GRAIN) */
  --pw: min(640px, calc(100vw - 32px));      /* the width of the field */
  --ph: clamp(84px, 19vh, 108px);            /* its height */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
}

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

.stage {
  position: relative;
  height: 100svh;
  min-height: 300px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 70% at 50% -10%, var(--page-2), transparent 60%),
    var(--page);
}

/* ------------------------------------------------------------------ the light */
.aurora {
  position: absolute;
  inset: -40px;
  width: calc(100% + 80px);
  height: calc(100% + 80px);
  filter: blur(26px) saturate(1.15);
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 0;
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(140% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 30%);
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: var(--grain);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.4 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------------ the home */
.home {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: clamp(10px, 2.4vh, 22px) 16px 16px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(980px, 100%);
  margin: 0 auto;
  font-size: 13px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 620;
  font-variation-settings: 'wdth' 110;
  letter-spacing: 0.01em;
}

.nav__mark {
  position: relative;
  width: 18px;
  height: 18px;
}

.nav__links {
  display: flex;
  gap: 18px;
  margin-left: auto;
  color: var(--muted);
}

.nav__in {
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  color: var(--ink);
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-bottom: clamp(0px, 4vh, 40px);
}

.hero__tag {
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hero__title {
  margin: clamp(10px, 2.4vh, 20px) 0 clamp(14px, 3.6vh, 30px);
  font-size: clamp(24px, min(6.4vw, 6.6vh), 54px);
  line-height: 1.04;
  font-weight: 560;
  font-variation-settings: 'wdth' 112;
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #ffffff 30%, #a9a6ba);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__slot {
  width: var(--pw);
  height: var(--ph);
  flex: none;
}

.chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: clamp(10px, 2.4vh, 18px);
  max-width: var(--pw);
}

.chip {
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: color 0.3s, background 0.3s, box-shadow 0.3s;
}

@media (hover: hover) {
  .chip:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  }
}

/* ------------------------------------------------------------------ the chat */
.chat {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  background: linear-gradient(180deg, rgba(16, 15, 24, 0.5), rgba(10, 10, 15, 0.22) 60%, rgba(10, 10, 15, 0.45));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.chat__bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: clamp(42px, 9vh, 54px);
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.chat__back {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px 6px 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: var(--ink-2);
  cursor: pointer;
}

.chat__back svg,
.prompt svg,
.code svg,
.tool svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.chat__title {
  flex: 1;
  margin: 0;
  text-align: center;
  font-weight: 560;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__share {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.chat__view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(180deg, transparent, #000 22px, #000 calc(100% - 18px), transparent);
}

.chat__thread {
  width: min(680px, calc(100vw - 32px));
  margin: 0 auto;
  padding: clamp(14px, 3vh, 26px) 2px clamp(14px, 3vh, 24px);
  font-size: clamp(12.5px, calc(1.6vh + 6px), 15px);
  line-height: 1.6;
}

.chat__dock {
  flex: none;
  width: var(--pw);
  height: var(--ph);
  margin: 0 auto clamp(10px, 2.2vh, 14px);
}

.chat__fine {
  flex: none;
  margin: calc(clamp(10px, 2.2vh, 14px) * -0.4) 0 clamp(8px, 1.6vh, 14px);
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

@media (max-height: 560px) {
  .chat__fine {
    display: none;
  }
}

.me {
  display: flex;
  justify-content: flex-end;
}

.me__text {
  margin: 0;
  max-width: 82%;
  padding: 9px 14px;
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 30px -14px rgba(0, 0, 0, 0.8);
  color: var(--ink);
}

.ai {
  margin-top: clamp(12px, 2.6vh, 22px);
}

.ai__who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.9em;
}

.ai__mark {
  position: relative;
  width: 20px;
  height: 20px;
  flex: none;
}

/* the mark: a ring of mother of pearl, a conic gradient with a dark hole */
.ai__mark-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 40deg, var(--violet), var(--cyan), var(--amber), var(--rose), var(--violet));
  -webkit-mask: radial-gradient(circle, transparent 38%, #000 41%);
  mask: radial-gradient(circle, transparent 38%, #000 41%);
  box-shadow: 0 0 12px -2px rgba(143, 123, 255, 0.6);
}

.ai__name {
  font-weight: 600;
}

/* "Thinking": a band of light sweeps along the word (background-position, moved by the script) */
.ai__think {
  --sweep: 120%;
  color: transparent;
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 35%, #ffffff 50%, var(--muted) 65%, var(--muted) 100%);
  background-size: 300% 100%;
  background-position: var(--sweep) 0;
  -webkit-background-clip: text;
  background-clip: text;
}

.answer {
  color: var(--ink-2);
}

.answer p {
  margin: 0 0 0.7em;
}

.answer strong {
  color: var(--ink);
  font-weight: 620;
}

.answer code {
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: 0.86em;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
}

.answer__list {
  list-style: none;
  margin: 0 0 0.9em;
  padding: 0 0 0 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.answer__list li + li {
  margin-top: 0.3em;
}

.code {
  margin: 0 0 0.9em;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(6, 6, 10, 0.82), rgba(10, 10, 15, 0.74));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 16px 40px -20px rgba(0, 0, 0, 0.9);
}

.code__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
}

.code__copy {
  display: flex;
  align-items: center;
  gap: 5px;
}

.code__copy svg {
  width: 13px;
  height: 13px;
}

.code__body {
  margin: 0;
  padding: 11px 14px 12px;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: clamp(9.5px, min(2.9vw, 2.2vh), 12.5px);
  line-height: 1.62;
  color: #c6c4d4;
  white-space: pre;
  overflow: hidden;
  font-variant-ligatures: none;
}

.code__body .k {
  color: var(--keyword);
}

.code__body .f {
  color: var(--func);
}

.ai__tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: -0.2em;
  color: var(--muted);
}

.tool {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.tool svg {
  width: 14px;
  height: 14px;
}

.ai__meta {
  margin-left: 8px;
  font-size: 11.5px;
}

/* ------------------------------------------------------------------ the prompt field */
.prompt {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  width: var(--pw);
  height: var(--ph);
  margin: 0;
  will-change: transform;
}

.prompt__glass {
  --a: 0deg;
  --rim: 0.4;
  --glow: 0.25;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: clamp(10px, 2.2vh, 15px) 12px clamp(8px, 1.6vh, 11px) 18px;
  border-radius: 22px;
  text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035));
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 24px 60px -24px rgba(0, 0, 0, 0.9),
    0 0 70px -16px rgba(143, 123, 255, var(--glow));
}

/* the iridescent edge: a conic gradient masked to a one pixel ring, turned by --a */
.prompt__rim {
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: var(--rim);
  background: conic-gradient(from var(--a), var(--violet), var(--cyan) 20%, rgba(255, 255, 255, 0.15) 35%, var(--amber) 52%, var(--rose) 68%, rgba(255, 255, 255, 0.15) 84%, var(--violet));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.prompt__field {
  position: relative;
  flex: 1;
  min-height: 0;
  font-size: clamp(14px, calc(1vh + 8px), 16px);
  line-height: 1.45;
}

.prompt__mirror,
.prompt__input,
.prompt__ph {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0 6px 0 0;
  font: inherit;
  line-height: inherit;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.prompt__mirror {
  color: var(--ink);
  pointer-events: none;
}

.prompt__mirror span {
  display: inline;
}

.prompt__mirror .prompt__caret {
  display: inline-block;
  width: 1.5px;
  height: 1.12em;
  margin-left: 1px;
  vertical-align: -0.2em;
  border-radius: 1px;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(160, 150, 255, 0.8);
  animation: caret 1.05s steps(1) infinite;
}

@keyframes caret {
  50% {
    opacity: 0;
  }
}

.prompt__ph {
  color: var(--muted);
  pointer-events: none;
}

.prompt__input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: transparent;
  caret-color: transparent;
}

.prompt__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.prompt__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -6px;
  border-radius: 50%;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.prompt__model,
.prompt__search {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
  white-space: nowrap;
}

.prompt__model svg,
.prompt__search svg {
  width: 13px;
  height: 13px;
}

.prompt__model {
  color: var(--ink-2);
}

@media (max-width: 380px) {
  .prompt__search {
    display: none;
  }
}

.prompt__send {
  margin-left: auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.prompt__send-face {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: background 0.35s, color 0.35s, box-shadow 0.35s;
}

.has-text .prompt__send-face {
  color: #0b0b10;
  background: linear-gradient(180deg, #ffffff, #dcdbe6);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.3), 0 4px 18px -4px rgba(143, 123, 255, 0.85);
}

.prompt__send:focus-visible,
.chat__back:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

/* the field while you type into it */
.prompt:focus-within .prompt__glass {
  --rim: 0.75;
}

/* ------------------------------------------------------------------ small screens */
@media (max-width: 560px) {
  .nav__links {
    display: none;
  }

  .nav__in {
    margin-left: auto;
  }

  .chip--wide {
    display: none;
  }

  .chat__share {
    display: none;
  }

  .chat__title {
    text-align: right;
  }
}

@media (max-height: 470px) {
  .hero__tag {
    display: none;
  }

  .ai__meta {
    display: none;
  }
}

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

.answer code,
.code {
  font-variant-ligatures: none;
}

/* the home never covers the chat: only its own buttons take the pointer, and none of them while the chat is open */
.home {
  pointer-events: none;
}

.home .chip,
.home .nav {
  pointer-events: auto;
}

.is-chat .home .chip,
.is-chat .home .nav {
  pointer-events: none;
}

.stage:not(.is-chat) .chat {
  pointer-events: none;
}
