/* North landing. Registers per DESIGN.md: Gloock declares, the text serif
   contemplates (New York on Apple hardware), the system sans states facts. */

@font-face {
  font-family: 'Gloock';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/gloock-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2191, U+2193, U+FEFF, U+FFFD;
}

:root {
  --bg: #FAFAF9;
  --ink: #191A1C;
  --muted: #5D6066;
  --hair: rgba(25, 26, 28, 0.14);
  --field: rgba(25, 26, 28, 0.04);
  --display: 'Gloock', ui-serif, Georgia, serif;
  --text: ui-serif, 'New York', 'Source Serif 4', Georgia, serif;
  --fact: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1012;
    --ink: #EAEBED;
    --muted: #9A9DA3;
    --hair: rgba(234, 235, 237, 0.16);
    --field: rgba(234, 235, 237, 0.06);
  }
}

:root[data-theme="light"] {
  --bg: #FAFAF9;
  --ink: #191A1C;
  --muted: #5D6066;
  --hair: rgba(25, 26, 28, 0.14);
  --field: rgba(25, 26, 28, 0.04);
}

:root[data-theme="dark"] {
  --bg: #0F1012;
  --ink: #EAEBED;
  --muted: #9A9DA3;
  --hair: rgba(234, 235, 237, 0.16);
  --field: rgba(234, 235, 237, 0.06);
}

* { box-sizing: border-box; margin: 0; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: min(100% - 3rem, 41rem);
  margin-inline: auto;
}

/* ---- the anchor (the page's own menu bar item) ---- */

.anchor {
  position: fixed;
  top: 0.75rem;
  right: 0.9rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  max-width: min(62vw, 21rem);
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
}

.anchor .glyph { flex: none; display: block; }

.anchor .line {
  max-width: 0;
  opacity: 0;
  transform: translateX(4px);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition:
    max-width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.anchor.open {
  border-color: var(--hair);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.anchor.open .line {
  max-width: 18rem;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-transparency: reduce) {
  .anchor.open {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

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

/* ---- header ---- */

header.wrap { padding-top: 1.4rem; }

.wordmark {
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1.15;
}

.wordmark a {
  color: inherit;
  text-decoration: none;
}

/* ---- hero ---- */

.hero {
  margin-top: 0;
  padding-top: clamp(3.5rem, 10vh, 5.5rem);
}

h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw + 1rem, 4rem);
  line-height: 1.1;
  max-width: 14ch;
}

.sub {
  margin-top: 1.4rem;
  max-width: 38ch;
  font-size: 1.185rem;
  line-height: 1.55;
  color: var(--muted);
}

.sub a { color: inherit; }

/* ---- form ---- */

form { margin-top: 2.4rem; max-width: 27rem; }

.row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

input[type="email"] {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.68rem 1.1rem;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: var(--field);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1rem;
}

input[type="email"]::placeholder { color: var(--muted); opacity: 0.75; }

#join-btn {
  flex: none;
  padding: 0.68rem 1.35rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--fact);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
}

#join-btn:hover { background: color-mix(in srgb, var(--ink) 88%, var(--bg)); }
#join-btn:active { transform: scale(0.98); }
#join-btn:disabled { opacity: 0.6; cursor: default; }

input[type="email"]:focus-visible,
#join-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.hp {
  position: absolute;
  left: -5000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.form-note {
  margin-top: 0.8rem;
  font-family: var(--fact);
  font-size: 0.8125rem;
  color: var(--muted);
}

.form-note.err { color: var(--ink); }

.form-done {
  margin-top: 2.4rem;
  font-size: 1.185rem;
}

/* ---- a day with North ---- */

section { margin-top: clamp(5rem, 12vw, 7.5rem); }

h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.15;
}

.day h2 { margin-bottom: 3.5rem; }

.moment + .moment { margin-top: 3.75rem; }

.when {
  font-family: var(--fact);
  font-size: 0.8125rem;
  color: var(--muted);
}

.prompt {
  margin-top: 0.4rem;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.4vw, 1.7rem);
  line-height: 1.15;
  max-width: 18ch;
}

.how {
  margin-top: 0.9rem;
  max-width: 44ch;
  line-height: 1.55;
  color: var(--muted);
}

@media (min-width: 768px) {
  .moment:nth-of-type(2) { margin-left: 3.5rem; }
  .moment:nth-of-type(3) { margin-left: 7rem; }
}

/* ---- no streaks ---- */

.streaks { text-align: center; }

.streaks h2 { font-size: clamp(1.9rem, 3.4vw, 2.4rem); }

.center { margin-inline: auto; }

.streaks .how { margin-top: 1.2rem; }

.comeback { margin-top: 3.75rem; }

.greeting {
  font-family: var(--display);
  font-size: 1.45rem;
  line-height: 1.15;
}

.days {
  margin-top: 0.5rem;
  font-family: var(--fact);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---- facts ---- */

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 3rem;
  font-family: var(--fact);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted);
}

.facts strong { color: var(--ink); font-weight: 500; }

@media (max-width: 640px) {
  .facts { grid-template-columns: 1fr; }
}

/* ---- footer ---- */

footer {
  margin-top: clamp(5rem, 12vw, 7.5rem);
  margin-bottom: 2.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--hair);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-family: var(--fact);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---- reveal (added by JS only, so no-JS users see everything) ---- */

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .anchor .line { transition: opacity 0.3s ease; transform: none; }
}

/* ---- utilities ---- */

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