/* ============================================================
   SONDER ARCHIVE · stylesheet
   Helvetica Now Text · pure B/W · auto dark-mode inversion
   frameless writing surface · hairline page-line
   release as a subtle in-line action
   ============================================================ */

/* ---------- Fonts (self-hosted, /fonts/) ---------- */
@font-face {
  font-family: 'Helvetica Now Text';
  src: url('fonts/HelveticaNowText-Regular.woff2') format('woff2'),
       url('fonts/HelveticaNowText-Regular.woff') format('woff'),
       url('fonts/HelveticaNowText-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Now Text';
  src: url('fonts/HelveticaNowText-RegIta.woff2') format('woff2'),
       url('fonts/HelveticaNowText-RegIta.woff') format('woff'),
       url('fonts/HelveticaNowText-RegIta.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Now Text';
  src: url('fonts/HelveticaNowText-Bold.woff2') format('woff2'),
       url('fonts/HelveticaNowText-Bold.woff') format('woff'),
       url('fonts/HelveticaNowText-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Theme tokens ---------- */
:root {
  --bg: #FFFFFF;
  --fg: #000000;
  --fg-soft: rgba(0, 0, 0, 0.65);   /* placeholder */
  --fg-faint: rgba(0, 0, 0, 0.35);  /* hairline at rest */
  --logo-invert: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #FFFFFF;
    --fg-soft: rgba(255, 255, 255, 0.65);
    --fg-faint: rgba(255, 255, 255, 0.35);
    --logo-invert: 1;
  }
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Helvetica Now Text', Helvetica, Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 300ms ease, color 300ms ease;
  overflow: hidden;
}

/* ---------- Star canvas (always on — gentle fade-in on load) ---------- */
#stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2000ms cubic-bezier(0.22, 1, 0.36, 1);
}
#stars.active { opacity: 1; }

/* ---------- Page layout ---------- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 24px 120px;
}

/* ---------- Header ---------- */
.header { text-align: center; }

.the {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.logo {
  display: block;
  width: 820px;
  max-width: 82vw;
  height: auto;
  margin: 0 auto;
  filter: invert(var(--logo-invert));
  transition: filter 300ms ease;
}

.tagline {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-top: 10px;
}

/* ---------- Form ---------- */
.form {
  /* margin: auto 0 — fills remaining vertical space above and below
     the form evenly, centering it between header and footer */
  margin: auto 0;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  filter: blur(0);
  transition: opacity 2000ms cubic-bezier(0.4, 0, 0.6, 1),
              filter 2000ms cubic-bezier(0.4, 0, 0.6, 1);
}

.form.releasing {
  opacity: 0;
  filter: blur(7px);
  pointer-events: none;
}

/* ---------- Writing surface ---------- */
.field-wrap {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.field {
  display: block;
  width: 100%;
  font-family: inherit;
  font-weight: 400;
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  color: var(--fg);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 10px 4px 4px;
  min-height: 44px;
  max-height: 120px;      /* small expansion, then scroll internally */
  resize: none;
  overflow-y: auto;
  outline: none;
  caret-color: var(--fg);
}

.field::placeholder {
  font-style: italic;
  color: var(--fg-soft);
  opacity: 1;
}

/* the "page line" — brightens on focus */
.field-line {
  height: 1px;
  width: 100%;
  background: var(--fg-faint);
  transition: background 300ms ease;
}

.field-wrap:focus-within .field-line {
  background: var(--fg);
}

/* subtle internal scrollbar (only appears when content exceeds max-height) */
.field::-webkit-scrollbar { width: 4px; }
.field::-webkit-scrollbar-thumb { background: var(--fg-faint); }
.field::-webkit-scrollbar-track { background: transparent; }

/* ---------- Location field (above textarea) ---------- */
.location-wrap {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 32px;
}

.location {
  display: block;
  width: 100%;
  font-family: inherit;
  font-weight: 400;
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  color: var(--fg);
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 10px 4px 4px;
  outline: none;
  caret-color: var(--fg);
}

.location::placeholder {
  font-style: italic;
  color: var(--fg-soft);
  opacity: 1;
}

.location-wrap .field-line {
  height: 1px;
  width: 100%;
  background: var(--fg-faint);
  transition: background 300ms ease;
}

.location-wrap:focus-within .field-line {
  background: var(--fg);
}

/* hide any native dropdown arrows browsers might still add */
.location::-webkit-calendar-picker-indicator {
  display: none !important;
}

/* ---------- Custom country suggestions dropdown ---------- */
.location-wrap {
  position: relative;          /* anchor for absolutely-positioned suggestions */
}

.location-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);       /* small gap below the hairline */
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--bg);
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 250ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 250ms cubic-bezier(0.22, 1, 0.36, 1);
}

.location-suggestions.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.location-suggestions li {
  font-family: inherit;
  font-weight: 400;
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--fg-faint);
  padding: 4px 4px;
  cursor: pointer;
  transition: color 150ms ease;
  /* prevent text selection during quick navigation */
  user-select: none;
  -webkit-user-select: none;
}

.location-suggestions li:hover,
.location-suggestions li[aria-selected="true"] {
  color: var(--fg);
}

/* slim scrollbar inside the dropdown */
.location-suggestions::-webkit-scrollbar { width: 4px; }
.location-suggestions::-webkit-scrollbar-thumb { background: var(--fg-faint); }
.location-suggestions::-webkit-scrollbar-track { background: transparent; }

/* ---------- Release — integrated on the line (right-aligned, subtle) ---------- */
.release {
  align-self: flex-end;
  font-family: inherit;
  font-weight: 400;
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg);
  background: transparent;
  border: none;
  padding: 8px 0 0;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 200ms ease;
}

.release:hover,
.release:focus-visible {
  opacity: 1;
  outline: none;
}

/* ---------- Release message ---------- */
.message {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  font-family: inherit;
  font-weight: 400;
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  color: var(--fg);
  opacity: 0;
  filter: blur(7px);
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
  transition: opacity 2000ms cubic-bezier(0.4, 0, 0.6, 1),
              transform 2000ms cubic-bezier(0.4, 0, 0.6, 1),
              filter 2000ms cubic-bezier(0.4, 0, 0.6, 1);
}

.message.visible {
  opacity: 1;
  filter: blur(0);
  transform: translate(-50%, -50%) scale(1);
}

/* letters dissolve into each other via blur + drift gently upward —
   then the whole glowing mass fades as the star emerges inside it */
.message.cramping {
  filter: blur(7px);
  transform: translate(-50%, calc(-50% - 24px)) scale(0.5);
  opacity: 0;
  transition: filter 1800ms cubic-bezier(0.4, 0, 0.6, 1),
              transform 1800ms cubic-bezier(0.4, 0, 0.6, 1),
              opacity 1800ms cubic-bezier(0.4, 0, 0.6, 1);
}

/* ---------- Footer ---------- */
.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 40px;
  display: flex;
  justify-content: center;
  gap: 80px;
  font-size: 12px;
  letter-spacing: 0.02em;
  z-index: 1;
}

.footer a {
  color: var(--fg);
  text-decoration: none;
  transition: opacity 200ms ease;
}

.footer a:hover { opacity: 0.6; }

/* ---------- Responsive (tablet) ---------- */
@media (max-width: 820px) {
  .page { padding: 52px 20px 140px; }
  .logo { width: 560px; }
}

/* ---------- Responsive (phone) ---------- */
@media (max-width: 520px) {
  .page { padding: 48px 14px 160px; }
  .the { font-size: 11px; margin-bottom: 2px; }
  .logo { width: 380px; max-width: 92vw; }
  .tagline { font-size: 11px; margin-top: 5px; }
  .form { max-width: 280px; }      /* narrower writing field — auto-centers vertically */
  .field { font-size: 13px; }
  .location { font-size: 13px; }
  .location-wrap { margin-bottom: 24px; }
  .release { font-size: 11px; }
  .message {
    font-size: 13px;
    white-space: normal;
    text-align: center;
    width: 80vw;
  }
  .footer {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    bottom: 28px;
    font-size: 11px;
  }
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
