/* === Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  color: #0a0a0a;
  background: #fff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================ */
/* === d5 system: homepage, blog index, Magellan, Tachyon === */
/* ============================================================ */

.wrap { max-width: 960px; margin: 0 auto; padding: 0 44px; }

.hero {
  padding: 56px 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
}
.hero h1 {
  font-size: 3.4rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
}
.hero h1 a { color: inherit; text-decoration: none; }
.hero p {
  font-size: 0.95rem;
  color: #737373;
  max-width: 360px;
  text-align: right;
}

/* Homepage / blog-index nav (centered flex) */
.nav-d5 { display: flex; justify-content: center; gap: 36px; padding: 8px 0 36px; }
.nav-d5 > a {
  position: relative;
  padding: 6px 2px;
  font-size: 0.86rem;
  font-weight: 500;
  color: #737373;
  text-decoration: none;
  transition: color 0.15s;
}
.nav-d5 > a:hover,
.nav-d5 > a.active { color: #0a0a0a; }
.nav-d5 > a.active::after {
  content: ""; position: absolute; left: 2px; right: 2px; bottom: 0;
  height: 2px; background: #0a0a0a; border-radius: 2px;
}

/* Project-page nav (has back link + links wrapper) */
.nav-d5:has(.back) {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.nav-d5 .back {
  justify-self: start;
  font-size: 0.82rem;
  font-weight: 500;
  color: #a3a3a3;
  text-decoration: none;
  transition: color 0.15s;
  padding: 6px 2px;
}
.nav-d5 .back:hover { color: #0a0a0a; }
.nav-d5 .links { display: flex; gap: 36px; }
.nav-d5 .links a {
  position: relative;
  padding: 6px 2px;
  font-size: 0.86rem;
  font-weight: 500;
  color: #737373;
  text-decoration: none;
  transition: color 0.15s;
}
.nav-d5 .links a:hover,
.nav-d5 .links a.active { color: #0a0a0a; }
.nav-d5 .links a.active::after {
  content: ""; position: absolute; left: 2px; right: 2px; bottom: 0;
  height: 2px; background: #0a0a0a; border-radius: 2px;
}

/* Homepage gallery (vertical cards) */
.gallery { padding: 0 0 120px; display: flex; flex-direction: column; gap: 40px; }
.card {
  border: 1px solid #e5e5e5;
  border-radius: 20px;
  overflow: hidden;
  transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card:hover { border-color: #d4d4d4; box-shadow: 0 20px 64px rgba(0,0,0,0.1); transform: translateY(-3px); }
.media { width: 100%; overflow: hidden; background: #f5f5f5; }
.media img, .media video {
  width: 100%; height: auto; display: block;
  transition: transform 0.5s cubic-bezier(0.16,1,0.3,1);
}
.media .placeholder { aspect-ratio: 16/9; }
.media.cropped { aspect-ratio: 1.243; overflow: hidden; }
.media.cropped video, .media.cropped img { width: 100%; height: 100%; object-fit: cover; }
.media.tachyon-crop { aspect-ratio: 1728 / 1511; overflow: hidden; background: #000; }
.media.tachyon-crop video { width: 100%; height: auto; transform: translateY(-30%); }
.card:hover img, .card:hover video { transform: scale(1.03); }
.card:hover .media.tachyon-crop video { transform: translateY(-30%); }
.card .body { padding: 28px 32px 32px; }
.card .body h3 { font-size: 1.22rem; font-weight: 600; margin-bottom: 6px; }
.card .body .tagline { font-size: 0.92rem; color: #737373; }

/* Project page header */
.project-header { padding: 8px 0 28px; text-align: center; }
.project-header h2 { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.03em; }

/* Project demo media */
.demo { padding: 0 0 32px; }
.demo-frame {
  width: 100%; max-width: 720px; margin: 0 auto;
  overflow: hidden; border-radius: 20px;
  background: #f5f5f5; border: 1px solid #e5e5e5;
}
.demo-frame video, .demo-frame img { width: 100%; height: auto; display: block; }
.demo-frame.tachyon-crop { aspect-ratio: 1728 / 1511; background: #000; }
.demo-frame.tachyon-crop video { transform: translateY(-30%); }

/* Download CTA */
.download { padding: 0 0 56px; display: flex; justify-content: center; }
.download .btn {
  display: inline-block;
  padding: 13px 28px;
  background: #0a0a0a;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  transition: background 0.2s, transform 0.2s;
}
.download .btn:hover { background: #2a2a2a; transform: translateY(-1px); }

/* Project description */
.description { padding: 0 0 56px; max-width: 680px; margin: 0 auto; }
.description p { font-size: 1rem; color: #2a2a2a; line-height: 1.7; margin-bottom: 16px; }
.description p:last-child { margin-bottom: 0; }
.description code {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.9em;
  background: #f5f5f5;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Project format-pair screenshots */
.shots { padding: 0 0 120px; display: flex; flex-direction: column; gap: 18px; }
.format-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.format-pair figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  background: #f5f5f5;
  cursor: zoom-in;
  transition: transform 0.2s, box-shadow 0.2s;
}
.format-pair figure.dark { border-color: #1f1f1f; background: #0a0a0a; }
.format-pair figure:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0,0,0,0.08); }
.format-pair img { width: 100%; height: auto; display: block; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: fixed; top: 22px; right: 26px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }

/* Blog-index "coming soon" */
.coming { padding: 80px 0 200px; text-align: center; }
.coming p { font-size: 1.05rem; color: #737373; }

/* ============================================================ */
/* === Older system: placeholder project pages + blog posts === */
/* ============================================================ */

.nav {
  padding: 24px 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-left a { font-size: 0.88rem; font-weight: 600; color: #0a0a0a; text-decoration: none; }
.nav-right { display: flex; gap: 28px; }
.nav-right a {
  font-size: 0.82rem;
  font-weight: 500;
  color: #737373;
  text-decoration: none;
  transition: color 0.15s;
}
.nav-right a:hover,
.nav-right a.active { color: #0a0a0a; }

.project-hero { padding: 0 64px 48px; max-width: 900px; margin: 0 auto; }
.project-hero .back {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #a3a3a3;
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.project-hero .back:hover { color: #0a0a0a; }
.project-hero h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.project-hero .tagline { font-size: 1.05rem; color: #737373; margin-bottom: 20px; }
.project-hero .links { display: flex; gap: 10px; }
.project-hero .links a {
  font-size: 0.8rem;
  font-weight: 600;
  color: #0a0a0a;
  text-decoration: none;
  padding: 8px 20px;
  border: 1px solid #e5e5e5;
  border-radius: 100px;
  transition: all 0.2s;
}
.project-hero .links a:hover { background: #0a0a0a; color: #fff; border-color: #0a0a0a; }

.project-media { padding: 0 64px 40px; max-width: 900px; margin: 0 auto; }
.project-media .media-frame {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: 16px;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
}
.project-media .media-frame img,
.project-media .media-frame video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.project-body { padding: 0 64px 80px; max-width: 900px; margin: 0 auto; }
.project-body h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; margin-top: 32px; }
.project-body h2:first-child { margin-top: 0; }
.project-body p { font-size: 0.9rem; color: #525252; line-height: 1.7; margin-bottom: 14px; }
.project-body ul { padding-left: 20px; margin-bottom: 14px; }
.project-body li { font-size: 0.9rem; color: #525252; line-height: 1.7; margin-bottom: 4px; }

.project-gallery { padding: 0 64px 80px; max-width: 900px; margin: 0 auto; }
.project-gallery h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; }
.project-gallery .grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.project-gallery .grid .frame {
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: 12px;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
}
.project-gallery .grid .frame img,
.project-gallery .grid .frame video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.blog-header { padding: 36px 64px 32px; max-width: 780px; margin: 0 auto; }
.blog-header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.03em; }

.blog-list { padding: 0 64px 80px; max-width: 780px; margin: 0 auto; }
.blog-item {
  display: block;
  padding: 20px 0;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.blog-item:first-child { border-top: 1px solid #f0f0f0; }
.blog-item:hover { background: #fafafa; margin: 0 -16px; padding: 20px 16px; border-radius: 8px; border-color: transparent; }
.blog-item h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.blog-item .meta { font-size: 0.78rem; color: #a3a3a3; margin-bottom: 6px; }
.blog-item p { font-size: 0.84rem; color: #737373; line-height: 1.5; }

.post-header { padding: 36px 64px 32px; max-width: 780px; margin: 0 auto; }
.post-header .back {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #a3a3a3;
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.post-header .back:hover { color: #0a0a0a; }
.post-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.post-header .meta { font-size: 0.82rem; color: #a3a3a3; }

.post-body { padding: 24px 64px 80px; max-width: 780px; margin: 0 auto; }
.post-body p { font-size: 0.95rem; color: #333; line-height: 1.8; margin-bottom: 18px; }
.post-body h2 { font-size: 1.2rem; font-weight: 600; margin-top: 36px; margin-bottom: 14px; }
.post-body ul, .post-body ol { padding-left: 20px; margin-bottom: 18px; }
.post-body li { font-size: 0.95rem; color: #333; line-height: 1.8; margin-bottom: 6px; }
.post-body a {
  color: #0a0a0a;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #d4d4d4;
  transition: text-decoration-color 0.15s;
}
.post-body a:hover { text-decoration-color: #0a0a0a; }
.post-body strong { font-weight: 600; }
.post-body .tool-item { padding: 16px 0; border-bottom: 1px solid #f0f0f0; }
.post-body .tool-item:last-child { border-bottom: none; }
.post-body .tool-item h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.post-body .tool-item p { font-size: 0.88rem; margin-bottom: 0; }

/* === Placeholder colors === */
.placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 500; color: #b0b8c4; letter-spacing: -0.01em;
}
.ph1 { background: #faf7f0; }
.ph2 { background: #f0faf3; }
.ph3 { background: #f0f3fa; }
.ph4 { background: #faf0f7; }
.phm { background: #eef2f7; }

/* ============================================================ */
/* === Mobile (≤720px) — matches cc/mobile-mockup.html === */
/* ============================================================ */

@media (max-width: 720px) {
  /* --- d5 system --- */
  .wrap { padding: 0 20px; }

  .hero {
    padding: 28px 0 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .hero h1 { font-size: 2.1rem; letter-spacing: -0.035em; line-height: 1.05; }
  .hero p { font-size: 0.95rem; max-width: none; text-align: left; line-height: 1.5; }

  .nav-d5 {
    padding: 18px 0 24px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 24px;
    gap: 28px;
  }
  .nav-d5 > a { padding: 12px 4px; font-size: 0.95rem; }
  .nav-d5 > a.active::after { left: 4px; right: 4px; bottom: 6px; }

  /* Project nav collapses: show back only, hide tab links */
  .nav-d5:has(.back) {
    display: block;
    padding: 6px 0 8px;
    border-bottom: none;
    margin-bottom: 0;
  }
  .nav-d5 .back {
    display: inline-block;
    padding: 10px 0;
    font-size: 0.92rem;
    margin-top: 6px;
  }
  .nav-d5 .links { display: none; }

  /* Cards */
  .gallery { padding-bottom: 60px; gap: 22px; }
  .card { border-radius: 18px; }
  .card .body { padding: 18px 20px 22px; }
  .card .body h3 { font-size: 1.1rem; }
  .card .body .tagline { font-size: 0.92rem; line-height: 1.45; }

  /* Project header */
  .project-header { padding: 12px 0 22px; }
  .project-header h2 { font-size: 1.85rem; letter-spacing: -0.025em; }

  /* Demo */
  .demo { padding-bottom: 22px; }
  .demo-frame { border-radius: 16px; }

  /* Download */
  .download { padding-bottom: 36px; }
  .download .btn { padding: 15px 26px; font-size: 1rem; min-height: 48px; }

  /* Description */
  .description { padding-bottom: 36px; }

  /* Screenshot pairs stack */
  .shots { padding-bottom: 80px; gap: 14px; }
  .format-pair { grid-template-columns: 1fr; gap: 14px; }

  /* Lightbox: tighter padding so screenshot is bigger */
  .lightbox { padding: 12px; }

  /* --- Older system --- */
  .nav { padding: 18px 20px; }
  .nav-left a { font-size: 0.92rem; }
  .nav-right { gap: 22px; }
  .nav-right a { font-size: 0.9rem; padding: 8px 0; }

  .project-hero { padding: 24px 20px 32px; }
  .project-hero .back { padding: 10px 0; font-size: 0.9rem; margin-bottom: 16px; }
  .project-hero h1 { font-size: 1.85rem; }
  .project-hero .tagline { font-size: 1rem; }
  .project-hero .links a { padding: 10px 22px; font-size: 0.88rem; }

  .project-media { padding: 0 20px 32px; }

  .project-body { padding: 0 20px 60px; }
  .project-body p, .project-body li { font-size: 0.98rem; }

  .project-gallery { padding: 0 20px 60px; }
  .project-gallery .grid { grid-template-columns: 1fr; gap: 12px; }

  .blog-header { padding: 24px 20px 20px; }
  .blog-header h1 { font-size: 1.6rem; }

  .blog-list { padding: 0 20px 60px; }
  .blog-item { padding: 18px 0; }
  .blog-item:hover { margin: 0; padding: 18px 0; border-radius: 0; }
  .blog-item h3 { font-size: 1.05rem; }
  .blog-item p { font-size: 0.92rem; }

  .post-header { padding: 24px 20px 16px; }
  .post-header .back { padding: 10px 0; font-size: 0.92rem; margin-bottom: 16px; }
  .post-header h1 { font-size: 1.65rem; }

  .post-body { padding: 8px 20px 60px; }
  .post-body p, .post-body li { font-size: 1rem; line-height: 1.75; }
  .post-body h2 { font-size: 1.15rem; }
  .post-body .tool-item p { font-size: 0.95rem; }

  .coming { padding: 60px 0 120px; }
}
