/* Base Reality — one screen. Tokens come from the badge identity
   (ClaudeDesign/base-reality-badge): night field, cream ink, one warm sun. */

:root {
  --night: #04080d;
  --night-lift: #0a1422;
  --ink: #faf2de;
  --slate: #8a99ac;
  --sun: #ffc766;
  --hair: rgba(250, 242, 222, 0.2);
  --pad: clamp(20px, 3.2vw, 110px);
  --lens-w: 100%;
  --lens-tall: 0.8; /* tallest the lens may be, as a multiple of its width */
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: "Montserrat", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* ---------- the shader surface ---------- */

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ---------- layout: wordmark / lens / one line / footer ---------- */

.stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: 100vh;
  height: 100svh;
  min-height: 540px;
  padding: var(--pad);
  padding-top: max(var(--pad), env(safe-area-inset-top));
  padding-bottom: max(calc(var(--pad) * 0.8), env(safe-area-inset-bottom));
}

.mark {
  text-align: center;
  padding-bottom: clamp(22px, 4.4vh, 96px);
}

/* The lockup from the badge: Montserrat Light, tracked wide. The text-indent
   balances the trailing tracking so the word sits optically centred. */
.mark h1 {
  margin: 0;
  font-size: clamp(12px, 1.1vw, 36px);
  font-weight: 300;
  letter-spacing: 0.56em;
  text-indent: 0.56em;
  text-transform: uppercase;
  line-height: 1;
}

.lens-row {
  container-type: size;
  display: grid;
  place-items: end center; /* the lens rests on the horizon, just above the line of type */
  min-height: 0;
}

.lens {
  position: relative;
  width: min(100cqw, 100cqh * 1.9);
  height: min(100cqh, 100cqw * var(--lens-tall));
}

.lens video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}

.say {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px 40px;
  width: var(--lens-w);
  max-width: 100%;
  margin: clamp(22px, 4.2vh, 96px) auto 0;
}

.line {
  margin: 0;
  font-size: clamp(19px, 1.95vw, 64px);
  font-weight: 300;
  letter-spacing: -0.006em;
  line-height: 1.25;
}

.ask {
  flex: 0 1 clamp(380px, 26vw, 860px);
  min-width: min(100%, 300px);
}

#access {
  display: flex;
  align-items: baseline;
  gap: clamp(16px, 1.1vw, 36px);
  padding-bottom: clamp(9px, 0.62vw, 20px);
  border-bottom: 1px solid var(--hair);
  transition: border-color 0.25s ease;
}

#access[hidden] {
  display: none;
}

#access:focus-within {
  border-bottom-color: var(--sun);
}

#access input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: clamp(16px, 1.1vw, 36px); /* never under 16px: iOS zooms the page on smaller fields */
  line-height: 1.4;
  caret-color: var(--sun);
}

#access input::placeholder {
  color: var(--slate);
  opacity: 1;
}

#access input:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  box-shadow: 0 0 0 100px var(--night) inset;
  caret-color: var(--sun);
}

#access button {
  flex: none;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: clamp(14px, 0.97vw, 32px);
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease;
}

#access button:hover {
  color: var(--sun);
}

#access button:focus-visible {
  outline: 1px solid var(--sun);
  outline-offset: 6px;
  border-radius: 2px;
}

#access button[disabled] {
  color: var(--slate);
  cursor: default;
}

.status {
  min-height: 1.5em;
  margin: 8px 0 0;
  color: var(--slate);
  font-size: clamp(12.5px, 0.86vw, 28px);
  font-weight: 400;
  line-height: 1.5;
}

.status[data-tone="done"] {
  color: var(--ink);
  font-size: clamp(16px, 1.1vw, 36px);
  font-weight: 300;
  margin-top: 2px;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(14px, 3.4vh, 84px);
  color: var(--slate);
  font-size: clamp(12px, 0.83vw, 26px);
  font-weight: 400;
  line-height: 1.4;
}

/* ---------- one load sequence: the type arrives after the light does ---------- */

.mark,
.say,
.foot {
  animation: arrive 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.mark {
  animation-delay: 0.15s;
}

.say {
  animation-delay: 1.5s;
}

.foot {
  animation-delay: 1.9s;
}

@keyframes arrive {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mark,
  .say,
  .foot {
    animation: none;
  }
}

/* ---------- narrow and upright screens ---------- */

@media (max-aspect-ratio: 1/1) {
  :root {
    --lens-tall: 1;
  }
}

@media (max-aspect-ratio: 3/4) {
  :root {
    --lens-tall: 1.35;
  }
}

@media (max-width: 720px) {
  .say {
    flex-direction: column;
    gap: 22px;
  }

  .ask {
    flex: none;
    width: 100%;
  }

  .foot {
    font-size: 11.5px;
  }
}

/* ---------- fallback when WebGL is missing, or the video can't be read as a
   texture: the same composition, drawn with CSS ---------- */

.no-gl #field {
  display: none;
}

.no-gl body {
  background:
    radial-gradient(60% 50% at 72% 62%, rgba(255, 199, 102, 0.1), transparent 70%),
    linear-gradient(180deg, #060b10, #020508);
}

.no-gl .lens,
.dom-video .lens {
  overflow: hidden;
  border-radius: 11% 11% 23% 23% / 20% 20% 44% 44%;
}

.no-gl .lens {
  background: linear-gradient(180deg, #101d35 0%, #54708f 60%, #f2b872 94%, #ffe2b0 100%);
  box-shadow: 0 1px 0 0 rgba(250, 242, 222, 0.75), 0 18px 60px -30px rgba(255, 199, 102, 0.55);
}

.no-gl .lens video,
.dom-video .lens video {
  opacity: 1;
}

/* the horizon and the sun, without the shader */
.no-gl .lens-row {
  position: relative;
}

.no-gl .lens-row::before,
.no-gl .lens-row::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.no-gl .lens-row::before {
  left: calc(var(--pad) * -1);
  right: calc(var(--pad) * -1);
  bottom: -1px;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(250, 242, 222, 0.1),
    rgba(250, 242, 222, 0.75) 45%,
    #fffffa 70%,
    rgba(250, 242, 222, 0.45) 92%,
    rgba(250, 242, 222, 0.2)
  );
}

.no-gl .lens-row::after {
  left: 70%;
  bottom: -40px;
  width: 80px;
  height: 80px;
  margin-left: -40px;
  background: radial-gradient(circle, #fffffa 0 3px, rgba(255, 199, 102, 0.55) 5px, rgba(255, 199, 102, 0) 40px);
}
