@font-face {
  font-family: "jf open 粉圓";
  src: url('../fonts/jf-openhuninn-2.1.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #0d1b32;
  --text: #f5f2eb;
  --muted: #c9c7c2;
  --line: #455977;
  --accent: #ffca58;
  --blue: #2261bd;
  --purple: #7258da;
  --teal: #50d3d9;
  --orange: #ff9d42;
  --coral: #f46c78;
  --max: 760px;
  --scene-height: clamp(170px, 24vh, 260px);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    "jf open 粉圓", "PingFang TC", ui-sans-serif,
    -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.75;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.site-shell {
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
}

.site-content-viewport {
  height: calc(100dvh - var(--scene-height));
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 34px 0 18px;
  border-bottom: 1px solid var(--line);
}

.site-title {
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.9rem;
}

.site-header nav a {
  text-decoration: none;
  color: var(--muted);
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"],
.site-title:hover {
  color: var(--accent);
}

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.post-body a, main > p a { color: var(--accent); }
.post-body img { max-width: 100%; height: auto; border-radius: 14px; }
.post-body pre { overflow-x: auto; padding: 20px; background: #1b2c48; border-radius: 8px; }
.post-body code { overflow-wrap: anywhere; }
.post-body blockquote { border-left-color: var(--teal); }

main {
  min-height: 72vh;
}

.intro {
  padding: 96px 0 88px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .9rem;
  letter-spacing: .04em;
}

.intro h1 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(2.8rem, 8vw, 3.4rem);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.055em;
}

.intro-copy {
  max-width: 520px;
  margin-top: 28px;
  color: var(--muted);
}

.post-list {
  border-top: 1px solid var(--line);
}

.post-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 25px 0 27px;
  border-bottom: 1px solid var(--line);
}

.post-row time {
  color: var(--muted);
  font-size: .84rem;
  padding-top: 3px;
}

.post-row .post-title {
  font-size: 1.35rem;
  line-height: 1.4;
  text-decoration: none;
}

.post-row .post-title:hover {
  text-decoration: underline;
}

.post-row p {
  color: var(--muted);
  margin: 7px 0 0;
  font-size: .92rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.tag-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.2;
  text-decoration: none;
}

.tag-link:hover {
  border-color: var(--muted);
  color: var(--text);
}

.post {
  padding: 70px 0 40px;
}

.back-link {
  color: var(--muted);
  font-size: .88rem;
  text-decoration: none;
}

.post-header {
  margin: 50px 0 48px;
}

.post-date {
  color: var(--muted);
  font-size: .86rem;
}

.post-header h1,
main > h1 {
  font-weight: 500;
  letter-spacing: -0.035em;
}

.post-header h1 {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  line-height: 1.1;
  margin: 10px 0 16px;
}

.post-description {
  color: var(--muted);
  max-width: 560px;
}

.post-body {
  font-size: 1.06rem;
}

.post-body p {
  margin: 0 0 1.6em;
}

.post-body h2 {
  margin-top: 2.6em;
}

.post-body blockquote {
  margin: 2em 0;
  padding-left: 20px;
  border-left: 2px solid var(--teal);
  color: var(--muted);
}

.post-end {
  text-align: center;
  padding: 54px 0 40px;
  color: var(--muted);
}

.subscribe-box {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 30px 0;
  margin-top: 10px;
}

.subscribe-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.subscribe-box p {
  margin-top: 0;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 38px 0 56px;
  color: var(--muted);
  font-size: .82rem;
  align-items: end;
  gap: 24px;
}

/* Independent transparent scenery; project covers remain separate assets. */
.scene-sprite {
  display: block;
  width: 100px;
  aspect-ratio: 2 / 3;
  flex: 0 0 auto;
  background-image: url('/assets/images/scenes/playground-sprites.png');
  background-size: 300% 200%;
  background-repeat: no-repeat;
  pointer-events: none;
  user-select: none;
}
.scene-robot { background-position: 0 0; }
.scene-arcade { background-position: 50% 0; }
.scene-carousel { background-position: 100% 0; }
.scene-rocket { background-position: 0 100%; }
.scene-plant { background-position: 50% 100%; }
.scene-moon { background-position: 100% 100%; }
.site-ground {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  height: var(--scene-height);
  overflow: hidden;
  isolation: isolate;
  pointer-events: none;
}
.ground-clouds {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: flex;
  width: max-content;
  transform: translateX(-50%);
}
.cloud-tile {
  display: block;
  flex: none;
  height: calc(var(--scene-height) * 1.8);
  width: auto;
}
.cloud-tile:nth-child(even) {
  transform: scaleX(-1);
}
.ground-robot {
  position: absolute;
  left: clamp(16px, 5vw, 88px);
  bottom: 16px;
  width: calc(var(--scene-height) - 28px);
  height: auto;
  object-fit: contain;
  display: block;
}
.ground-arcade {
  position: absolute;
  right: clamp(16px, 5vw, 88px);
  bottom: 12px;
  width: calc((var(--scene-height) - 24px) * 2 / 3);
}
.footer-scenery { display: flex; align-items: end; gap: 14px; margin-top: -30px; }
.footer-scenery .scene-sprite { width: 62px; }
.tags-page-header { position: relative; padding-right: 145px; min-height: 160px; }
.tags-carousel { position: absolute; right: 0; top: -12px; width: 110px; }
.projects-heading { position: relative; min-height: 160px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.projects-scenery { display: flex; align-items: end; gap: 18px; }
.projects-scenery .scene-arcade { width: 130px; }
.projects-scenery .scene-rocket { width: 85px; transform: rotate(12deg); }

@media (max-width: 600px) {
  :root { --scene-height: 180px; }
  .ground-robot { left: 8px; bottom: 12px; }
  .ground-arcade { right: 8px; bottom: 12px; }
  .projects-heading { min-height: 130px; }
  .projects-scenery { gap: 0; }
  .projects-scenery .scene-arcade { width: 72px; }
  .projects-scenery .scene-rocket { width: 48px; }
  .tags-page-header { padding-right: 95px; }
  .tags-carousel { width: 80px; top: 0; }
  .footer-scenery { gap: 5px; }
  .footer-scenery .scene-sprite { width: 48px; }
}

.archive-heading { padding: 64px 0 32px; }
.archive-heading h1 { margin: 0; font-size: 3rem; font-weight: 500; }
.archive-heading p { color: var(--muted); }
.pagination { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 32px 0; font-size: .88rem; }
.pagination-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination a, .pagination-pages span { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 6px 10px; text-decoration: none; }
.pagination-pages [aria-current="page"] { border-radius: 8px; background: var(--accent); color: var(--bg); }
.pagination a:hover { color: var(--accent); }
.pagination-disabled { color: var(--muted); opacity: .55; }

main > h1 {
  margin-top: 75px;
  font-size: 2.8rem;
}

main > p {
  max-width: 620px;
}

.tags-page {
  padding: 72px 0 40px;
}

.tags-page-header {
  margin-bottom: 42px;
}

.tags-page-header h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 7vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.tags-page-header p {
  margin: 0;
  color: var(--muted);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 62px;
}

.tag-cloud .tag-link {
  min-height: 34px;
  padding: 5px 13px 6px;
  font-size: .86rem;
}

.tag-count {
  margin-left: 7px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tag-section {
  scroll-margin-top: 24px;
  margin-bottom: 54px;
}

.tag-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tag-section-header h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 500;
}

.tag-section-header span {
  color: var(--muted);
  font-size: .82rem;
}

.tag-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag-post-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 17px 0 19px;
  border-bottom: 1px solid var(--line);
}

.tag-post-list time {
  color: var(--muted);
  font-size: .82rem;
  padding-top: 2px;
}

.tag-post-list a {
  text-decoration: none;
}

.tag-post-list a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .intro {
    padding: 70px 0 62px;
  }

  .post-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .tag-post-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .post {
    padding-top: 48px;
  }
}
