:root {
  --bg: #0b0c10;
  --surface: #13151c;
  --surface-hi: #1b1e28;
  --border: #262a37;
  --text: #eef0f5;
  --muted: #8e95a8;
  --accent: #ffb347;      /* sodium-lamp amber */
  --accent-2: #5eead4;    /* teal */
  --music: #f472b6;
  --photo: #fbbf24;
  --code: #5eead4;
  --games: #a78bfa;
  --cars: #f87171;
  --radius: 16px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
kbd {
  font-family: var(--mono); font-size: 0.8em;
  padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; background: var(--surface-hi);
}

#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.55; }

/* ── Nav ──────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 5vw, 56px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.logo { font-weight: 600; font-size: 1.15rem; text-decoration: none; color: var(--accent); }
.blink { animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.nav nav { display: flex; gap: clamp(12px, 3vw, 28px); }
.nav nav a { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.nav nav a:hover { color: var(--text); }

main { max-width: 1160px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 56px); }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  min-height: calc(100vh - 64px);
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center;
  padding: 48px 0;
}
.eyebrow { color: var(--accent); margin: 0 0 8px; }
h1 {
  font-size: clamp(3rem, 8vw, 6rem); line-height: 0.95; margin: 0;
  letter-spacing: -0.03em; font-weight: 700;
}
h1 .glyph { display: inline-block; transition: transform .25s, color .25s; }
h1 .glyph:hover { transform: translateY(-8px) rotate(-6deg); color: var(--accent); }
.tagline { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--muted); max-width: 32ch; margin: 20px 0 28px; }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chips a {
  display: inline-block; text-decoration: none; font-family: var(--mono); font-size: 0.85rem;
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); transition: border-color .2s, transform .2s;
}
.chips li:nth-child(1) a:hover { border-color: var(--music); }
.chips li:nth-child(2) a:hover { border-color: var(--photo); }
.chips li:nth-child(3) a:hover { border-color: var(--code); }
.chips li:nth-child(4) a:hover { border-color: var(--games); }
.chips li:nth-child(5) a:hover { border-color: var(--cars); }
.chips a:hover { transform: translateY(-2px); }

/* ── Terminal ─────────────────────────────────────────────────────────── */
.term {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(255,179,71,.04);
  overflow: hidden;
}
.term-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-hi); }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.r { background: #ff5f57; } .dot.y { background: #febc2e; } .dot.g { background: #28c840; }
.term-title { margin-left: 8px; font-size: 0.78rem; color: var(--muted); }
.term-body { height: 360px; overflow-y: auto; padding: 16px; font-size: 0.86rem; cursor: text; outline: none; }
.term-body p { margin: 0 0 4px; white-space: pre-wrap; word-break: break-word; }
.term-body .cmd { color: var(--text); }
.term-body .cmd::before { content: "~ $ "; color: var(--accent); }
.term-body .out { color: var(--muted); }
.term-body .hl { color: var(--accent-2); }
.term-body .err { color: var(--cars); }
.term-body a { color: var(--accent-2); }
.term-line { display: flex; gap: 8px; }
.prompt { color: var(--accent); flex: none; }
#term-in {
  flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 0;
  color: var(--text); font: inherit; caret-color: var(--accent);
}

/* ── Sections ─────────────────────────────────────────────────────────── */
.section { padding: 72px 0; }
.section-title { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin: 0 0 28px; letter-spacing: -0.02em; }
.section-title .mono { font-size: 0.5em; color: var(--accent); vertical-align: middle; margin-right: 10px; }

/* ── Channels ─────────────────────────────────────────────────────────── */
.channels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.card {
  --c: var(--accent);
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; overflow: hidden;
  transition: border-color .25s, transform .25s;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); opacity: .8;
}
.card:hover { border-color: color-mix(in srgb, var(--c) 45%, var(--border)); }
.card h3 { margin: 6px 0 10px; font-size: 1.25rem; }
.card p { margin: 0 0 14px; color: var(--muted); }
.tag { font-size: 0.75rem; color: var(--c); text-transform: lowercase; }
.c-music { --c: var(--music); grid-column: span 4; }
.c-photo { --c: var(--photo); grid-column: span 2; }
.c-code  { --c: var(--code);  grid-column: span 2; }
.c-games { --c: var(--games); grid-column: span 2; }
.c-cars  { --c: var(--cars);  grid-column: span 2; }
.more { color: var(--c); text-decoration: none; font-family: var(--mono); font-size: 0.85rem; }

/* synth */
.synth { display: flex; height: 140px; gap: 4px; user-select: none; touch-action: none; }
.key {
  flex: 1; border: 0; border-radius: 0 0 10px 10px; cursor: pointer; position: relative;
  background: linear-gradient(#f3f4f8, #d7dae3); color: #555a6b;
  font-family: var(--mono); font-size: 0.72rem; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px;
  transition: transform .06s, background .1s;
}
.key.on { background: linear-gradient(var(--music), #be4b8b); color: #fff; transform: translateY(2px); box-shadow: 0 0 24px -2px var(--music); }

/* filmstrip */
.filmstrip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.frame {
  aspect-ratio: 1; border-radius: 8px; overflow: hidden; position: relative;
  background: var(--g, linear-gradient(135deg, #3b2f1a, #1a1c26));
}
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.frame:hover img { transform: scale(1.06); }
.frame span { position: absolute; left: 8px; bottom: 6px; font-family: var(--mono); font-size: 0.65rem; color: rgba(255,255,255,.7); }

/* code */
.snippet { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-size: 0.8rem; margin: 0 0 14px; overflow-x: auto; }
.snippet .k { color: var(--games); } .snippet .s { color: var(--photo); } .snippet .n { color: var(--code); }

/* games */
.konami { font-size: 1.05rem; color: var(--text) !important; letter-spacing: 0.08em; }
.konami .hit { color: var(--games); text-shadow: 0 0 12px var(--games); }
body.party .card { animation: party 1.2s ease-in-out infinite alternate; }
body.party .card:nth-child(2n) { animation-delay: .3s; }
@keyframes party { from { transform: rotate(-1.2deg); } to { transform: rotate(1.2deg) translateY(-4px); } }

/* cars */
.tach { position: relative; max-width: 240px; margin: 0 auto; }
.tach svg { width: 100%; display: block; overflow: visible; }
.tach-track { fill: none; stroke: var(--surface-hi); stroke-width: 10; stroke-linecap: round; }
.tach-red { fill: none; stroke: var(--cars); stroke-width: 10; stroke-linecap: round; opacity: .8; }
#tach-ticks line { stroke: var(--muted); stroke-width: 2; }
#tach-ticks text { fill: var(--muted); font-family: var(--mono); font-size: 9px; text-anchor: middle; }
#needle { stroke: var(--cars); stroke-width: 3; stroke-linecap: round; transform-origin: 100px 110px; }
.hub { fill: var(--text); }
.rpm { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.rpm span { color: var(--text); font-size: 1.1rem; }
.rev {
  display: block; width: 100%; margin-top: 12px; padding: 10px; border-radius: 10px; cursor: pointer;
  background: var(--surface-hi); border: 1px solid var(--border); color: var(--text); font-size: 0.85rem;
  user-select: none; touch-action: none;
}
.rev:active, .rev.on { border-color: var(--cars); color: var(--cars); }
.card.shake { animation: shake .08s linear infinite; }
@keyframes shake { 0%,100% { transform: translate(0,0); } 25% { transform: translate(1px,-1px); } 75% { transform: translate(-1px,1px); } }

/* ── Projects ─────────────────────────────────────────────────────────── */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 12px;
  transition: transform .25s, border-color .25s;
}
.project:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.project h3 { margin: 0; font-size: 1.2rem; }
.project p { margin: 0; color: var(--muted); flex: 1; }
.project ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.project li { font-family: var(--mono); font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; background: var(--surface-hi); color: var(--accent-2); }
.project a { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); text-decoration: none; }

/* ── Log ──────────────────────────────────────────────────────────────── */
.log { display: flex; flex-direction: column; gap: 14px; }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.post-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); display: flex; gap: 12px; }
.post-meta .ptag { color: var(--accent); }
.post h3 { margin: 6px 0 8px; font-size: 1.3rem; }
.post-body { color: #c9cdd8; }
.post-body p { margin: 0 0 10px; }
.post-body code { font-family: var(--mono); background: var(--surface-hi); padding: 1px 6px; border-radius: 5px; font-size: 0.9em; }

/* ── Now ──────────────────────────────────────────────────────────────── */
.now { display: grid; grid-template-columns: max-content 1fr; gap: 12px 28px; margin: 0 0 16px; }
.now dt { font-family: var(--mono); color: var(--accent); font-size: 0.9rem; padding-top: 2px; }
.now dd { margin: 0; }

.hide { display: none !important; }
.post h3 a { color: inherit; text-decoration: none; }
.post h3 a:hover { color: var(--accent); }
.post .more, .log-more { --c: var(--accent); display: inline-block; }
.log-more { margin-top: 18px; }

/* ── /log/: archive and post pages ────────────────────────────────────── */
.reading { max-width: 720px; margin: 0 auto; padding: 56px clamp(16px, 5vw, 32px) 24px; min-height: 60vh; }
.reading a { color: var(--accent); }
.article-title { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.05; letter-spacing: -0.02em; margin: 10px 0 28px; }
.back { display: inline-block; margin-bottom: 28px; font-size: 0.85rem; text-decoration: none; }
.article .post-meta a { text-decoration: none; }

.article-body { font-size: 1.08rem; line-height: 1.75; }
.article-body p { margin: 0 0 1.2em; }
.article-body h2, .article-body h3, .article-body h4 { color: var(--text); letter-spacing: -0.01em; margin: 1.8em 0 0.6em; }
.article-body img { display: block; max-width: 100%; height: auto; border-radius: 12px; margin: 1.6em auto; }
.article-body ul, .article-body ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.article-body li { margin: 0.3em 0; }
.article-body blockquote { margin: 1.4em 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--accent); color: var(--muted); }
.article-body pre { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; overflow-x: auto; font-size: 0.88rem; }
.article-body pre code { background: none; padding: 0; }
.article-body hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }
.article-body table { border-collapse: collapse; display: block; overflow-x: auto; margin: 0 0 1.2em; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 6px 12px; }

.tag-filter { margin: -8px 0 32px; }
.tag-filter a { color: var(--text); }
.tag-filter a.on { border-color: var(--accent); color: var(--accent); }
.year { margin-bottom: 36px; }
.year-label { font-size: 0.85rem; color: var(--muted); font-weight: 400; margin: 0 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.archive { list-style: none; padding: 0; margin: 0; }
.archive-item { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.archive-item time { color: var(--muted); font-size: 0.8rem; padding-top: 4px; }
.archive-title { font-size: 1.15rem; font-weight: 500; color: var(--text) !important; text-decoration: none; }
.archive-title:hover { color: var(--accent) !important; }
.archive-item .ptag { color: var(--accent); font-size: 0.75rem; margin-left: 8px; }
.archive-item p { margin: 4px 0 0; font-size: 0.95rem; }
.more-posts { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); }
.more-posts h2 { font-weight: 400; margin: 0 0 4px; }
.rss-note { margin-top: 40px; }

@media (max-width: 560px) {
  .archive-item { grid-template-columns: 1fr; gap: 2px; }
  .reading { padding-top: 32px; }
}

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 56px 16px 40px; border-top: 1px solid var(--border); margin-top: 40px; }
.links { display: flex; justify-content: center; gap: 22px; margin-bottom: 10px; }
.links a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--accent); }

/* ── Reveal on scroll ─────────────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 40px 0 24px; gap: 32px; }
  .channels { grid-template-columns: repeat(2, 1fr); }
  .c-music { grid-column: span 2; }
  .c-photo, .c-code, .c-games, .c-cars { grid-column: span 1; }
  .projects { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .channels { grid-template-columns: 1fr; }
  .c-music, .c-photo, .c-code, .c-games, .c-cars { grid-column: span 1; }
  .term-body { height: 300px; }
  .nav nav a:nth-child(1) { display: none; }
  .now { grid-template-columns: 1fr; gap: 2px 0; }
  .now dd { margin-bottom: 10px; }
  .key { font-size: 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
