/* ============================================================
   Fun — floating world, archive feed, and article pages.
   Shares the site palette: paper, ink, mono + serif.
   ============================================================ */

:root {
  --fun-paper: #f0eee6;
  --fun-ink: #16161d;
  --fun-muted: #8f8b7c;
  --fun-line: #d9d5c7;
  --fun-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
}

/* ---------- the world ---------- */
.world {
  position: relative;
  height: 92vh;
  min-height: 560px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 10%, #f7f5ee 0%, var(--fun-paper) 55%, #e9e6da 100%);
}
.world-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.world-canvas canvas { display: block; }

.world-copy {
  position: absolute;
  top: 3.4rem;
  left: 3.2rem;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
.world.card-open .world-copy { opacity: 0.25; }
.world-kicker {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--fun-muted);
  text-transform: uppercase;
}
.world-title {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1.08;
  margin-top: 0.5rem;
  max-width: 16em;
}
.world-sub {
  margin-top: 0.9rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: #6d6a5e;
  max-width: 34ch;
}

/* blog links overlaying the world, top right */
.world-blogs {
  position: absolute;
  top: 3.6rem;
  right: 3.2rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-end;
  text-align: right;
  max-width: 22rem;
  transition: opacity 0.45s ease;
}
.world.card-open .world-blogs { opacity: 0.25; }
.world-blogs-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fun-muted);
  margin-bottom: 0.35rem;
}
.world-blog-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  color: var(--fun-ink);
  text-decoration: none;
}
.world-blog-date {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--fun-muted);
}
.world-blog-title {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.2;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.world-blog-link:hover .world-blog-title { border-color: var(--fun-ink); }

.world-hint {
  position: absolute;
  bottom: 1.2rem;
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.35);
  z-index: 2;
  pointer-events: none;
}

/* ---------- archive feed ---------- */
.feed-section { padding: 5.5rem 3.2rem 7rem; background: #fff; }
.feed-heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.feed-heading em {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 1.15em;
}
.feed-note {
  font-size: 0.82rem;
  color: var(--fun-muted);
  margin-bottom: 2.6rem;
}

.feed { display: flex; flex-direction: column; }
.feed-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.6rem 0.4rem;
  border-top: 1px solid var(--fun-line);
  color: inherit;
  text-decoration: none;
  transition: background 0.2s ease;
}
.feed-row:last-child { border-bottom: 1px solid var(--fun-line); }
.feed-row:hover { background: #faf9f4; }

.feed-body { flex: 1 1 auto; min-width: 0; }
.feed-meta {
  display: flex;
  gap: 1.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--fun-muted);
}
.feed-title {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.2;
  margin: 0.45rem 0 0.35rem;
}
.feed-excerpt {
  font-family: var(--fun-sans);
  font-size: 0.92rem;
  line-height: 1.55;
  color: #55524a;
  max-width: 62ch;
}
.feed-arrow {
  flex: none;
  font-size: 1.2rem;
  color: var(--fun-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}
.feed-row:hover .feed-arrow { transform: translateX(6px); color: var(--fun-ink); }

/* ---------- article pages ---------- */
.article-body {
  font-family: "Space Mono", monospace;
  background: #fff;
  color: var(--fun-ink);
}
.fa-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 3.4rem 1.4rem 5rem;
}
.fa-back {
  display: inline-block;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--fun-ink);
  text-decoration: none;
  margin-bottom: 2.6rem;
}
.fa-back:hover { text-decoration: underline; }

.fa-meta {
  display: flex;
  gap: 1.4rem;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--fun-muted);
  text-transform: uppercase;
}
.fa-title {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.12;
  margin: 0.7rem 0 0.5rem;
}
.fa-tags {
  font-size: 0.78rem;
  color: var(--fun-muted);
  margin-bottom: 0.4rem;
}
.fa-hero {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1.8rem 0 0.4rem;
  background: var(--fun-paper);
}
.fa-body { margin-top: 1.8rem; }
.fa-body p {
  font-family: var(--fun-sans);
  font-size: 1.02rem;
  line-height: 1.75;
  color: #2c2a24;
}
.fa-body p + p { margin-top: 1.3rem; }
.fa-missing { padding: 4rem 0; }
.fa-missing a { color: inherit; }

/* ---------- comments ---------- */
.fun-comments {
  margin-top: 4rem;
  padding-top: 2.4rem;
  border-top: 1px solid var(--fun-line);
}
.fun-comments-title {
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: 1.6rem;
  margin-bottom: 1.4rem;
}
/* the block is hidden outright until giscus is configured */
.fa-comments[hidden] { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .world-copy { left: 1.4rem; top: 2.4rem; }
  /* on a phone the blog links sit at the bottom of the world, on a
     paper chip so they stay readable over the drifting cards */
  .world-blogs {
    position: absolute;
    top: auto;
    bottom: 3.6rem;
    left: 1.4rem;
    right: 1.4rem;
    align-items: flex-start;
    text-align: left;
    max-width: none;
    background: rgba(240, 238, 230, 0.94);
    border: 1px solid var(--fun-line);
    border-radius: 6px;
    padding: 0.85rem 1.1rem 1rem;
  }
  .world-blog-title { font-size: 1.2rem; }
  .feed-section { padding: 3.5rem 1.4rem 5rem; }
  .feed-row { gap: 1.1rem; padding: 1.3rem 0; }
  .feed-title { font-size: 1.3rem; }
  .feed-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .feed-arrow { transition: none; }
}
