@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMonoNF-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Mono variant overrides PUA icon glyphs with single-width (1ch) advance widths */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('https://cdn.jsdelivr.net/gh/ryanoasis/nerd-fonts@v3.2.1/patched-fonts/JetBrainsMono/Ligatures/Regular/JetBrainsMonoNerdFontMono-Regular.ttf') format('truetype');
  unicode-range: U+E000-F8FF, U+100000-10FFFF;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  /* Page palette */
  --bg-page: #0d0907;
  --fg-cream: #ffffff;
  --fg-cream-dim: rgba(255, 255, 255, 0.6);
  --fg-cream-muted: rgba(255, 255, 255, 0.32);
  --accent-orange: #d97757;
  --accent-orange-deep: #d97757;

  /* Terminal palette */
  --term-bg: #1c1d2e;
  --term-title-bg: #15161f;
  --term-fg: #e3e3e8;
  --term-fg-dim: rgba(227, 227, 232, 0.6);
  --term-fg-muted: rgba(227, 227, 232, 0.35);
  --term-prompt: rgba(227, 227, 232, 0.75);
  --term-cmd-bg: rgba(255, 255, 255, 0.045);
  --term-rule: rgba(227, 227, 232, 0.2);
  --term-cursor: #6bb5a8;
  --term-skill-dot: #6bc16b;

  /* Claude theme bottomline */
  --pl-text: #e2d5c3;
  --pl-icon: #da7756;
  --pl-icon-bright: #f7a984;
  --pl-danger-bg: #5e2020;
  --pl-danger-fg: #e05a4e;

  /* Fonts */
  --font-display: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;

  /* Layout */
  --max-w: 1100px;
  --pad-x: 24px;
  --section-gap: 120px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ── Base ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
html { font-size: 16px; }
body {
  background: #0d0907;
  color: var(--fg-cream);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
  background: transparent;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  border-bottom: 1px solid transparent;
  transition: background 600ms ease, border-color 600ms ease, backdrop-filter 600ms ease, -webkit-backdrop-filter 600ms ease;
}
.navbar--scrolled {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
.navbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.navbar__brand {
  position: fixed;
  top: 14px;
  left: max(var(--pad-x), calc((100vw - var(--max-w)) / 2 + var(--pad-x)));
  z-index: 101;
  display: flex;
  align-items: center;
  gap: 0.35em;
  background: transparent;
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 44px);
  color: var(--fg-cream);
  letter-spacing: -0.03em;
  line-height: 1;
  transition: font-size 350ms ease-out;
}
.navbar__brand.navbar--scrolled {
  font-size: 24px;
  transition: font-size 600ms ease;
}
.navbar__brand-text {
  letter-spacing: inherit;
}
.navbar__brand-dim {
  opacity: 0.35;
}
.navbar__brand-cursor {
  display: inline-block;
  letter-spacing: 0;
  animation: brand-blink 1.1s step-start infinite;
}
@keyframes brand-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
.navbar__brand-icon {
  height: 1em;
  width: 1em;
  flex: 0 0 auto;
  display: block;
}
.navbar__github {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  transition: color 180ms ease;
}
.navbar__github:hover {
  color: var(--fg-cream);
}
.navbar__github-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 18px;
}

/* ── Animated background canvas ─────────────────────────────── */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: block;
}

/* ── Page container ────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* ── Section rhythm ────────────────────────────────────────── */
.section {
  padding-top: var(--section-gap);
  scroll-margin-top: var(--section-gap);
}
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--fg-cream-muted);
  margin-bottom: 12px;
}
.section-h {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 36px;
  line-height: 1.1;
  margin: 0 0 16px;
  color: var(--fg-cream);
}
.section-h em {
  color: var(--accent-orange);
  font-weight: 800;
  font-style: italic;
}
.section-sub {
  color: var(--fg-cream-dim);
  margin: 0 0 36px;
  font-size: 15px;
  line-height: 1.55;
}
.section-note {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.4);
  margin: -24px 0 36px;
}
.section-note a {
  color: rgba(255, 255, 255, 0.65);
  background-image: linear-gradient(var(--accent-orange), var(--accent-orange));
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.35s ease, color 0.2s ease;
}
.section-note a:hover {
  color: var(--accent-orange);
  background-size: 100% 1.5px;
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 100dvh;
  padding: 80px 0;
  padding-top: calc(52px + 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* The hero centers its child as a flex item; without an explicit width
   the container would shrink to content and the terminal could overflow. */
.hero .container {
  width: 100%;
}

.hero .terminal {
  text-align: left;
  margin-top: 44px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  max-width: 760px;
  min-width: 0;
}

/* ── Hero: horizontal layout on large screens ─────────────── */
@media (min-width: 900px) {
  .hero {
    text-align: left;
  }

  .hero .container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 64px;
  }

  .hero__copy {
    flex: 0 0 auto;
    max-width: 400px;
  }

  .hero-headline {
    margin-left: 0;
    margin-right: 0;
  }

  .hero-slogan,
  .hero-subline {
    margin-left: 0;
    margin-right: 0;
  }

  .hero__main {
    flex: 1 1 0;
    min-width: 0;
  }

  .hero .terminal {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .hero__hint {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
    max-width: none;
  }
}

.hero-headline {
  font-family: var(--font-display);
  font-style: normal;
  font-size: clamp(40px, 8vw, 84px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--fg-cream);
  margin: 0 auto 28px;
  max-width: 100%;
  filter:
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9))
    drop-shadow(0 8px 24px rgba(0, 0, 0, 0.6));
}
.hero-headline__accent {
  color: var(--accent-orange);
}

.hero-slogan {
  font-family: var(--font-ui);
  font-size: 20px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.6);
  margin: 0 auto 16px;
}
.hero__copy > :last-child {
  margin-bottom: 0;
}
.hero-subline {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.5);
  text-transform: lowercase;
  margin: 0 auto 20px;
}

.hero__hint {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.45);
  margin: 24px auto 0;
  padding: 0 20px;
  max-width: 640px;
}
.hero__hint-mark {
  color: var(--accent-orange);
  margin-right: 6px;
  opacity: 0.7;
}
.hero__hint-url {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 1px 6px;
}
.hero__hint a {
  color: rgba(255, 255, 255, 0.7);
  background-image: linear-gradient(var(--accent-orange), var(--accent-orange));
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: left bottom;
  transition: background-size 0.35s ease, color 0.2s ease;
}
.hero__hint a:hover {
  color: var(--accent-orange);
  background-size: 100% 1.5px;
}

/* ── Terminal block (shared chrome) ────────────────────────── */
.terminal {
  background:
    linear-gradient(var(--term-bg), var(--term-bg)) padding-box,
    linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.28) 0%,
      rgba(255, 255, 255, 0.10) 35%,
      rgba(255, 255, 255, 0.04) 65%,
      rgba(255, 255, 255, 0.14) 100%
    ) border-box;
  border: 1.5px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 20px 60px rgba(0, 0, 0, 0.5);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
  color: var(--term-fg);
  margin: 32px 0;
}
.terminal__titlebar {
  background: var(--term-title-bg);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.terminal__traffic {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.terminal__traffic--r { background: #ff5f56; }
.terminal__traffic--y { background: #ffbd2e; }
.terminal__traffic--g { background: #27c93f; }
.terminal__title {
  margin-left: 12px;
  font-size: 12px;
  color: var(--term-fg-muted);
  font-family: var(--font-ui);
}
.terminal__body {
  padding: 14px 0;
  display: flex;
  flex-direction: column;
}
.terminal__flow {
  padding: 0 0 8px;
}
/* Live preview: lock the history region to exactly three lines so the
   bottomline below never shifts when placeholders swap for real output. */
#preview-terminal .terminal__flow {
  height: calc(3 * (1.55em + 8px) + 8px);
}
.terminal__placeholder {
  padding: 4px 0;
  color: transparent;
}

/* Command line: full-width highlight, prompt flush-left */
.terminal__cmd {
  background: var(--term-cmd-bg);
  padding: 4px 0;
  color: var(--term-fg);
  display: flex;
}
.terminal__cmd .prompt {
  color: var(--term-prompt);
  margin-right: 1ch;
}

/* Response line: 2-space indent + curve glyph */
.terminal__resp {
  padding: 4px 0;
  color: var(--term-fg-dim);
  white-space: pre;
  font-variant-ligatures: none;
}

/* Copyable command rows */
.terminal__cmd--copy {
  cursor: pointer;
  align-items: center;
}
.terminal__copy-btn {
  display: inline-flex;
  align-items: center;
  margin-left: 0.75ch;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  color: var(--term-fg-dim);
  flex-shrink: 0;
}
.terminal__cmd--copy:hover .terminal__copy-btn {
  opacity: 1;
}
.terminal__copy-check {
  display: none;
}
.terminal__cmd--copy.copied .terminal__copy-btn {
  opacity: 1;
  color: var(--term-cursor);
}
.terminal__cmd--copy.copied .terminal__copy-icon {
  display: none;
}
.terminal__cmd--copy.copied .terminal__copy-check {
  display: inline;
}
.terminal__cmd--copy.copy-fading .terminal__copy-btn {
  opacity: 0;
  color: var(--term-cursor);
  transition-duration: 0.4s;
}
.terminal__cmd--copy.copy-fading .terminal__copy-icon {
  display: none;
}
.terminal__cmd--copy.copy-fading .terminal__copy-check {
  display: inline;
}
.terminal__cmd--copy.copy-fading:hover .terminal__copy-btn {
  opacity: 0;
}

/* Skill invocation marker (used in live preview) */
.terminal__skill {
  padding: 4px 0;
  color: var(--term-fg);
  display: flex;
  align-items: center;
}
.terminal__skill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--term-skill-dot);
  margin-right: 1ch;
}
.terminal__skill .name { color: var(--term-fg); font-weight: 600; }
.terminal__skill .args { color: var(--term-fg-dim); }
.terminal__skill-resp {
  padding: 4px 0;
  color: var(--term-fg-dim);
  white-space: pre;
}

.terminal__cmd[hidden],
.terminal__skill[hidden],
.terminal__skill-resp[hidden],
.terminal__placeholder[hidden] {
  display: none !important;
}

/* Input area: dash rules at text height, full terminal width */
.terminal__input {
  display: flex;
  flex-direction: column;
  color: var(--term-fg);
}
.terminal__input::before,
.terminal__input::after {
  content: '';
  display: block;
  height: 1.55em;
  background: linear-gradient(
    to bottom,
    transparent calc(50% - 0.5px),
    var(--term-rule) calc(50% - 0.5px),
    var(--term-rule) calc(50% + 0.5px),
    transparent calc(50% + 0.5px)
  );
}
.terminal__input-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
}
.terminal__input .prompt {
  color: var(--term-prompt);
  margin-right: 1ch;
}
.terminal__input .text { color: #f4f4f8; }
.terminal__input .cursor {
  display: inline-block;
  width: 1ch;
  height: 1.15em;
  background: var(--term-cursor);
  vertical-align: text-bottom;
}
.terminal__input .cursor-char {
  background: var(--term-cursor);
  color: var(--term-bg);
}

/* ── Bottomline statusline rendering ───────────────────────── */
.bl-row {
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  line-height: 1.55;
  padding-left: 2ch;
  background: var(--term-bg);
  overflow: hidden;
}
.bl-seg {
  padding: 0 1ch;
  display: flex;
  align-items: center;
  gap: 1ch;
  color: var(--pl-text);
  white-space: nowrap;
}
.bl-seg .ic { color: var(--pl-icon); }
.bl-seg .accent { color: var(--pl-icon-bright); }
.bl-seg--danger {
  color: var(--pl-danger-fg);
}
.bl-seg--danger .ic {
  color: var(--pl-danger-fg);
}
.bl-seg--danger .danger-suffix {
  color: var(--pl-danger-fg);
}
.bl-seg--danger .accent {
  color: var(--pl-danger-fg);
}

.bl-sep {
  width: 1ch;
  position: relative;
  background: var(--to);
  flex: 0 0 1ch;
}
.bl-sep::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--from);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Color-transition utilities (used by live preview JS) */
.bl-row.bl-row--animated .bl-seg,
.bl-row.bl-row--animated .bl-sep,
.bl-row.bl-row--animated .bl-sep::before {
  transition: background-color 800ms ease, color 800ms ease;
}

/* ── Features grid ──────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.feature {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 24px;
}
.feature__ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(218, 119, 86, 0.12);
  color: var(--accent-orange);
  font-size: 18px;
  margin-bottom: 16px;
}
.feature h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--fg-cream);
}
.feature p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-cream-dim);
  margin: 0;
}
.feature code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-orange);
}
a.feature {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.18s, background 0.18s;
}
a.feature:hover {
  border-color: rgba(218, 119, 86, 0.28);
  background: rgba(255, 255, 255, 0.055);
}
a.feature:hover .feature__ic {
  background: rgba(218, 119, 86, 0.2);
}

/* ── Skills grid ────────────────────────────────────────────── */
.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.skill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 24px;
}
.skill code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-orange);
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.skill .terminal__copy-btn {
  color: rgba(218, 119, 86, 0.45);
}
.skill .terminal__cmd--copy:hover .terminal__copy-btn {
  color: var(--accent-orange);
}
.skill p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-cream-dim);
  margin: 0;
}

/* ── Themes showcase ────────────────────────────────────────── */
.themes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px 48px;
}
.theme-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.theme-row__name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-cream-dim);
  display: flex;
  align-items: center;
}
.theme-row__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  flex: 0 0 8px;
}
.theme-row__badge {
  font-size: 10px;
  color: #c9a55a;
  background: rgba(201, 165, 90, 0.08);
  border: 1px solid rgba(201, 165, 90, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 8px;
  letter-spacing: 0.04em;
}
.theme-row__preview {
  min-width: 0;
  overflow-x: auto;
  border-radius: 10px;
  padding: 1.5px;
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.10) 35%,
    rgba(255, 255, 255, 0.04) 65%,
    rgba(255, 255, 255, 0.14) 100%
  );
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.45),
    0 1px 4px rgba(0, 0, 0, 0.3),
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}
.theme-row__preview .bl-row {
  border-radius: 8.5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
/* ── Section terminal: no bottom bleed into the section gap ─── */
.section .terminal { margin-bottom: 0; }

/* ── Language bars showcase ─────────────────────────────────── */

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: var(--section-gap);
  padding-top: var(--section-gap);
  padding-bottom: var(--section-gap);
}
.footer__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.footer__mark {
  display: block;
  max-width: 100%;
  height: auto;
}
.footer__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.footer__meta a:hover {
  color: var(--accent-orange);
}
.footer__sep::before {
  content: '·';
  margin: 0 4px;
}

/* ── Scroll-in fade ────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
  will-change: opacity, transform;
}
.fade-in.is-visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .section-note a {
    transition: none;
  }
  #bg-canvas {
    display: none;
  }
}

/* ── Mobile (≤ 768px) ───────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --pad-x: 16px;
    --section-gap: 80px;
  }

  .navbar__github-label { display: none; }

  .hero { padding: 48px 0; padding-top: calc(52px + 32px); }
  .hero-headline { font-size: clamp(34px, 9.5vw, 50px); }
  .hero-slogan { font-size: 17px; }
  .hero .terminal { margin-top: 32px; margin-bottom: 0; }
  .hero__hint { font-size: 13px; margin-top: 12px; }

  .features { grid-template-columns: repeat(2, 1fr); }
  .skills { grid-template-columns: repeat(2, 1fr); }

  /* Let terminals horizontal-scroll without wrapping or clipping */
  .lang-stack__body {
    min-width: max-content;
  }
  .terminal__body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .terminal__scroll {
    display: flex;
    flex-direction: column;
    min-width: max-content;
  }
  .terminal__flow {
    min-width: max-content;
  }

  /* Theme grid: single column on mobile */
  .themes {
    grid-template-columns: 1fr;
  }

  /* Section heading slightly smaller */
  .section-h { font-size: 28px; }
}

/* ── Very small phones (≤ 440px) ────────────────────────────── */
@media (max-width: 440px) {
  .features { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; }
}
