/* ============================================
   Curious Life — A Study of Human Experience
   V3 redesign · dark / technical / single-column
   ============================================ */

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

:root {
  --bg: #fefdfb;
  --fg: #2c2420;
  --muted: #6b5d54;
  --accent: #c4a24e;
  --accent-hover: #a8863a;
  --border: #e7e1d6;
  --card-bg: #f6f2ea;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Gentium Plus', Georgia, serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Accessible focus ring */
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Galaxy starfield — blooms from the Mycelium mark on hover */
#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9998;
  pointer-events: none;
}

/* NAV */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: rgba(254, 253, 251, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.logo img {
  height: 22px;
  width: auto;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links a {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--fg);
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* MAIN */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Offset anchor targets so they clear the fixed nav */
[id] {
  scroll-margin-top: 96px;
}

/* HERO */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

.hero-logo {
  width: auto;
  height: clamp(59px, 7.7vw, 83px);
  display: block;
  align-self: flex-start;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 300;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.hero h1 strong {
  font-weight: 600;
  color: var(--accent);
}

.hero .subtitle {
  font-family: 'Work Sans', sans-serif;
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 560px;
  margin-bottom: 3rem;
}

/* CTA BAR */
.cta-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 2rem;
}

.cta-bar a {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg);
  text-decoration: none;
  font-family: 'Work Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 400;
  transition: all 0.2s;
}

.cta-bar a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cta-bar .primary {
  background: #c4c4c4;
  color: var(--fg);
  border-color: #c4c4c4;
  font-weight: 500;
}

.cta-bar .primary:hover {
  background: var(--accent);
  color: var(--fg);
  border-color: var(--accent);
}

/* WHAT IS THIS */
.what {
  padding: 5rem 0;
  border-top: 1px solid var(--border);
}

.what h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.what p {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1.2rem;
  max-width: 560px;
}

/* SPACES PREVIEW */
.spaces {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.spaces h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.space-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  list-style: none;
}

.space-grid li {
  aspect-ratio: 1 / 1;       /* square cards */
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* caption anchored at the bottom of the colour field */
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

/* Subtle elemental backgrounds — earth · sunset · air · water */
.space-grid li.space-earth { background: #e3cf97; }
.space-grid li.space-peach { background: #f6d2bb; }
.space-grid li.space-air   { background: #eaf0f1; }
.space-grid li.space-water { background: #add7ff; }

/* Frosted glass gradient behind the caption text */
.space-grid .space-caption {
  padding: 2rem 1.4rem 1.4rem;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.12));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(to top, #000 55%, transparent 100%);
  mask-image: linear-gradient(to top, #000 55%, transparent 100%);
}

.space-grid .space-title {
  font-weight: 500;
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.space-grid .space-desc {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

/* SIGNUP FORM — posts to /api/apply (D1 + Resend) */
.signup {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.signup h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1rem;
}

.signup-note {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 480px;
  margin-bottom: 1.5rem;
}

.signup-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: 480px;
}

.signup-row input[type="email"] {
  flex: 1;
  min-width: 200px;
  font-family: 'Work Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--fg);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.7rem 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.signup-row input[type="email"]::placeholder {
  color: rgba(107, 93, 84, 0.5);
}

.signup-row input[type="email"]:focus {
  border-color: var(--accent);
}

.signup-submit {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
  background: #c4c4c4;
  border: 1px solid #c4c4c4;
  border-radius: 4px;
  padding: 0.7rem 1.6rem;
  cursor: pointer;
  transition: all 0.2s;
}

.signup-submit:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.signup-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.signup-message {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 1rem;
}

.signup-message.signup-error {
  color: #b3503e;
}

/* HOW IT WORKS */
.how {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.how h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

.steps {
  list-style: none;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}

.steps li::before {
  content: counter(step);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
  margin-right: 1rem;
}

.steps li strong {
  color: var(--fg);
  font-weight: 500;
}

/* FOOTER */
footer {
  padding: clamp(5rem, 12vh, 9rem) 0 4rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.footer-brand {
  margin-bottom: clamp(3rem, 7vh, 5.5rem);
}

.footer-logo {
  display: block;
  width: clamp(200px, 60%, 400px);
  height: auto;
  margin-bottom: 1.25rem;
}

.footer-motto {
  font-family: 'Gentium Plus', Georgia, serif;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  line-height: 1.2;
  color: var(--fg);
  letter-spacing: 0.01em;
  text-indent: -0.02em;   /* flush the M ink with the logo's left edge */
}

footer .built-on {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 9999;       /* stay above the galaxy starfield (z 9998) */
}

.built-on-label {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.4s ease;
}

.mycelium-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.mycelium-brand:hover {
  text-decoration: none;
}

.mycelium-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.mycelium-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.mycelium-name {
  font-family: 'Geist', system-ui, sans-serif;
  font-size: 1.4rem;
  color: #1c1917;
  letter-spacing: -0.01em;
  line-height: 1.05;
  transition: color 0.4s ease;
}

.mycelium-tag {
  font-family: 'Geist', system-ui, sans-serif;
  font-weight: 300;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: #7d7099;
  padding-left: 2px;
  transition: color 0.4s ease;
}

/* When the galaxy is open, lift the Mycelium attribution to light tones so it
   stays legible against the night sky (mirrors mycelium.id-site's dark variant) */
body.galaxy-active .built-on-label { opacity: 0; }
body.galaxy-active .mycelium-name { color: #e8e8ec; }
body.galaxy-active .mycelium-tag { color: #a99ece; }

.footer-copyright {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.75rem;
  color: #9a8d80;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* RESPONSIVE */
@media (max-width: 640px) {
  .page { padding: 0 1.5rem; }
  nav { padding: 1rem 1.5rem; }
  .nav-links a { padding: 0.4rem 0.85rem; font-size: 0.75rem; }
  .space-grid { grid-template-columns: 1fr; }
  .cta-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .cta-bar a { text-align: center; }
  .signup-row { flex-direction: column; align-items: stretch; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
