/* Shared styles for all J.C.P Laboratory pages. */

html { scroll-behavior: smooth; }

@scope (body.page-home) {
  :scope {
      --bg: #1a181b;
      --surface: rgba(33, 31, 34, 0.6);
      --text: #f7f7f2;
      --muted: #77878b;
      --accent: #339999;
      --accent-deep: #305252;
      --border: rgba(119, 135, 139, 0.12);
      --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
      --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    }

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

    :scope {
      background: var(--bg);
      color: var(--muted);
      font-family: var(--font-sans);
      font-size: 16px;
      line-height: 1.7;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      overflow-x: hidden;
      position: relative;
    }

    /* Subtle grain texture */
    :scope::before {
      content: '';
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      opacity: 0.03;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
      background-repeat: repeat;
      background-size: 256px 256px;
    }

    h1, h2, h3 { color: var(--text); font-weight: 600; letter-spacing: -0.02em; }
    h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); line-height: 1.1; }
    h1.gradient {
      background: linear-gradient(135deg, var(--text) 0%, var(--accent) 50%, var(--text) 100%);
      background-size: 200% auto;
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      animation: shimmer 8s ease-in-out infinite;
    }
    @keyframes shimmer {
      0%, 100% { background-position: 0% center; }
      50% { background-position: 200% center; }
    }
    h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 0.5em; }
    h3 { font-size: 1.15rem; margin-bottom: 0.35em; }

    a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
    a:hover { color: var(--text); }

    .container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 1; }
    section { padding: 6rem 0; position: relative; }

    .section-label {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--accent);
      text-transform: lowercase;
      letter-spacing: 0.08em;
      margin-bottom: 1.5rem;
      display: block;
    }
    .section-label::before { content: '<'; }
    .section-label::after { content: '>'; }

    .divider {
      border: none;
      height: 1px;
      background: linear-gradient(to right, transparent, var(--border), transparent);
      margin: 0;
    }

    /* ── Background orbs ────────────────── */
    .bg-orb {
      position: absolute;
      border-radius: 50%;
      filter: blur(120px);
      pointer-events: none;
      z-index: 0;
    }

    /* ── Nav ───────────────────────────── */
    nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: rgba(26, 24, 27, 0.8);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
    }
    nav .container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 3.5rem;
    }
    .nav-logo {
      font-family: var(--font-sans);
      font-weight: 700;
      font-size: 0.95rem;
      color: var(--text);
      letter-spacing: 0.02em;
      display: flex;
      align-items: baseline;
      gap: 0.15em;
    }
    .nav-logo .tld { color: var(--accent); font-weight: 700; }
    .nav-logo .dot { color: var(--text); }

    .nav-links { display: flex; gap: 2rem; list-style: none; }
    .nav-links a { color: var(--muted); font-size: 0.9rem; }
    .nav-links a:hover { color: var(--text); }

    /* Hamburger */
    .hamburger {
      display: none;
      flex-direction: column;
      gap: 5px;
      background: none;
      border: none;
      cursor: pointer;
      padding: 4px;
      z-index: 101;
    }
    .hamburger span {
      display: block;
      width: 22px;
      height: 2px;
      background: var(--text);
      border-radius: 1px;
      transition: transform 0.25s, opacity 0.25s;
    }
    .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .hamburger.open span:nth-child(2) { opacity: 0; }
    .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .mobile-menu {
      display: none;
      position: fixed;
      inset: 0;
      background: var(--bg);
      z-index: 99;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2rem;
      list-style: none;
      font-size: 1.3rem;
    }
    .mobile-menu a { color: var(--text); }
    .mobile-menu a:hover { color: var(--accent); }
    .mobile-menu.open { display: flex; }

    /* ── Hero ──────────────────────────── */
    .hero {
      padding: 8rem 0 6rem;
      min-height: 85vh;
      display: flex;
      align-items: center;
      position: relative;
      overflow: hidden;
    }
    .hero-orb {
      position: absolute;
      top: 20%;
      right: -15%;
      width: 600px;
      height: 600px;
      background: radial-gradient(circle, rgba(51,153,153,0.06) 0%, transparent 70%);
      pointer-events: none;
      z-index: 0;
    }
    #particles {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 0;
    }
    .hero .container { position: relative; z-index: 1; }
    .hero h1 { margin-bottom: 0.3em; }
    .hero .tagline {
      font-size: 1.2rem;
      color: var(--muted);
      max-width: 560px;
      margin-bottom: 1.5rem;
      line-height: 1.6;
    }
    .hero-icon-wrap {
      position: relative;
      display: inline-block;
      margin-bottom: 2rem;
    }
    .hero-icon-wrap img {
      width: 88px;
      height: auto;
      display: block;
      position: relative;
      z-index: 1;
    }
    .hero-glow {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 180px;
      height: 180px;
      background: radial-gradient(circle, rgba(51,153,153,0.15) 0%, transparent 70%);
      pointer-events: none;
    }
    .cursor {
      display: inline-block;
      width: 2px;
      height: 1.05em;
      background: var(--accent);
      margin-left: 3px;
      vertical-align: text-bottom;
      animation: blink 1s step-end infinite;
    }
    @keyframes blink { 50% { opacity: 0; } }

    .hero-sub {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--muted);
      opacity: 0.6;
    }

    /* ── Scroll indicator ──────────────── */
    .scroll-hint {
      position: absolute;
      bottom: 2rem;
      left: 50%;
      transform: translateX(-50%);
      z-index: 1;
      opacity: 0.4;
    }
    .scroll-hint span {
      display: block;
      width: 1px;
      height: 28px;
      background: var(--accent);
      margin: 0 auto;
      animation: pulse-down 2s ease-in-out infinite;
    }
    @keyframes pulse-down {
      0%, 100% { opacity: 0; transform: translateY(-8px); }
      50% { opacity: 1; transform: translateY(4px); }
    }

    /* ── Reveal animations ─────────────── */
    .reveal {
      opacity: 0;
      transform: translateY(30px);
      transition: opacity 0.7s ease-out, transform 0.7s ease-out;
    }
    .reveal.visible { opacity: 1; transform: translateY(0); }
    .reveal-stagger > * { opacity: 0; transform: translateY(24px); transition: opacity 0.5s ease-out, transform 0.5s ease-out; }
    .reveal-stagger > *.visible { opacity: 1; transform: translateY(0); }

    /* ── Glass card ────────────────────── */
    .glass-card {
      background: var(--surface);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 2.25rem;
      position: relative;
      transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.4s ease;
      overflow: hidden;
    }
    .glass-card::before {
      content: '';
      position: absolute;
      inset: -2px;
      border-radius: 15px;
      background: linear-gradient(135deg, transparent 30%, rgba(51,153,153,0) 50%, transparent 70%);
      z-index: -1;
      transition: background 0.5s ease;
    }
    .glass-card:hover::before {
      background: linear-gradient(135deg, rgba(51,153,153,0.5), rgba(48,82,82,0.3), rgba(51,153,153,0.5));
      animation: border-sweep 2s linear infinite;
    }
    @keyframes border-sweep {
      0% { background-position: 0% 0%; }
      100% { background-position: 200% 200%; }
    }
    .glass-card:hover {
      border-color: rgba(51, 153, 153, 0.5);
      transform: translateY(-6px) scale(1.02);
      box-shadow: 0 0 40px rgba(51, 153, 153, 0.1), 0 12px 40px rgba(0,0,0,0.3);
    }
    .glass-card h3 { color: var(--text); }
    .glass-card p { margin-bottom: 1rem; }

    /* Card entrance pop */
    .glass-card.pop-in {
      animation: card-pop 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
      opacity: 0;
      transform: scale(0.9);
    }
    @keyframes card-pop {
      0% { opacity: 0; transform: scale(0.9); }
      100% { opacity: 1; transform: scale(1); }
    }
    .tilt-active {
      transform-style: preserve-3d;
      perspective: 1000px;
    }

    /* Logo glow pulse */
    @keyframes logo-pulse {
      0% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.9); }
      50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
      100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    }
    .hero-glow.pulse {
      animation: logo-pulse 2.5s ease-out forwards;
    }

    /* Page transition */
    .page-transition {
      position: fixed;
      inset: 0;
      z-index: 9999;
      background: var(--bg);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }
    .page-transition.active { opacity: 1; }

    /* Active nav */
    .nav-links a.active { color: var(--accent); }

    .project-grid { display: grid; grid-template-columns: 1fr; gap: 1.75rem; }
    @media (min-width: 768px) { .project-grid { grid-template-columns: 1fr 1fr; } }

    /* Make cards flex columns so CTAs align at bottom */
    .project-grid .glass-card { display: flex; flex-direction: column; }
    .project-grid .glass-card .project-cta { margin-top: auto; padding-top: 0.75rem; }
    .project-grid .glass-card > .project-link:last-of-type { margin-top: auto; padding-top: 0.75rem; }

    /* Project card icons */
    .project-grid img { width: 32px; height: 32px; border-radius: 8px; vertical-align: middle; margin-right: 0.5em; }
    .project-grid h3 { display: inline; }
    .project-grid i[data-lucide] { width: 28px; height: 28px; color: var(--accent); vertical-align: middle; margin-right: 0.4em; }

    /* External link icon */
    .project-link i[data-lucide],
    .project-link svg { width: 10px !important; height: 10px !important; vertical-align: -1px; opacity: 0.5; }

    /* Hero elements */
    .hero-sub i[data-lucide] { width: 12px; height: 12px; vertical-align: -1px; }
    .hero-cta-wrap { margin-top: 1.5rem; }

    /* Scroll hint */
    .scroll-hint svg { width: 16px; height: 16px; opacity: 0.6; animation: pulse-down 2s ease-in-out infinite; color: var(--muted); }

    /* Belief icons */
    .belief-item .icon i[data-lucide] { width: 28px; height: 28px; }

    .badge {
      display: inline-block;
      font-family: var(--font-mono);
      font-size: 0.7rem;
      padding: 0.2em 0.7em;
      border-radius: 4px;
      letter-spacing: 0.05em;
      margin-right: 0.4em;
    }
    .badge-live  { background: rgba(51, 153, 153, 0.15); color: var(--accent); }
    .badge-wip   { background: rgba(119, 135, 139, 0.12); color: var(--muted); }
    .badge-oss   { background: rgba(247, 247, 242, 0.06); color: var(--text); border: 1px solid rgba(247, 247, 242, 0.1); }

    .project-link {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--accent);
      display: inline-flex;
      align-items: center;
      gap: 0.4em;
    }
    .project-link:hover { color: var(--text); }

    .project-featured {
      position: relative;
      border-color: rgba(51, 153, 153, 0.25);
    }
    .project-featured::before {
      content: '';
      position: absolute;
      inset: -1px;
      border-radius: 13px;
      background: linear-gradient(135deg, rgba(51,153,153,0.15), transparent 60%);
      pointer-events: none;
      z-index: -1;
    }

    /* ── About ─────────────────────────── */
    .about p { max-width: 600px; }
    .about p + p { margin-top: 1.2em; }

    /* ── Research ──────────────────────── */
    .research-spotlight {
      background: var(--surface);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 2rem;
    }
    .research-spotlight h3 { margin-bottom: 0.4em; }
    .research-spotlight .meta {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--accent-deep);
      margin-bottom: 1em;
    }

    /* ── Writing ───────────────────────── */
    .post-list { display: flex; flex-direction: column; gap: 1.5rem; }
    .post-item { padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
    .post-item:last-child { border-bottom: none; padding-bottom: 0; }
    .post-date {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--accent-deep);
      margin-bottom: 0.2em;
    }
    .post-title { color: var(--text); font-size: 1.05rem; font-weight: 500; }
    .post-title:hover { color: var(--accent); }
    .post-excerpt { font-size: 0.9rem; margin-top: 0.3em; }

    /* ── Contact ───────────────────────── */
    .contact-lines p { margin-bottom: 0.4em; }
    .contact-lines .mono { color: var(--accent); }

    /* ── Pancake link ──────────────────── */
    .pancake-ref {
      font-size: 0.85rem;
      padding-top: 1rem;
      border-top: 1px solid var(--border);
      margin-top: 2rem;
    }
    .pancake-ref .arrow { color: var(--accent); }

    /* ── Beliefs ────────────────────────── */
    .belief-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 2rem;
    }
    .belief-item { text-align: center; }
    .belief-item .icon {
      font-size: 1.8rem;
      margin-bottom: 0.75rem;
    }
    .belief-item h3 { font-size: 1rem; margin-bottom: 0.4em; }
    .belief-item p { font-size: 0.88rem; }

    /* ── Footer ────────────────────────── */
    footer {
      padding: 3rem 0;
      font-size: 0.85rem;
      color: var(--muted);
      opacity: 0.7;
    }
    footer .container {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }
    footer a { color: var(--muted); }
    footer a:hover { color: var(--text); }

    footer i[data-lucide],
    footer svg { width: 11px !important; height: 11px !important; vertical-align: -1px; }

    /* ── Responsive ────────────────────── */
    @media (max-width: 600px) {
      section { padding: 3.5rem 0; }
      .hero { padding: 5rem 0 3rem; min-height: auto; }
      .glass-card, .research-spotlight { padding: 1.5rem; }
      .nav-links { display: none; }
      .hamburger { display: flex; }
      .scroll-hint { display: none; }
      .hero-orb { width: 300px; height: 300px; right: -30%; }
    }}

@scope (body.page-project-astra) {
  :scope {
      --bg: #1a181b;
      --surface: rgba(33, 31, 34, 0.6);
      --text: #f7f7f2;
      --muted: #77878b;
      --accent: #339999;
      --accent-deep: #305252;
      --border: rgba(119, 135, 139, 0.12);
      --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
      --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    }

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

    :scope {
      background: var(--bg);
      color: var(--muted);
      font-family: var(--font-sans);
      font-size: 16px;
      line-height: 1.75;
      -webkit-font-smoothing: antialiased;
    }

    h1, h2, h3 { color: var(--text); font-weight: 600; letter-spacing: -0.02em; }
    h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; }
    h2 { font-size: clamp(1.3rem, 2.8vw, 1.9rem); margin-bottom: 0.6em; }
    h3 { font-size: 1.1rem; margin-bottom: 0.4em; }

    a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
    a:hover { color: var(--text); }

    .container { max-width: 780px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 1; }
    section { padding: 5rem 0; position: relative; }

    .section-label {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--accent);
      text-transform: lowercase;
      letter-spacing: 0.08em;
      margin-bottom: 1.5rem;
      display: block;
    }
    .section-label::before { content: '<'; }
    .section-label::after { content: '>'; }

    .divider {
      border: none;
      height: 1px;
      background: linear-gradient(to right, transparent, var(--border), transparent);
      margin: 0;
    }

    /* ── Nav ───────────────────────────── */
    nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: rgba(26, 24, 27, 0.8);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
    }
    nav .container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 3.5rem;
    }
    .nav-logo {
      font-family: var(--font-sans);
      font-weight: 700;
      font-size: 0.95rem;
      color: var(--text);
      letter-spacing: 0.02em;
      display: flex;
      align-items: baseline;
      gap: 0.15em;
    }
    .nav-logo .tld { color: var(--accent); }
    .nav-links { display: flex; gap: 2rem; list-style: none; }
    .nav-links a { color: var(--muted); font-size: 0.9rem; }
    .nav-links a:hover { color: var(--text); }
    .back-link { font-family: var(--font-mono); font-size: 0.8rem; }

    /* ── Hero ──────────────────────────── */
    .page-hero {
      padding: 6rem 0 4rem;
      position: relative;
    }
    .page-hero h1 { margin-bottom: 0.3em; }
    .page-hero .subtitle {
      font-size: 1.15rem;
      color: var(--muted);
      max-width: 600px;
      margin-bottom: 1.5rem;
    }
    .badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
    .badge {
      display: inline-block;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      padding: 0.25em 0.8em;
      border-radius: 4px;
      letter-spacing: 0.05em;
    }
    .badge-oss { background: rgba(247, 247, 242, 0.06); color: var(--text); border: 1px solid rgba(247, 247, 242, 0.12); }
    .badge-live { background: rgba(51, 153, 153, 0.12); color: var(--accent); }
    .badge-python { background: rgba(119, 135, 139, 0.12); color: var(--muted); }

    /* ── Glass card ────────────────────── */
    .glass-card {
      background: var(--surface);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 2rem;
      transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
    }
    .glass-card:hover {
      border-color: rgba(51, 153, 153, 0.25);
      transform: translateY(-2px);
      box-shadow: 0 8px 32px rgba(51, 153, 153, 0.05);
    }

    /* ── Architecture diagram ──────────── */
    .arch-block {
      background: rgba(26, 24, 27, 0.5);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 2rem;
    }
    .arch-layer {
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 1.25rem;
      margin-bottom: 1rem;
      text-align: center;
    }
    .arch-layer-label {
      font-family: var(--font-mono);
      font-size: 0.7rem;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin-bottom: 0.75rem;
    }
    .arch-row {
      display: flex;
      gap: 0.75rem;
      justify-content: center;
      flex-wrap: wrap;
    }
    .arch-box {
      background: rgba(26, 24, 27, 0.7);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 0.6em 1em;
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--text);
      white-space: nowrap;
    }
    .arch-box.hl { border-color: rgba(51, 153, 153, 0.3); color: var(--accent); }
    .arch-arrow {
      color: var(--accent);
      font-size: 1.2rem;
      text-align: center;
      margin: 0.5rem 0;
      opacity: 0.5;
    }
    .arch-row-sm {
      display: flex;
      gap: 0.75rem;
      justify-content: center;
      flex-wrap: wrap;
      margin-top: 0.75rem;
    }
    .arch-box-sm {
      background: rgba(26, 24, 27, 0.7);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 0.5em 0.8em;
      font-family: var(--font-mono);
      font-size: 0.7rem;
      color: var(--muted);
    }

    /* ── Feature grid ──────────────────── */
    .feature-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 1.5rem;
    }
    .feature-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 1.75rem;
    }
    .feature-card h3 { font-size: 1rem; margin-bottom: 0.5em; }
    .feature-card p { font-size: 0.9rem; }
    .feature-icon { font-size: 1.2rem; margin-bottom: 0.5rem; }

    /* ── Flow steps ────────────────────── */
    .flow {
      display: flex;
      flex-direction: column;
      gap: 0;
      counter-reset: step;
    }
    .flow-step {
      display: flex;
      gap: 1.25rem;
      align-items: flex-start;
      padding: 1rem 0;
      border-bottom: 1px solid var(--border);
    }
    .flow-step:last-child { border-bottom: none; }
    .flow-num {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      border: 1px solid var(--accent);
      color: var(--accent);
      font-family: var(--font-mono);
      font-size: 0.75rem;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 2px;
    }
    .flow-body h4 { color: var(--text); font-size: 0.95rem; margin-bottom: 0.2em; }
    .flow-body p { font-size: 0.88rem; }

    /* ── Pipeline diagram ──────────────── */
    .pipeline {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      align-items: center;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      margin: 1.25rem 0;
    }
    .pipeline .step {
      background: rgba(26, 24, 27, 0.7);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 0.4em 0.8em;
      color: var(--text);
      white-space: nowrap;
    }
    .pipeline .step.hl { border-color: rgba(51, 153, 153, 0.3); color: var(--accent); }
    .pipeline .arr { color: var(--accent); opacity: 0.4; font-size: 0.8rem; }
    .table-wrap {
      overflow-x: auto;
      margin: 1.5rem 0;
    }
    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.85rem;
    }
    th, td {
      padding: 0.7em 1em;
      text-align: left;
      border-bottom: 1px solid var(--border);
    }
    th {
      color: var(--text);
      font-weight: 600;
      font-size: 0.8rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    td:first-child { color: var(--text); }
    td.high { color: var(--accent); }

    /* ── Code block ────────────────────── */
    pre {
      background: rgba(26, 24, 27, 0.6);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 1.25rem;
      overflow-x: auto;
      font-family: var(--font-mono);
      font-size: 0.82rem;
      line-height: 1.6;
      color: var(--text);
    }
    pre .c { color: var(--muted); }
    pre .k { color: var(--accent); }

    /* ── Footer ────────────────────────── */
    footer {
      padding: 3rem 0;
      font-size: 0.85rem;
      color: var(--muted);
      opacity: 0.7;
    }
    footer .container {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }
    footer a { color: var(--muted); }
    footer a:hover { color: var(--text); }

    .hero-portrait { width: 72px; height: 72px; border-radius: 14px; margin-bottom: 1.5rem; display: block; background: #f7f7f2; padding: 3px; }
    .feature-icon-svg { width: 20px !important; height: 20px !important; }
    .cta-spacer { margin-top: 1.5rem; }
    footer i[data-lucide],
    footer svg { width: 11px !important; height: 11px !important; vertical-align: -1px; }

    /* ── Reveal ────────────────────────── */
    .reveal {
      opacity: 0;
      transform: translateY(24px);
      transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    }
    .reveal.visible { opacity: 1; transform: translateY(0); }

    @media (max-width: 600px) {
      section { padding: 3rem 0; }
      .page-hero { padding: 4rem 0 2rem; }
      .feature-grid { grid-template-columns: 1fr; }
      .nav-links { display: none; }
      .arch-block { padding: 1.25rem; }
    }}

@scope (body.page-project-issl) {
  :scope {
      --bg: #1a181b;
      --surface: rgba(33, 31, 34, 0.6);
      --text: #f7f7f2;
      --muted: #77878b;
      --accent: #339999;
      --accent-deep: #305252;
      --border: rgba(119, 135, 139, 0.12);
      --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
      --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    }

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

    :scope {
      background: var(--bg);
      color: var(--muted);
      font-family: var(--font-sans);
      font-size: 16px;
      line-height: 1.75;
      -webkit-font-smoothing: antialiased;
    }

    h1, h2, h3 { color: var(--text); font-weight: 600; letter-spacing: -0.02em; }
    h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; }
    h2 { font-size: clamp(1.3rem, 2.8vw, 1.9rem); margin-bottom: 0.6em; }
    h3 { font-size: 1.1rem; margin-bottom: 0.4em; }

    a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
    a:hover { color: var(--text); }

    .container { max-width: 780px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 1; }
    section { padding: 5rem 0; position: relative; }

    .section-label {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--accent);
      text-transform: lowercase;
      letter-spacing: 0.08em;
      margin-bottom: 1.5rem;
      display: block;
    }
    .section-label::before { content: '<'; }
    .section-label::after { content: '>'; }

    .divider {
      border: none; height: 1px;
      background: linear-gradient(to right, transparent, var(--border), transparent);
      margin: 0;
    }

    /* ── Nav ───────────────────────────── */
    nav {
      position: sticky; top: 0; z-index: 100;
      background: rgba(26, 24, 27, 0.8);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
    }
    nav .container { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; }
    .nav-logo { font-weight: 700; font-size: 0.95rem; color: var(--text); letter-spacing: 0.02em; }
    .nav-logo .tld { color: var(--accent); }
    .nav-links { display: flex; gap: 2rem; list-style: none; }
    .nav-links a { color: var(--muted); font-size: 0.9rem; }
    .nav-links a:hover { color: var(--text); }
    .back-link { font-family: var(--font-mono); font-size: 0.8rem; }

    /* ── Hero ──────────────────────────── */
    .page-hero { padding: 6rem 0 4rem; }
    .page-hero h1 { margin-bottom: 0.3em; }
    .hero-icon { margin-bottom: 1.5rem; }
    .hero-icon img { width: 48px; height: 48px; }
    .page-hero .subtitle { font-size: 1.15rem; color: var(--muted); max-width: 600px; margin-bottom: 1.5rem; }
    .badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
    .badge {
      display: inline-block;
      font-family: var(--font-mono); font-size: 0.72rem;
      padding: 0.25em 0.8em; border-radius: 4px; letter-spacing: 0.05em;
    }
    .badge-wip { background: rgba(119, 135, 139, 0.12); color: var(--muted); }
    .badge-rust { background: rgba(51, 153, 153, 0.12); color: var(--accent); }

    /* ── Timeline ──────────────────────── */
    .timeline { position: relative; padding-left: 2rem; }
    .timeline::before {
      content: ''; position: absolute; left: 0; top: 0.4em; bottom: 0;
      width: 1px; background: var(--border);
    }
    .timeline-item { position: relative; margin-bottom: 2.5rem; }
    .timeline-item:last-child { margin-bottom: 0; }
    .timeline-item::before {
      content: ''; position: absolute; left: -2rem; top: 0.5em;
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--accent);
    }
    .timeline-year {
      font-family: var(--font-mono); font-size: 0.75rem;
      color: var(--accent); margin-bottom: 0.25rem;
    }
    .timeline-item h3 { font-size: 1rem; margin-bottom: 0.2em; }
    .timeline-item p { font-size: 0.95rem; }

    /* ── Code block ────────────────────── */
    pre {
      background: rgba(26, 24, 27, 0.6);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 1.25rem 1.5rem;
      overflow-x: auto;
      font-family: var(--font-mono);
      font-size: 0.85rem;
      line-height: 1.6;
      color: var(--muted);
      margin: 1.5rem 0;
    }
    pre .kw { color: var(--accent); }
    pre .str { color: #c4a87c; }
    pre .cmt { color: #5a6a6d; }

    /* ── Grid ──────────────────────────── */
    .feature-grid {
      display: grid; grid-template-columns: 1fr; gap: 1.25rem;
    }
    @media (min-width: 768px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
    .feature-card {
      background: var(--surface); backdrop-filter: blur(12px);
      border: 1px solid var(--border); border-radius: 10px;
      padding: 1.5rem;
    }
    .feature-card h3 { font-size: 0.95rem; margin-bottom: 0.4em; }

    /* ── Footer ────────────────────────── */
    footer {
      padding: 3rem 0;
      font-size: 0.85rem;
      color: var(--muted);
      opacity: 0.7;
    }
    footer .container {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }
    footer a { color: var(--muted); }
    footer a:hover { color: var(--text); }

    .mt-1 { margin-top: 1rem; }
    .mb-125 { margin-bottom: 1.25rem; }
    footer i[data-lucide],
    footer svg { width: 11px !important; height: 11px !important; vertical-align: -1px; }

    @media (max-width: 600px) {
      .container { padding: 0 1rem; }
      nav .nav-links { display: none; }
    }}

@scope (body.page-writing-index) {
  :scope {
      --bg: #1a181b;
      --surface: rgba(33, 31, 34, 0.6);
      --text: #f7f7f2;
      --muted: #77878b;
      --accent: #339999;
      --accent-deep: #305252;
      --border: rgba(119, 135, 139, 0.12);
      --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
      --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    }
    :scope, *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :scope {
      background: var(--bg);
      color: var(--muted);
      font-family: var(--font-sans);
      font-size: 16px;
      line-height: 1.7;
      -webkit-font-smoothing: antialiased;
    }
    :scope::before {
      content: '';
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      opacity: 0.03;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
      background-repeat: repeat;
      background-size: 256px 256px;
    }
    .container { max-width: 740px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 1; }
    h1, h2 { color: var(--text); font-weight: 600; letter-spacing: -0.02em; }
    h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
    h2 { font-size: 1.05rem; margin-bottom: 0.2em; }
    a { color: var(--accent); text-decoration: none; }
    a:hover { color: var(--text); }

    .section-label {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--accent);
      text-transform: lowercase;
      letter-spacing: 0.08em;
      margin-bottom: 1.5rem;
      display: block;
    }
    .section-label::before { content: '<'; }
    .section-label::after { content: '>'; }

    nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: rgba(26, 24, 27, 0.8);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
    }
    nav .container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 3.5rem;
    }
    .nav-logo {
      font-family: var(--font-sans);
      font-weight: 700;
      font-size: 0.95rem;
      color: var(--text);
      letter-spacing: 0.02em;
      display: flex;
      align-items: baseline;
      gap: 0.15em;
    }
    .nav-logo .tld { color: var(--accent); }

    .post-list { display: flex; flex-direction: column; gap: 2rem; margin-top: 1rem; }
    .post-item { padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
    .post-item:last-child { border-bottom: none; }
    .post-date {
      font-family: var(--font-mono);
      font-size: 0.75rem;
      color: var(--accent-deep);
      margin-bottom: 0.3em;
    }
    .post-title { color: var(--text); font-size: 1.1rem; font-weight: 500; display: block; }
    .post-title:hover { color: var(--accent); }
    .post-excerpt { font-size: 0.92rem; margin-top: 0.4em; }

    footer {
      padding: 3rem 0;
      font-size: 0.85rem;
      color: var(--muted);
      opacity: 0.7;
      margin-top: 4rem;
    }
    footer .container {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }
    footer a { color: var(--muted); }
    footer a:hover { color: var(--text); }

    @media (max-width: 600px) { .container { padding: 0 1rem; } }

    .writing-section { padding: 5rem 0; }
    .writing-divider { margin: 0; border: none; height: 1px; background: linear-gradient(to right, transparent, var(--border), transparent); }
    footer i[data-lucide],
    footer svg { width: 11px !important; height: 11px !important; vertical-align: -1px; }}

@scope (body.page-writing-post) {
  :scope {
      --bg: #1a181b;
      --surface: rgba(33, 31, 34, 0.6);
      --text: #f7f7f2;
      --muted: #77878b;
      --accent: #339999;
      --accent-deep: #305252;
      --border: rgba(119, 135, 139, 0.12);
      --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
      --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    }
    :scope, *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :scope {
      background: var(--bg);
      color: var(--muted);
      font-family: var(--font-sans);
      font-size: 16px;
      line-height: 1.8;
      -webkit-font-smoothing: antialiased;
    }
    :scope::before {
      content: '';
      position: fixed;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      opacity: 0.03;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
      background-repeat: repeat;
      background-size: 256px 256px;
    }
    .container { max-width: 740px; margin: 0 auto; padding: 0 1.5rem; position: relative; z-index: 1; }

    h1, h2, h3 { color: var(--text); font-weight: 600; letter-spacing: -0.02em; }
    h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.2; margin-bottom: 0.3em; }
    h2 { font-size: 1.3rem; margin: 2em 0 0.5em; }
    h3 { font-size: 1.1rem; margin: 1.5em 0 0.4em; }
    p { margin-bottom: 1.2em; }
    a { color: var(--accent); text-decoration: none; }
    a:hover { color: var(--text); }
    code { font-family: var(--font-mono); font-size: 0.85em; background: rgba(51,153,153,0.1); padding: 0.15em 0.4em; border-radius: 3px; color: var(--accent); }
    pre {
      background: rgba(26, 24, 27, 0.6);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 1.25rem;
      overflow-x: auto;
      font-family: var(--font-mono);
      font-size: 0.82rem;
      line-height: 1.6;
      margin: 1.2em 0;
    }
    pre code { background: none; padding: 0; color: var(--text); }
    blockquote {
      border-left: 2px solid var(--accent);
      padding-left: 1rem;
      margin: 1.2em 0;
      color: var(--text);
      font-style: italic;
    }
    ul, ol { margin: 0.8em 0 1.2em 1.5em; }
    li { margin-bottom: 0.3em; }
    hr { border: none; height: 1px; background: var(--border); margin: 2rem 0; }
    .post-divider { margin: 0; }

    /* Footer icons */
    footer i[data-lucide],
    footer svg { width: 11px !important; height: 11px !important; vertical-align: -1px; }

    nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: rgba(26, 24, 27, 0.8);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border);
    }
    nav .container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      height: 3.5rem;
    }
    .nav-logo {
      font-family: var(--font-sans);
      font-weight: 700;
      font-size: 0.95rem;
      color: var(--text);
      letter-spacing: 0.02em;
      display: flex;
      align-items: baseline;
      gap: 0.15em;
    }
    .nav-logo .tld { color: var(--accent); }

    .post-meta {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--accent-deep);
      margin-bottom: 2rem;
    }
    .post-content { margin-top: 2rem; }
    .post-article { padding: 4rem 0 2rem; }
    .back-link { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }

    footer {
      padding: 3rem 0;
      font-size: 0.85rem;
      color: var(--muted);
      opacity: 0.7;
      margin-top: 4rem;
    }
    footer .container {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }
    footer a { color: var(--muted); }
    footer a:hover { color: var(--text); }

    @media (max-width: 600px) {
      .container { padding: 0 1rem; }
    }}

@scope (body.page-error) {
  :scope {
        --bg: #1a181b;
        --text: #f7f7f2;
        --muted: #77878b;
        --accent: #339999;
        --border: rgba(119,135,139,0.15);
        --font-sans: 'Inter', system-ui, sans-serif;
        --font-mono: 'JetBrains Mono', monospace;
      }
    :scope, * { margin: 0; padding: 0; box-sizing: border-box; }
      :scope {
        background: var(--bg);
        color: var(--muted);
        font-family: var(--font-sans);
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        text-align: center;
        padding: 2rem;
        overflow: hidden;
      }

      /* ── Neural net background ─────────── */
      canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

      .content { position: relative; z-index: 1; }

      /* ── 403 code ──────────────────────── */
      .code {
        font-family: var(--font-mono);
        font-size: clamp(5rem, 15vw, 10rem);
        font-weight: 600;
        color: var(--text);
        line-height: 1;
        letter-spacing: -0.03em;
      }
      .code span { color: var(--accent); }

      .label {
        font-family: var(--font-mono);
        font-size: 0.8rem;
        color: var(--accent);
        margin-bottom: 1.5rem;
        letter-spacing: 0.1em;
      }

      h1 {
        font-size: clamp(1.2rem, 3vw, 1.6rem);
        color: var(--text);
        font-weight: 500;
        margin-bottom: 0.5rem;
      }

      p {
        max-width: 420px;
        margin: 0 auto 2rem;
        font-size: 0.95rem;
        line-height: 1.6;
      }

      a {
        font-family: var(--font-mono);
        font-size: 0.85rem;
        color: var(--accent);
        text-decoration: none;
        border-bottom: 1px solid transparent;
        transition: border-color 0.2s;
      }
      a:hover { border-bottom-color: var(--accent); }

      .ip {
        font-family: var(--font-mono);
        font-size: 0.7rem;
        color: var(--muted);
        margin-top: 2rem;
        opacity: 0.5;
      }
      .ip span { color: var(--accent); }}
