:root {
  --bg: #fdfcfa;
  --ink: #161513;
  --ink-soft: #3d3c38;
  --muted: #6f6e69;
  --line: #e8e6e1;
  --card: #ffffff;
  --accent: #b3400a;
  --accent-hover: #8f3308;
  --header-bg: rgba(253, 252, 250, 0.92);
  --radius: 10px;
  --max: 720px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Newsreader", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

[data-theme="dark"] {
  --bg: #131210;
  --ink: #eceae4;
  --ink-soft: #c9c6bf;
  --muted: #a09d95;
  --line: #262522;
  --card: #1b1a18;
  --accent: #e8722a;
  --accent-hover: #f0823f;
  --header-bg: rgba(19, 18, 16, 0.88);
}

* {
  box-sizing: border-box;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Custom cursor: dot + lagging ring, fine pointers only */
.cursor-dot,
.cursor-ring {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.cursor-ring {
  width: 30px;
  height: 30px;
  border: 1px solid var(--muted);
  transition: opacity 0.2s ease, width 0.2s ease, height 0.2s ease, border-color 0.2s ease;
}

.cursor-ring.is-hover {
  width: 48px;
  height: 48px;
  border-color: var(--accent);
}

html.custom-cursor,
html.custom-cursor * {
  cursor: none !important;
}

html.custom-cursor .cursor-dot,
html.custom-cursor .cursor-ring {
  display: block;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 120;
  background: var(--ink); color: var(--bg); text-decoration: none;
  padding: 8px 14px; border-radius: 8px; transition: top 0.15s ease;
}
.skip:focus-visible { top: 12px; }

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.serif {
  font-family: var(--font-serif);
  font-weight: 400;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14.5px;
}

a {
  color: inherit;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  background: var(--card);
}

/* Progress bar */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 50;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.logo {
  font-weight: 600;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-dot {
  color: var(--accent);
}

.nav {
  display: flex;
  gap: 20px;
  margin-right: auto;
}

.nav a {
  text-decoration: none;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.nav a:hover,
.nav a.active {
  color: var(--ink);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--card);
  white-space: nowrap;
  margin-right: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1a7f37;
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 8px;
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
  touch-action: manipulation;
}

.icon-btn:hover {
  color: var(--ink);
  border-color: var(--muted);
}

#theme-toggle .icon-moon {
  display: none;
}

[data-theme="dark"] #theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] #theme-toggle .icon-moon {
  display: block;
}

.menu-btn,
.mobile-nav {
  display: none;
}

/* Buttons */
.btn {
  display: inline-block;
  text-decoration: none;
  background: var(--ink);
  color: var(--bg);
  font-size: 14.5px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.92);
}

.btn-small {
  padding: 7px 14px;
  font-size: 13.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
  filter: none;
  background: var(--card);
}

/* Hero */
.hero {
  padding: 88px 0 32px;
}

.eyebrow {
  color: var(--muted);
  margin: 0 0 14px;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin: 0 0 16px;
}

.hero h1 .serif {
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}

.lede {
  font-size: 17.5px;
  color: var(--ink-soft);
  max-width: 58ch;
  margin: 0 0 24px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.social-row {
  list-style: none;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  font-size: 14px;
}

.social-row a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}

.social-row a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.stats {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.stat {
  display: grid;
  gap: 2px;
}

.stat strong {
  font-size: 22px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Sections */
.section {
  padding: 64px 0 16px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

.section-num {
  color: var(--accent);
}

.section-head h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-line {
  flex: 1;
  min-width: 24px;
  height: 1px;
  background: var(--line);
  align-self: center;
}

.section-link {
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.section-link:hover {
  color: var(--accent);
}

.section-sub {
  margin: 0 0 24px;
  font-size: 15px;
}

/* About */
.two-col {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 48px;
}

.two-col p {
  margin: 0 0 18px;
  text-wrap: pretty;
}

.facts {
  list-style: none;
  padding: 20px 0 0;
  margin: 20px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 14px;
  font-size: 14.5px;
}

.facts li {
  display: grid;
  gap: 3px;
}

.facts span {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.about-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  font-size: 14.5px;
  align-self: start;
}

.about-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  gap: 10px;
}

.about-card ul li {
  text-wrap: balance;
}

.about-card hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.card-label {
  color: var(--muted);
  margin: 0 0 10px;
}

.about-card p {
  margin: 0;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.skill-group {
  position: relative;
  overflow: hidden;
  background: var(--card);
  padding: 18px;
  transition: background 0.25s ease;
}

.skill-group::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), var(--spot, transparent), transparent 70%);
  --spot: color-mix(in srgb, var(--accent) 10%, transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.skill-group:hover::before {
  opacity: 1;
}

.skill-group h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11.5px;
  position: relative;
}

.chips {
  margin: 0;
  font-size: 13.5px;
  position: relative;
}

.chip {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 11px;
  margin: 0 6px 7px 0;
  cursor: default;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.chip:hover,
.chip:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  transform: translateY(-1px);
  outline: none;
}

/* Floating skill card: lists projects that use the hovered skill */
.skill-preview {
  position: fixed; z-index: 90; width: 270px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; pointer-events: auto;
  opacity: 0; transform: scale(0.96) translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.skill-preview.show { opacity: 1; transform: none; }
.skill-preview:not(.show) { pointer-events: none; }
.skill-preview > p { margin: 0 0 6px; }
.skill-preview > p.small { margin: 0; }
.sk-item {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 6px; padding: 5px 6px;
  font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.sk-item:hover { background: var(--bg); color: var(--accent); }

.skill-group p {
  margin: 0;
  font-size: 14.5px;
}

/* Work list in plain editorial style, no cards */
.projects {
  display: block;
}

.work {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.work:last-child {
  border-bottom: 1px solid var(--line);
}

.work-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.work-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.01em;
  font-weight: 600;
  flex: 1;
  min-width: 220px;
}

.work-head h3 a {
  text-decoration: none;
}

.work-head h3 a:hover {
  color: var(--accent);
}

.work-head>span {
  flex-shrink: 0;
}

.work-head h3 a {
  text-decoration: none;
}

.work-head h3 a:hover {
  color: var(--accent);
}

.work p {
  margin: 0 0 12px;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 62ch;
  text-wrap: pretty;
}

.work-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}

.work-meta a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}

.work-meta a:hover {
  color: var(--accent);
}

.more-projects {
  margin-top: 22px;
  font-size: 14.5px;
  line-height: 1.8;
}

.more-projects a {
  color: var(--accent);
  text-decoration: none;
}

.more-projects a:hover {
  text-decoration: underline;
}

/* Project rows are clickable */
.work {
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.work:hover .work-head h3 {
  color: var(--accent);
}

.work:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Floating hover preview */
.work-preview {
  position: fixed;
  z-index: 90;
  width: 300px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.work-preview.show {
  opacity: 1;
  transform: none;
}

.work-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
}

.work-preview img[hidden],
.work-preview .monogram[hidden] {
  display: none;
}

.monogram {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 72px;
  color: var(--muted);
  background-image: radial-gradient(var(--line) 1px, transparent 1.5px);
  background-size: 14px 14px;
}

/* Project dialog */
.project-dialog {
  width: min(640px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  padding: 0;
}

.project-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.pd-body {
  padding: 26px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  overflow-x: hidden;
}

.pd-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.pd-head p {
  margin: 0 0 6px;
}

.pd-head h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

#pd-meta {
  margin: 0 0 14px;
}

.pd-text p {
  margin: 0 0 12px;
  font-size: 15px;
  color: var(--ink-soft);
}

.pd-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  margin: 20px 0 10px;
}

.pd-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 14.5px;
}

.pd-features li {
  padding-left: 18px;
  position: relative;
}

.pd-features li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.pd-links {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* Paginated showcase viewer */
.pd-viewer-wrap {
  margin-bottom: 16px;
}

.pd-viewer {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  touch-action: pan-y;
}

.pd-track {
  position: relative;
  display: block;
}

.pd-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.pd-slide.active {
  position: relative;
  opacity: 1;
  pointer-events: auto;
  animation: pd-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.pd-track[data-dir="prev"] .pd-slide.active {
  animation-name: pd-enter-left;
}

@keyframes pd-enter {
  from { opacity: 0; transform: translateX(36px) scale(0.985); }
}

@keyframes pd-enter-left {
  from { opacity: 0; transform: translateX(-36px) scale(0.985); }
}

.pd-slide img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 62vh;
  object-fit: contain;
  object-position: top center;
  background: var(--bg);
}

.pd-viewer .monogram {
  border: 0;
  border-radius: 0;
  height: 100%;
}

.pd-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.pd-viewer:hover .pd-arrow,
.pd-arrow:focus-visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

.pd-prev {
  left: 10px;
}

.pd-next {
  right: 10px;
}

.pd-arrow:hover {
  background: var(--card);
}

.pd-arrow[hidden] {
  display: none;
}

.pd-dots-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.pd-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pd-dots button {
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 999px;
  width: 8px;
  height: 8px;
  background: var(--line);
  transition: width 0.25s ease, background 0.25s ease;
}

.pd-dots button:hover {
  background: var(--muted);
}

.pd-dots button.active {
  width: 26px;
  background: var(--accent);
}

#pd-count {
  margin: 0;
  font-size: 12px;
}

@media (hover: none) {
  .pd-arrow {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pd-slide {
    transition: none;
  }

  .pd-slide.active {
    animation: none;
  }
}

/* Timeline */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.timeline li {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.timeline li:last-child {
  border-bottom: 1px solid var(--line);
}

.tl-meta {
  color: var(--muted);
  padding-top: 3px;
  white-space: nowrap;
}

.tl-body h3 {
  margin: 0 0 6px;
  font-size: 15.5px;
  line-height: 1.4;
  font-weight: 600;
}

.tl-body p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.cert-row {
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Notes */
.notes { display: block; }
.note { padding: 24px 0; border-top: 1px solid var(--line); }
.note:last-child { border-bottom: 1px solid var(--line); }
.note p { margin: 0 0 12px; font-size: 15px; line-height: 1.7; color: var(--ink-soft); max-width: 62ch; text-wrap: pretty; }
.note p:last-child { margin-bottom: 0; }

/* Contact */
.contact-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 28px;
}

.contact-box h3 {
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.contact-box>p {
  margin: 0 0 18px;
}

.contact-form {
  margin-top: 22px;
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-form label {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 500;
}

.contact-form input,
.contact-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  width: 100%;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.form-note {
  min-height: 18px;
  margin: 0;
  color: var(--accent);
}

/* Honeypot: invisible to humans, catches bots. Keep in DOM, off-screen. */
.hp-trap {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#turnstile-box {
  min-height: 0;
}

#turnstile-box:empty {
  display: none;
}

/* Footer */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding-top: 20px;
  padding-bottom: 40px;
  font-size: 13px;
  color: var(--muted);
}

.footer a {
  color: var(--muted);
}

.footer a:hover {
  color: var(--ink);
}

.footer p {
  margin: 0;
}

.footer-hints {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Back to top */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
  z-index: 40;
}

.to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.to-top:hover {
  transform: translateY(-2px);
  border-color: var(--muted);
}

/* Palette */
.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: center;
  padding-top: 14vh;
}

.palette-overlay[hidden] {
  display: none;
}

.palette {
  width: min(480px, calc(100vw - 48px));
  height: fit-content;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.palette input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 14px 16px;
  font-size: 14px;
  outline: none;
}

.palette ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 300px;
  overflow: auto;
}

.palette li button {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.palette li button small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.palette li.selected button,
.palette li button:hover {
  background: var(--bg);
}

.palette-hint {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* Snake easter egg */
.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.game-overlay[hidden] {
  display: none;
}

.game {
  width: min(448px, calc(100vw - 48px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  outline: none;
}

.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.game-head p {
  margin: 0;
}

#snake {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  touch-action: none;
}

.game-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.game-foot p {
  margin: 0;
}

/* Interactive terminal */
.term {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.terminal-bar span:not(.terminal-title) {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-bar span:nth-child(1) {
  background: #e08080;
}

.terminal-bar span:nth-child(2) {
  background: #dfc26a;
}

.terminal-bar span:nth-child(3) {
  background: #7fb685;
}

.terminal-title {
  margin-left: 8px;
  color: var(--muted);
}

.prompt {
  color: var(--accent);
}

.term-out {
  padding: 14px 14px 0;
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-soft);
}

.term-out a {
  color: var(--accent);
}

.term-out .prompt {
  margin-right: 8px;
}

.term-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 14px;
}

.term-line input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--ink);
  font: inherit;
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Telegram-style circular theme reveal */
.vt,
.vt *,
.vt *::before,
.vt *::after {
  transition: none !important;
}

::view-transition-image-pair(root) {
  isolation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
  display: block;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 2;
  animation: theme-circle 350ms ease-out;
  will-change: clip-path;
}

@keyframes theme-circle {
  from {
    -webkit-clip-path: circle(0% at var(--tx) var(--ty));
    clip-path: circle(0% at var(--tx) var(--ty));
  }

  to {
    -webkit-clip-path: circle(var(--tr) at var(--tx) var(--ty));
    clip-path: circle(var(--tr) at var(--tx) var(--ty));
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 860px) {
  .two-col {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 900px) {
  .header-right .status {
    display: none;
  }
}

@media (max-width: 640px) {
  .nav {
    display: none;
  }

  .menu-btn {
    display: block;
    margin-left: auto;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 12px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
  }

  .header-inner {
    gap: 10px;
  }

  .mobile-nav {
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
  }

  .mobile-nav[hidden] {
    display: none;
  }

  .mobile-nav a {
    padding: 8px 0;
    text-decoration: none;
    border-top: 1px solid var(--line);
    font-size: 15px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .contact-box {
    padding: 22px;
  }

  .work {
    padding: 24px 0;
  }

  .hero {
    padding-top: 48px;
  }

  .header-right {
    margin-left: 0;
  }

  .stats {
    gap: 20px;
  }

  #palette-btn {
    display: none;
  }
}