/* Late Night Studio — night sky, pine forest, moonlit lake */

:root {
  --forest-deep: #0E211C;
  --pine: #163A30;
  --moss: #2C5446;
  --lake: #1E4A5C;
  --lake-deep: #12304A;
  --moon: #E9E1B9;
  --firefly: #D6F08A;
  --ink-light: #E6EFE9;
  --ink-soft: #A7C1B6;

  --serif: "Gloock", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(16px, 5vw, 64px);
  --measure: 38rem;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-light);
  background-color: #001C3C;
  -webkit-font-smoothing: antialiased;
}

/* forest floor under the trees, slowly turning into lake water */
main {
  background: linear-gradient(
    180deg,
    #0B1F1A 0%,
    #10302A 35%,
    #0F3540 70%,
    #0D3569 100%
  );
}

/* ---------- night sky photo (header + hero) ---------- */

.sky {
  position: relative;
  background: #011236 url("/images/sky.webp") right top / cover no-repeat;
}

.hero-wrap { padding-bottom: clamp(40px, 8vw, 120px); }

/* ---------- treeline: sits on the bottom of the sky ---------- */

.treeline {
  height: clamp(130px, 17vw, 300px);
  margin-top: calc(-1 * clamp(70px, 9vw, 160px));
  background: url("/images/trees.webp") center bottom / cover no-repeat;
  position: relative;
}

/* a strip of ground under the trees so they never float */
.treeline::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 3px;
  background: #0B1F1A;
}

/* each tree floats on its own (strips are added by trees.js) */
.treeline.is-floating { background: none; }
.tree-strip {
  position: absolute;
  inset: 0;
  background: url("/images/trees.webp") center bottom / cover no-repeat;
  animation: tree-float 3s infinite;
  animation-timing-function: steps(1, end); /* snap, don't glide: pixel-art feel */
}
@keyframes tree-float {
  0%, 100% { transform: translateY(0); }
  25%      { transform: translateY(calc(var(--px, 4px) * -1)); }
  50%      { transform: translateY(calc(var(--px, 4px) * -2)); }
  75%      { transform: translateY(calc(var(--px, 4px) * -1)); }
}
@media (prefers-reduced-motion: reduce) {
  .tree-strip { animation: none; }
}

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

.site-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 24px var(--gutter);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-light);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.25rem;
}

.moon {
  width: 28px;
  height: 28px;
  color: var(--moon);
}

.site-nav {
  display: flex;
  gap: 24px;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}

.site-nav a:hover { color: var(--ink-light); }

a:focus-visible {
  outline: 2px solid var(--moon);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ---------- shared section rhythm ---------- */

main > section,
.hero {
  position: relative;
  padding: clamp(56px, 10vw, 120px) var(--gutter);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-bottom: 40px;
}

h3 { font-size: clamp(2rem, 4vw, 2.75rem); }

p { margin: 0 0 1em; max-width: var(--measure); }

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

.hero {
  min-height: 68vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero h1 {
  font-size: clamp(2.75rem, 9vw, 7rem);
  max-width: 11ch;
  margin-bottom: 28px;
  animation: rise 1.2s ease-out both;
}

.lede {
  font-size: clamp(1.125rem, 2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 34rem;
  animation: rise 1.2s .2s ease-out both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- projects ---------- */

.work {
  padding-top: clamp(32px, 6vw, 72px);
}

.project {
  display: grid;
  gap: 40px;
  align-items: center;
  max-width: 68rem;
}

.project + .project { margin-top: clamp(72px, 10vw, 128px); }

.status {
  color: var(--firefly);
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: 10px;
}

.project h3 { margin-bottom: 16px; }

.platform {
  color: var(--ink-soft);
  font-size: .95rem;
}

/* The Grove */

.sprout {
  width: min(180px, 40vw);
  height: auto;
}

@media (min-width: 800px) {
  .project-fajr,
  .project-grove,
  .project-library { grid-template-columns: 220px 1fr; }
  .sprout,
  .project-art { justify-self: center; }
}

/* Late Night Library: pixel art, kept crisp when scaled */

.project-art {
  width: min(180px, 40vw);
  height: auto;
}

.pixel { image-rendering: pixelated; }

/* ---------- about ---------- */

.about p {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.4vw, 1.75rem);
  line-height: 1.45;
  max-width: 40rem;
}

/* ---------- contact + footer: the lake photo ---------- */

.lakeside {
  position: relative;
  background: #001C3C url("/images/lake.webp") right center / cover no-repeat;
}

/* tablets: zoom the sky a little less so the moon clears the headline */
@media (min-width: 601px) and (max-width: 900px) {
  .sky { background-size: 160% auto; }
}

/* phones: size the photos by screen width instead of zooming in,
   so the moons stay small and clear of the text */
@media (max-width: 600px) {
  .sky {
    background: #02334C url("/images/sky-mobile.webp") center top / cover no-repeat;
  }
  .lakeside {
    min-height: 640px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #0D3569 url("/images/lake.webp") right bottom / 240% auto no-repeat;
  }
}

/* blend the top of the lake into the page above */
.lakeside::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 45%;
  background: linear-gradient(#0D3569, rgba(13, 53, 105, 0));
  pointer-events: none;
}

.lakeside > * { position: relative; }

.contact {
  padding: clamp(96px, 14vw, 200px) var(--gutter) clamp(72px, 12vw, 160px);
}

.contact h2 { margin-bottom: 16px; }

.email {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 3rem);
  color: var(--ink-light);
  text-decoration: none;
  border-bottom: 2px solid var(--moon);
  overflow-wrap: anywhere;
}

.email:hover { border-bottom-color: transparent; }

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

.site-footer {
  padding: 24px var(--gutter) 32px;
  color: var(--ink-soft);
  font-size: .9rem;
}

.site-footer p { margin: 0; }

/* ---------- 404 ---------- */

.lost {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lost a { color: var(--moon); }

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero h1, .lede { animation: none; }
}

.lost-page { background-color: #0B1F1A; }
