:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-2: #11161d;
  --panel: #161b22;
  --line: rgba(148, 163, 184, 0.2);
  --ink: #cbd5e1;
  --white: #ffffff;
  --muted: #8b9bb0;
  --accent: #64ffda;
  --accent-dim: color-mix(in srgb, var(--accent) 12%, transparent);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --side: 284px;
  --status: 28px;
  --topbar-h: 58px;
  --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--status);
}

/* faint grid + glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 85% -5%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    linear-gradient(rgba(148,163,184,0.045) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(148,163,184,0.045) 1px, transparent 1px) 0 0 / 40px 40px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  mask-image: linear-gradient(to bottom, #000 0%, transparent 70%);
  z-index: 0;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------------------------------------------------------------- sidebar */
.side {
  position: fixed;
  top: 0; left: 0; bottom: var(--status);
  width: var(--side);
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 13px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 18px 18px;
  text-decoration: none;
  color: var(--white);
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}
/* PNG icons are used as masks so they take the current accent color */
.brand .logo, .side-foot .social {
  display: block; flex: none; background-color: var(--accent);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
  transition: background-color 0.2s;
}
.brand .logo { --icon: url(../images/logo.png); width: 34px; height: 34px; }
.side-foot .row { align-items: center; }
.side-foot .row a.social { width: 24px; height: 24px; transition: opacity 0.25s ease; }
.side-foot .row a.social:hover { opacity: 0.55; }
.side-foot .social[data-icon="github"] { --icon: url(../images/github.png); }
.side-foot .social[data-icon="linkedin"] { --icon: url(../images/linkedin.png); }
.side-foot .social[data-icon="instagram"] { --icon: url(../images/instagram.png); }
.side-foot .social[data-icon="spotify"] { --icon: url(../images/spotify.png); }
.brand-text { min-width: 0; }
.brand-text > span { display: block; line-height: 20px; }
.brand b { color: var(--accent); font-weight: 500; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 12px; font-weight: 400; letter-spacing: 0; white-space: nowrap; }

.tree { padding: 14px 10px 8px; }
.tree-h {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.tree a {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
}
.tree a .ic { color: var(--muted); width: 14px; flex: none; }
.tree a:hover { background: rgba(148,163,184,0.1); color: var(--white); }
.tree a[aria-current="page"] { background: var(--accent-dim); color: var(--accent); }
.tree a[aria-current="page"] .ic { color: var(--accent); }
.tree .dir { padding: 6px 12px; color: var(--muted); }
.tree .dir b { color: var(--ink); font-weight: 500; }
.tree .indent { margin-left: 14px; border-left: 1px solid var(--line); padding-left: 4px; }
.tree .sub a { padding: 3px 12px; font-size: 12px; color: var(--muted); }

.side-foot { margin-top: auto; padding: 14px 20px 22px; border-top: 1px solid var(--line); }
.side-foot .row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; justify-content: center; }
.side-foot .row a { text-decoration: none; color: var(--muted); transition: color 0.2s; }
.side-foot .row a:hover { color: var(--accent); }
.btn {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.btn:hover { background: var(--accent); color: var(--bg); }

/* mobile top bar */
.topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 45;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--white);
}
.topbar b { color: var(--accent); font-weight: 500; }
.nav-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 12px;
  cursor: pointer;
}

@media (max-width: 960px) {
  .topbar { display: flex; height: var(--topbar-h); }
  .side { top: var(--topbar-h); transform: translateX(-100%); transition: transform 0.3s ease; width: min(86vw, 320px); box-shadow: 20px 0 60px rgba(0,0,0,0.5); }
  .side.open { transform: none; }
  .main { margin-left: 0 !important; }
}

/* -------------------------------------------------------------- main area */
.main { margin-left: var(--side); position: relative; z-index: 1; min-height: 100vh; }

.tabbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
}
.tab {
  padding: 11px 20px;
  color: var(--white);
  background: var(--bg);
  border-right: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  display: inline-flex;
  gap: 10px;
  align-items: center;
}
.tab::before { content: "◆"; color: var(--accent); font-size: 9px; }
.tab em { font-style: normal; color: var(--muted); }
.crumbs { margin-left: auto; padding: 11px 20px; color: var(--muted); white-space: nowrap; }
@media (max-width: 960px) { .tabbar { display: none; } }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 clamp(20px, 4.5vw, 64px); }

/* ------------------------------------------------------------------ hero */
.hero { padding: clamp(36px, 6vw, 80px) 0 clamp(20px, 3vw, 40px); }

.term {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7), 0 0 0 1px color-mix(in srgb, var(--accent) 4%, transparent);
}
.term-bar, .win-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  background: #1c222b;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.term-bar i, .win-bar i { width: 11px; height: 11px; border-radius: 50%; background: #3a4350; display: block; }
.term-bar i:first-child, .win-bar i:first-child { background: #ff5f57; }
.term-bar i:nth-child(2), .win-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3), .win-bar i:nth-child(3) { background: #28c840; }
.term-bar span, .win-bar span { margin-left: 10px; }

.term-body { padding: clamp(20px, 3.5vw, 40px); font-family: var(--mono); }
.term-body > * { opacity: 0; animation: show 0.01s forwards; animation-delay: calc(var(--i, 0) * 0.45s + 0.2s); }
@keyframes show { to { opacity: 1; } }
/* JS-driven typing: script.js reveals these in sequence instead of the CSS delays */
.js .term-body.typing > * { animation: none; opacity: 1; }
.js .term-body.typing .pending { display: none; }
.js .term-body.typing .typing-now::after { content: ""; display: inline-block; width: 9px; height: 1.1em; margin-left: 2px; background: var(--accent); vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
.ln { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.ln .ps { color: var(--accent); margin-right: 10px; }
.ln .cmd { color: var(--white); }
.out { margin: 0 0 26px; }
.hero h1.out {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(44px, 9vw, 104px);
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--white);
  margin: 6px 0 30px;
}
.hero h1.out em { color: var(--accent); font-style: normal; }
.out.role { font-size: clamp(18px, 2.4vw, 26px); color: var(--accent); }
.out.lede { font-family: var(--sans); font-size: 18px; max-width: 58ch; margin-bottom: 20px; color: var(--ink); }
.cursor { display: inline-block; width: 10px; height: 1.1em; background: var(--accent); vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; font-family: var(--mono); font-size: 12px; }
.tags li { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: rgba(148,163,184,0.06); transition: border-color 0.2s, color 0.2s; }
.tags li:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------- sections */
.sec { padding: clamp(44px, 6vw, 80px) 0 0; }
.sh {
  margin: 0 0 28px;
  font-family: var(--mono);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 500;
  color: var(--white);
  letter-spacing: -0.02em;
}
.sh span { color: var(--muted); margin-right: 12px; }
.sh em { font-style: normal; color: var(--accent); margin-right: 10px; }

.about p { max-width: 68ch; margin: 0 0 1.2em; color: var(--ink); }
.about p:first-child { font-size: 20px; color: var(--white); }
.about strong { color: var(--white); font-weight: 600; border-bottom: 1px solid var(--accent); }

/* experience as a git-log style graph */
.log { list-style: none; margin: 0; padding: 0; position: relative; }
.log::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 10%, transparent)); }
.log li { position: relative; padding: 0 0 26px 40px; }
.log li::before { content: ""; position: absolute; left: 0; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.log li.current::before { background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); animation: ping 2.4s ease-out infinite; }
@keyframes ping { to { box-shadow: 0 0 0 12px color-mix(in srgb, var(--accent) 0%, transparent); } }
.log .when { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; color: var(--accent); }
.log .head { margin-left: 10px; padding: 1px 8px; border-radius: 4px; background: var(--accent); color: var(--bg); font-size: 10px; font-weight: 700; }
.log .what { display: block; color: var(--white); font-size: 19px; font-weight: 500; line-height: 1.35; margin-top: 2px; }
.log .at { display: block; color: var(--muted); font-size: 15px; }
.log .at a { text-decoration: none; border-bottom: 1px solid transparent; transition: color 0.2s, border-color 0.2s; }
.log .at a:hover { color: var(--accent); border-color: var(--accent); }
.log li:not(.current) .what { color: var(--ink); }
.log .exp-toggle { display: block; width: 100%; position: relative; padding: 0 34px 0 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.log .exp-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.log .exp-toggle:hover .what { color: var(--accent); }
.log .chev { position: absolute; right: 4px; top: 12px; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.25s, border-color 0.2s; }
.log .exp-toggle:hover .chev { border-color: var(--accent); }
.log .exp-toggle[aria-expanded="true"] .chev { transform: rotate(225deg) translate(-2px, -2px); border-color: var(--accent); }
.log .exp-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.log .exp-body.open { grid-template-rows: 1fr; }
.log .exp-inner { overflow: hidden; min-height: 0; }
.log .exp-inner > :first-child { margin-top: 14px; }
.log .exp-inner p { margin: 0 0 10px; color: var(--ink); font-size: 15px; font-weight: 400;}
.log .exp-inner ul { margin: 0 0 4px; padding-left: 18px; color: var(--muted); font-size: 16px; line-height: 1.5; list-style: disc; }
.log .exp-inner li { padding: 0 0 0 2px; margin: 0 0 20px; }
.log .exp-inner li::before { content: none; }
.log .exp-more { display: inline-block; margin: 4px 0 6px; color: var(--accent); font-family: var(--mono); font-size: 14px; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
.log .exp-more:hover { border-color: var(--accent); }
.log .exp-inner li::marker { color: var(--accent); }
.log .subrole { margin-top: 14px; padding-left: 16px; border-left: 2px dashed var(--line); }
.log .subrole .what { font-size: 16px; }

/* project cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 1180px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }
.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s, box-shadow 0.3s;
}
.card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 18px 50px -20px color-mix(in srgb, var(--accent) 25%, transparent); }
.card .win-bar { padding: 8px 12px; }
.card .win-bar i { width: 9px; height: 9px; }
.card .shot { aspect-ratio: 16 / 10; background: var(--bg-2); overflow: hidden; }
.card .shot img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.card:hover .shot img { transform: scale(1.05); }
.card .txt { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-family: var(--mono); font-size: 17px; line-height: 1.3; color: var(--white); font-weight: 500; letter-spacing: -0.01em; }
.card:hover h3 { color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.card .meta { margin-top: auto; padding-top: 12px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }

/* ----------------------------------------------------------- project pages */
.back { display: inline-block; margin: 36px 0 0; font-family: var(--mono); font-size: 13px; color: var(--muted); text-decoration: none; transition: color 0.2s; }
.back:hover { color: var(--accent); }
.ph { padding: 20px 0 8px; }
.ph .date { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-bottom: 10px; }
.ph h1 { margin: 0; font-family: var(--mono); font-weight: 700; font-size: clamp(30px, 5.4vw, 60px); line-height: 1.08; letter-spacing: -0.04em; color: var(--white); }
.ph h1 .hash { color: var(--accent); margin-right: 14px; }
.ph h1 em { font-style: normal; color: var(--accent); }

.links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 28px 0 8px; padding: 16px 0; border-block: 1px solid var(--line); }
.links .lab { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 8px; }
.chip { font-family: var(--mono); font-size: 13px; text-decoration: none; padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px; background: rgba(148,163,184,0.06); transition: border-color 0.2s, color 0.2s, background 0.2s; }
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.project-main { max-width: 820px; padding-bottom: 20px; }
.block { padding: clamp(32px, 4.5vw, 52px) 0 0; }
.block h2 { margin: 0 0 18px; font-family: var(--mono); font-size: 20px; font-weight: 500; color: var(--white); letter-spacing: -0.01em; }
.block h2::before { content: "## "; color: var(--accent); }
.block p { margin: 0 0 1em; max-width: 68ch; }
.block p.lead { font-size: 20px; line-height: 1.6; color: var(--white); }
.block .note { color: var(--muted); font-style: italic; }
.block p a, .block li a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); transition: border-color 0.2s; }
.block p a:hover, .block li a:hover { border-color: var(--accent); }

.list { list-style: none; margin: 0 0 1em; padding: 0; max-width: 68ch; }
.list li { position: relative; padding: 4px 0 4px 26px; line-height: 1.6; }
.list li::before { content: "-"; position: absolute; left: 6px; color: var(--accent); font-family: var(--mono); }
.list .list { margin: 4px 0 4px; }
.list .list li { color: var(--muted); font-size: 16px; }
.list.cols { max-width: none; columns: 2; column-gap: 36px; }
.list.cols li { break-inside: avoid; }
@media (max-width: 760px) { .list.cols { columns: 1; } }
.list-note { color: var(--muted); }

.code { font-family: var(--mono); font-size: 0.84em; color: var(--accent); background: var(--accent-dim); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 5px; padding: 1px 7px; white-space: nowrap; }

.menu-table { list-style: none; margin: 0 0 1em; padding: 0; max-width: 440px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.menu-table li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 18px; font-family: var(--mono); font-size: 15px; color: var(--white); }
.menu-table li + li { border-top: 1px solid var(--line); }
.menu-table li span { color: var(--accent); font-size: 12px; }

.video { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }

.people { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--mono); font-size: 13px; }
.people li { padding: 7px 16px; border: 1px solid var(--line); border-radius: 6px; background: rgba(148,163,184,0.06); }
.people li.me { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gallery figure { margin: 0; overflow: hidden; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.gallery img { width: 100%; height: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: transform 0.5s ease; }
.gallery figure:hover img { transform: scale(1.06); }
@media (max-width: 640px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
[data-zoom] { cursor: zoom-in; }

.shots { display: grid; gap: 22px; }
.shots figure { margin: 0; }
.shots img { width: 100%; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.shots figcaption { margin-top: 8px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* achievements */
.ach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px; margin-top: 36px; }
@media (max-width: 760px) { .ach-grid { grid-template-columns: 1fr; } }
.ach { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.ach.wide { grid-column: 1 / -1; }
.ach .win-bar { padding: 9px 14px; }
.ach .win-bar i { width: 9px; height: 9px; }
.ach h2 { margin: 0; padding: 20px 22px 4px; font-family: var(--mono); font-size: 17px; font-weight: 500; color: var(--white); line-height: 1.35; }
.ach .imgs { padding: 16px 22px; display: grid; gap: 16px; }
.ach.wide .imgs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .ach.wide .imgs { grid-template-columns: 1fr; } }
.ach .imgs figure { margin: 0; }
.ach img { width: 100%; border-radius: 6px; border: 1px solid var(--line); background: #fff; transition: transform 0.35s ease; }
.ach img:hover { transform: scale(1.02); }
.ach .alinks { padding: 0 22px 22px; display: flex; gap: 14px; flex-wrap: wrap; margin-top: auto; }
.ach .alinks a, .ach figure .alinks a { font-family: var(--mono); font-size: 12px; color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.ach figure .alinks { padding: 12px 0 0; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(5, 8, 12, 0.92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1400px, 94vw); max-height: 88vh; border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,0.6); }
.lightbox button { position: absolute; top: 20px; right: 24px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.35); background: transparent; color: #fff; font-size: 22px; cursor: pointer; }
.lightbox button:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* ------------------------------------------------------------- status bar */
.status {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--status);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}
.status a { color: inherit; text-decoration: none; }
.status a:hover { text-decoration: underline; }
.status .l, .status .r { display: flex; gap: 20px; align-items: center; }
@media (max-width: 760px) { .status .hide-s { display: none; } }

/* reveal */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .term-body > * { opacity: 1; animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .cursor, .log li.current::before { animation: none; }
}

html[data-theme="amber"]  { --accent: #ffb454; }
html[data-theme="violet"] { --accent: #b79cff; }
html[data-theme="rose"]   { --accent: #ff7a9c; }

.themes { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--muted); font-size: 12px; }
.themes span { margin-right: 4px; }
.themes button[data-theme] {
  width: 18px; height: 18px; padding: 0; border-radius: 50%; cursor: pointer;
  background: var(--c); border: 2px solid transparent;
  outline: 2px solid transparent; outline-offset: 2px;
  transition: transform 0.2s;
}
.themes button[data-theme]:hover { transform: scale(1.18); }
.themes button[data-theme][aria-pressed="true"] { outline-color: var(--white); }

.pal-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; padding: 9px 12px; cursor: pointer;
  background: rgba(148,163,184,0.07); border: 1px solid var(--line); border-radius: 6px;
  color: var(--ink); font: inherit; transition: border-color 0.2s, color 0.2s;
}
.pal-btn:hover { border-color: var(--accent); color: var(--accent); }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--bg); }

.sbtn { background: transparent; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; opacity: 0.85; }
.sbtn:hover { opacity: 1; text-decoration: underline; }
.topbar .nav-toggle { color: var(--ink); }

/* interactive terminal */
#termout { margin-top: 18px; }
#termout .o { margin: 0 0 4px; font-size: 14px; line-height: 1.6; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
#termout .o.echo { color: var(--muted); margin-top: 12px; }
#termout .o.dim { color: var(--muted); }
#termout .o.err { color: #ff8a8a; }
#termout .o.ok { color: var(--accent); }
#termout .card-ch { color: var(--white); font-weight: 500; }
#termout .card-ch.red { color: #ff7a7a; }
#termout .o a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
#termout .o a:hover { border-bottom-color: var(--accent); }
.ln.inline { display: flex; align-items: center; gap: 0; cursor: text; }
.cmd-in {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; padding: 4px 0;
  color: var(--white); font: inherit; font-size: 14px; caret-color: var(--accent);
  border-bottom: 1px dashed transparent;
}
.cmd-in::placeholder { color: var(--muted); opacity: 0.7; }
.cmd-in:focus { border-bottom-color: var(--line); }
.term-body { max-height: none; }

/* command palette */
.pal { position: fixed; inset: 0; z-index: 300; display: none; align-items: flex-start; justify-content: center; padding: 14vh 16px 0; background: rgba(5, 8, 12, 0.7); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.pal.open { display: flex; }
.pal-box { width: min(640px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 40px 100px -20px rgba(0,0,0,0.8), 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent); font-family: var(--mono); animation: palin 0.16s ease-out; }
@keyframes palin { from { opacity: 0; transform: translateY(-8px) scale(0.985); } }
.pal-in { width: 100%; padding: 18px 20px; background: transparent; border: 0; border-bottom: 1px solid var(--line); outline: 0; color: var(--white); font: inherit; font-size: 15px; caret-color: var(--accent); }
.pal-in::placeholder { color: var(--muted); }
.pal-list { list-style: none; margin: 0; padding: 8px; max-height: min(52vh, 420px); overflow-y: auto; }
.pal-g { padding: 10px 12px 4px; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.pal-i { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 9px 12px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--ink); }
.pal-i small { color: var(--muted); font-size: 11px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.pal-i.sel { background: var(--accent-dim); color: var(--accent); }
.pal-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

/* project pages: content + outline rail */
.project-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 48px; }
.outline { display: none; }
@media (min-width: 1320px) {
  .project-grid { grid-template-columns: minmax(0, 1fr) 150px; }
  .outline { display: block; position: sticky; top: 74px; align-self: start; padding-top: clamp(32px, 4.5vw, 52px); font-family: var(--mono); font-size: 12px; }
  .outline .tree-h { padding: 0 0 10px; }
  .outline a { display: block; padding: 5px 0 5px 14px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; transition: color 0.2s, border-color 0.2s; }
  .outline a:hover { color: var(--white); }
  .outline a.active { color: var(--accent); border-left-color: var(--accent); }
}
@media (min-width: 1320px) { .wrap { max-width: 1180px; } }

/* ------------------------------------------------------------ tech stack chips */
.stack { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.stack li { padding: 2px 9px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; background: var(--accent-dim); color: var(--accent); font-family: var(--mono); font-size: 11px; line-height: 1.6; }

/* ------------------------------------------------------- light / dark switch */
.mode-switch {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  width: 52px; height: 26px; margin-left: auto; padding: 0; flex: none;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(148,163,184,0.12); cursor: pointer;
  transition: border-color 0.25s;
}
.mode-switch:hover { border-color: var(--accent); }
.mode-switch .knob {
  position: absolute; top: 1px; left: 1px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  transform: translateX(26px); transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.mode-switch svg { position: relative; z-index: 1; width: 14px; height: 14px; margin: 0 5px; color: var(--muted); transition: color 0.25s; }
.mode-switch svg:last-child { color: var(--bg); }
html[data-mode="light"] .mode-switch .knob { transform: translateX(0); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3); }
html[data-mode="light"] .mode-switch svg:last-child { color: var(--muted); }
html[data-mode="light"] .mode-switch svg:nth-of-type(1) { color: #fff; }

/* ------------------------------------------------------------------ light mode */
html[data-mode="light"] {
  color-scheme: light;
  --bg: #f6f8fa; --bg-2: #eceff4; --panel: #ffffff;
  --line: rgba(71, 85, 105, 0.22);
  --ink: #334155; --white: #0f172a; --muted: #5b6b7f;
  --accent: #0b8a72;
}
html[data-mode="light"][data-theme="amber"]  { --accent: #b36200; }
html[data-mode="light"][data-theme="violet"] { --accent: #6a49d8; }
html[data-mode="light"][data-theme="rose"]   { --accent: #cf2c5f; }
html[data-mode="light"] .term-bar, html[data-mode="light"] .win-bar { background: #e4e9f0; }
html[data-mode="light"] .term-bar i, html[data-mode="light"] .win-bar i { background: #c3cad5; }
html[data-mode="light"] .term-bar i:first-child, html[data-mode="light"] .win-bar i:first-child { background: #ff5f57; }
html[data-mode="light"] .term-bar i:nth-child(2), html[data-mode="light"] .win-bar i:nth-child(2) { background: #febc2e; }
html[data-mode="light"] .term-bar i:nth-child(3), html[data-mode="light"] .win-bar i:nth-child(3) { background: #28c840; }
html[data-mode="light"] .term { box-shadow: 0 20px 50px -25px rgba(15, 23, 42, 0.25); }
html[data-mode="light"] #termout .o.err { color: #c0392b; }
html[data-mode="light"] .pal { background: rgba(15, 23, 42, 0.35); }
html[data-mode="light"] .pal-box { box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.35); }

/* ------------------------------------------------------------ page transitions */
@media (prefers-reduced-motion: no-preference) {
  body { animation: pagein 0.28s ease-out both; }
  body.leaving { opacity: 0; transition: opacity 0.18s ease-in; }
}
@keyframes pagein { from { opacity: 0; } to { opacity: 1; } }
html[data-mode="light"] #termout .card-ch.red { color: #c0392b; }

/* ----------------------------------------------- dotted-gray card art (logos) */
.card .shot.dots {
  display: flex; align-items: center; justify-content: center; padding: 6% 9%;
  background-color: #17181d;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.2px, transparent 1.6px);
  background-size: 44px 44px;
}
.card .shot.dots img { width: 100%; height: 100%; object-fit: contain; }

/* "Coming soon" tag in a card's title bar, styled like the tech-stack chips */
.win-bar .soon {
  margin-left: auto; padding: 2px 9px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px; background: var(--accent-dim); color: var(--accent);
  font-family: var(--mono); font-size: 11px; line-height: 1.6; white-space: nowrap;
}

/* sidebar entry for a project that has no page yet */
.tree .soon-item { display: flex; gap: 8px; align-items: baseline; padding: 6px 12px; color: var(--muted); cursor: default; }
.tree .soon-item .ic { width: 14px; flex: none; }
.tree .soon-item .soon {
  margin-left: auto; padding: 0 8px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px; background: var(--accent-dim); color: var(--accent);
  font-size: 10px; line-height: 1.7; white-space: nowrap; align-self: center;
}
