/* Screens Away website. White by day, night blue at night. The home page is the night. */

:root {
  --ink: #141414;
  --ink-60: rgba(20, 20, 20, 0.6);
  --ink-12: rgba(20, 20, 20, 0.12);
  --white: #ffffff;
  --night: #4a8cdf;
  --star-pink: #fbd0db;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.night {
  background-color: var(--night);
  position: relative;
  overflow-x: hidden;
}

body.day {
  background-color: var(--white);
}

a {
  color: inherit;
}

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

/* ── Top row ───────────────────────────────────────────── */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 36px 64px 0;
  position: relative;
  z-index: 1;
}

.wordmark {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 28px;
  text-decoration: none;
}

.night .wordmark {
  color: var(--white);
}

.top nav {
  display: flex;
  gap: 28px;
}

.top nav a {
  font-size: 15px;
  font-weight: 500;
  line-height: 44px;
  text-decoration: none;
}

.top nav a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ── The night sky ─────────────────────────────────────── */

.sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.star {
  position: absolute;
  width: calc(var(--size) * 1px);
  height: calc(var(--size) * 1px);
  margin: calc(var(--size) * -0.5px) 0 0 calc(var(--size) * -0.5px);
  fill: var(--white);
  animation: twinkle var(--pace, 6s) ease-in-out var(--wait, 0s) infinite;
}

.star.pink {
  fill: var(--star-pink);
}

.s1 {
  --size: 60;
  left: 12.5%;
  top: 21.1%;
  --pace: 7s;
}
.s2 {
  --size: 32;
  left: 8.3%;
  top: 73.3%;
  --pace: 5.5s;
  --wait: 1.2s;
}
.s3 {
  --size: 36;
  left: 87.5%;
  top: 18.9%;
  --pace: 6.5s;
  --wait: 0.6s;
}
.s4 {
  --size: 22;
  left: 77.1%;
  top: 42.2%;
  --pace: 5s;
  --wait: 2.1s;
}
.s5 {
  --size: 56;
  left: 90.3%;
  top: 71.1%;
  --pace: 8s;
  --wait: 0.3s;
}
.s6 {
  --size: 20;
  left: 68.1%;
  top: 84.4%;
  --pace: 6s;
  --wait: 1.7s;
}
.s7 {
  --size: 24;
  left: 32.6%;
  top: 85.6%;
  --pace: 7.5s;
  --wait: 2.6s;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.82);
  }
}

/* ── Home ──────────────────────────────────────────────── */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 24px 48px;
  position: relative;
  z-index: 1;
}

.poke {
  position: relative;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 40%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.flip {
  display: block;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.poke.is-rolled .flip {
  transform: scaleX(-1);
}

.bear {
  display: block;
  width: 210px;
  height: auto;
  animation: breathe 5.5s ease-in-out infinite;
  transform-origin: 50% 85%;
}

.poke.is-poked .bear {
  animation: squish 0.28s ease-out;
}

.bear .eye-open {
  opacity: 0;
}

.poke.is-peeking .eye-open {
  opacity: 1;
}

.poke.is-peeking .eye-shut {
  opacity: 0;
}

/* The nightcap is drawn in three layers; all of them move together. */
.bear .cap {
  transform-box: view-box;
  transform-origin: 470px 420px;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.poke.is-slipped .cap {
  transform: rotate(-9deg) translate(-8px, 16px);
}

/* What the bear mumbles: a sticker, like the tags in the app. */
.say {
  position: absolute;
  left: 78%;
  top: -4%;
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  white-space: nowrap;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 #2f6dc4;
  opacity: 0;
  transform: rotate(4deg) scale(0.8);
  transform-origin: 0 100%;
  transition:
    opacity 0.16s ease-out,
    transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  pointer-events: none;
}

.say.is-shown {
  opacity: 1;
  transform: rotate(4deg) scale(1);
}

@keyframes squish {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.07, 0.9);
  }
  70% {
    transform: scale(0.98, 1.04);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.025, 1.04);
  }
}

.hero h1 {
  margin: 22px 0 0;
  font-family: var(--serif);
  font-size: clamp(60px, 7.3vw, 104px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.96;
  color: var(--white);
  text-wrap: balance;
}

.hero h1 span {
  display: block;
}

.lede {
  margin: 22px 0 0;
  max-width: 460px;
  font-size: 18px;
  line-height: 28px;
  text-wrap: pretty;
}

.signup {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}

.signup input[type='email'],
.note-form input[type='email'],
.note-form textarea {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--white);
  border: 1.5px solid var(--ink);
  border-radius: 26px;
  padding: 0 20px;
  outline: none;
}

.signup input[type='email'] {
  width: 260px;
  height: 52px;
}

.signup input::placeholder,
.note-form input::placeholder,
.note-form textarea::placeholder {
  color: rgba(20, 20, 20, 0.5);
}

.signup button,
.note-form button {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  height: 52px;
  padding: 0 24px;
  color: var(--white);
  background: var(--ink);
  border: 0;
  border-radius: 26px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    transform 0.12s ease-out,
    opacity 0.12s ease-out;
}

.signup button:active,
.note-form button:active {
  transform: scale(0.98);
}

.signup button[disabled],
.note-form button[disabled] {
  cursor: default;
  opacity: 0.85;
}

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

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

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 24px;
}

.foot {
  padding: 0 24px 36px;
  text-align: center;
  font-size: 14px;
  line-height: 20px;
  position: relative;
  z-index: 1;
}

/* ── Day pages: privacy, support, changelog, not found ─── */

.page {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}

.page h1 {
  margin: 0 0 28px;
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 72px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
  text-wrap: balance;
}

.page h2 {
  margin: 40px 0 8px;
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 600;
  line-height: 28px;
}

.page h3 {
  margin: 20px 0 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 24px;
  color: var(--ink-60);
}

.page p,
.page li {
  font-size: 17px;
  line-height: 28px;
  text-wrap: pretty;
}

.page p {
  margin: 0 0 14px;
}

.page ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

.page .small {
  margin-top: 40px;
  font-size: 15px;
  color: var(--ink-60);
}

.note-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}

.note-form input[type='email'] {
  height: 52px;
}

.note-form textarea {
  min-height: 160px;
  padding: 14px 20px;
  line-height: 26px;
  resize: vertical;
}

.note-form button {
  align-self: flex-start;
}

.lost {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.button-link {
  display: inline-flex;
  align-items: center;
  height: 52px;
  padding: 0 24px;
  margin-top: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--white);
  background: var(--ink);
  border-radius: 26px;
  text-decoration: none;
}

/* ── Phones ────────────────────────────────────────────── */

@media (max-width: 640px) {
  .top {
    padding: 14px 24px 0;
  }

  .wordmark {
    font-size: 20px;
  }

  .top nav {
    gap: 20px;
  }

  .bear {
    width: 168px;
  }

  .say {
    left: 50%;
    top: -36px;
    font-size: 15px;
    transform: translateX(-50%) rotate(-3deg) scale(0.8);
    transform-origin: 50% 100%;
  }

  .say.is-shown {
    transform: translateX(-50%) rotate(-3deg) scale(1);
  }

  .hero {
    padding: 8px 24px 24px;
  }

  .hero h1 {
    margin-top: 18px;
    font-size: clamp(40px, 12.8vw, 52px);
  }

  .lede {
    margin-top: 18px;
    max-width: 310px;
    font-size: 17px;
    line-height: 26px;
  }

  .signup {
    flex-direction: column;
    width: 100%;
    max-width: 342px;
    margin-top: 26px;
  }

  .signup input[type='email'],
  .signup button {
    width: 100%;
  }

  .foot {
    padding-bottom: 28px;
  }

  .s1 {
    --size: 40;
    left: 13.3%;
    top: 17.8%;
  }
  .s2 {
    --size: 22;
    left: 14.4%;
    top: 90%;
  }
  .s3 {
    --size: 24;
    left: 87.2%;
    top: 14.2%;
  }
  .s4 {
    --size: 18;
    left: 90.3%;
    top: 39.1%;
  }
  .s5 {
    --size: 36;
    left: 84.6%;
    top: 87.9%;
  }
  .s6,
  .s7 {
    display: none;
  }

  .page {
    padding: 48px 24px 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .star,
  .bear,
  .poke.is-poked .bear {
    animation: none;
  }

  .flip,
  .bear .cap,
  .say {
    transition: none;
  }

  .signup button,
  .note-form button {
    transition: none;
  }
}

/* Short phones: keep the whole night on one screen. */
@media (max-width: 640px) and (max-height: 720px) {
  .bear {
    width: 128px;
  }

  .hero h1 {
    margin-top: 12px;
    font-size: clamp(38px, 12vw, 46px);
  }

  .lede {
    margin-top: 12px;
  }

  .signup {
    margin-top: 18px;
  }

  .status {
    margin-top: 8px;
  }

  .s4 {
    display: none;
  }

  .say {
    top: -24px;
    padding: 5px 14px;
  }
}
