:root {
--bg: #07090f;
--bg-alt: #0e121b;
--text: #e8ebf2;
--muted: #8a93a6;
--line: #1c2331;
--accent: #7cc4ff;
--accent-2: #b794f6;

--sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
--mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

--nav-h: 64px;
}

/* ---------- Reset ---------- */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  }

html {
scroll-behavior: smooth;
scroll-padding-top: 80px;
color-scheme: dark;
}

body {
background: var(--bg);
color: var(--text);
font-family: var(--sans);
line-height: 1.6;
-webkit-font-smoothing: antialiased;
overflow-x: hidden;
}

body.menu-open {
overflow: hidden;
}

::selection {
background: rgba(124, 196, 255, 0.3);
}

a {
color: inherit;
text-decoration: none;
}

button {
font: inherit;
}

/* ---------- General layout ---------- */

.nav,
main,
footer {
position: relative;
z-index: 1;
}

main {
max-width: 960px;
margin: 0 auto;
padding: 0 24px;
}

section {
padding: 80px 0 24px;
}

/* ---------- Navigation ---------- */

.nav {
position: sticky;
top: 0;
z-index: 50;

display: flex;
justify-content: space-between;
align-items: center;

height: var(--nav-h);

padding: 0 max(
24px,
calc((100vw - 960px) / 2 + 24px)
);

border-bottom: 1px solid transparent;

transition:
background 0.3s,
border-color 0.3s,
backdrop-filter 0.3s;
}

.nav.scrolled {
background: rgba(7, 9, 15, 0.72);

-webkit-backdrop-filter: blur(14px);
backdrop-filter: blur(14px);

border-color: var(--line);
}

.wordmark {
position: relative;
z-index: 60;

font-family: var(--mono);
font-weight: 500;
letter-spacing: -0.02em;
}

.wordmark span {
color: var(--muted);
transition: color 0.2s;
}

.wordmark:hover span {
color: var(--accent);
}

/* ---------- Desktop navigation ---------- */

.nav nav {
display: flex;
gap: 6px;
}

.nav nav a {
position: relative;

padding: 8px 14px;

color: var(--muted);
font-size: 0.92rem;

border-radius: 8px;

transition:
color 0.2s,
background 0.2s;
}

.nav nav a::after {
content: "";

position: absolute;
left: 14px;
right: 14px;
bottom: 4px;

height: 1px;

background: var(--accent);

transform: scaleX(0);
transform-origin: left;

transition: transform 0.25s;
}

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

.nav nav a:hover::after,
.nav nav a.active::after {
transform: scaleX(1);
}

/* ---------- Mobile menu button ---------- */

.burger {
display: none;

position: relative;
z-index: 60;

width: 44px;
height: 44px;

background: none;
border: 0;

cursor: pointer;
}

.burger span {
position: absolute;

left: 11px;
right: 11px;

height: 2px;

background: var(--text);

border-radius: 2px;

transition:
transform 0.3s,
top 0.3s;
}

.burger span:nth-child(1) {
top: 18px;
}

.burger span:nth-child(2) {
top: 26px;
}

.burger[aria-expanded="true"] span:nth-child(1) {
top: 22px;
transform: rotate(45deg);
}

.burger[aria-expanded="true"] span:nth-child(2) {
top: 22px;
transform: rotate(-45deg);
}

/* ---------- Hero ---------- */

.hero {
position: relative;

min-height: calc(100svh - var(--nav-h));

padding: 14vh 0 40px;
}

h1 {
color: var(--text);

font-size: clamp(2.1rem, 8vw, 4.2rem);
font-weight: 600;
line-height: 1.1;

letter-spacing: -0.035em;
}

.lede {
min-height: 1.6em;

margin-top: 28px;

color: var(--text);

font-family: var(--mono);
font-size: clamp(0.95rem, 3.4vw, 1.15rem);
}

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

.caret {
display: inline-block;

width: 8px;
height: 1.1em;

margin-left: 3px;

vertical-align: text-bottom;

background: var(--accent);

animation: blink 1s steps(1) infinite;
}

@keyframes blink {
50% {
opacity: 0;
}
}

.sub {
max-width: 520px;

margin-top: 14px;

color: var(--muted);
}

/* ---------- Buttons ---------- */

.cta {
display: flex;
flex-wrap: wrap;
gap: 12px;

margin-top: 36px;
}

.btn {
display: inline-block;

padding: 12px 22px;

background: rgba(14, 18, 27, 0.6);

border: 1px solid var(--line);
border-radius: 10px;

font-size: 0.95rem;

transition:
border-color 0.2s,
background 0.2s,
box-shadow 0.2s,
transform 0.2s;
}

.btn:hover {
border-color: var(--accent);

box-shadow:
0 0 24px rgba(124, 196, 255, 0.18);
}

.btn:active {
transform: scale(0.97);
}

.btn.primary {
color: #06121e;
font-weight: 500;

background: var(--accent);
border-color: var(--accent);
}

.btn.primary:hover {
box-shadow:
0 0 28px rgba(124, 196, 255, 0.45);
}

/* ---------- Section headings ---------- */

h2 {
margin-bottom: 28px;

font-size: 1.4rem;
font-weight: 600;

letter-spacing: -0.02em;
}

h2 .num {
margin-right: 10px;

color: var(--accent);

font-family: var(--mono);
font-size: 0.85rem;
}

/* ---------- Scroll reveal ---------- */

.reveal {
opacity: 0;

transform: translateY(28px);

transition:
opacity 0.8s ease,
transform 0.8s ease;
}

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

.reveal.in .card {
animation: rise 0.7s ease both;
}

.reveal.in .card:nth-child(2) {
animation-delay: 0.1s;
}

.reveal.in .card:nth-child(3) {
animation-delay: 0.2s;
}

@keyframes rise {
from {
opacity: 0;
transform: translateY(20px);
}

to {
opacity: 1;
transform: none;
}
}

/* ---------- Project grid ---------- */

.grid {
display: grid;

grid-template-columns:
repeat(auto-fit, minmax(260px, 1fr));

gap: 18px;
}

/* ---------- Project cards ---------- */

.card {
position: relative;
overflow: hidden;

padding: 26px;

background: var(--bg-alt);

border: 1px solid var(--line);
border-radius: 16px;

transform-style: preserve-3d;

transition:
border-color 0.25s,
transform 0.25s ease-out,
box-shadow 0.25s;
}

.card:hover {
border-color: rgba(124, 196, 255, 0.45);

box-shadow:
0 18px 50px -20px rgba(124, 196, 255, 0.25);
}

.card h3 {
margin: 16px 0 8px;

font-size: 1.12rem;
}

.card p {
color: var(--muted);

font-size: 0.95rem;
}

.card.placeholder {
opacity: 0.8;
}

/* ---------- Project tags ---------- */

.tag {
display: inline-block;

padding: 2px 10px;

color: var(--accent-2);

font-family: var(--mono);
font-size: 0.72rem;

border: 1px solid var(--line);
border-radius: 999px;
}

/* ---------- Project links ---------- */

.more {
display: inline-block;

margin-top: 18px;

color: var(--accent);

font-family: var(--mono);
font-size: 0.82rem;

opacity: 0.7;

transition: opacity 0.2s;
}

.more i {
display: inline-block;

font-style: normal;

transition: transform 0.25s;
}

.card:hover .more {
opacity: 1;
}

.card:hover .more i {
transform: translateX(6px);
}

/* ---------- Footer ---------- */

footer {
max-width: 960px;

margin: 80px auto 0;

padding:
28px
24px
max(40px, env(safe-area-inset-bottom));

color: var(--muted);

font-size: 0.85rem;

border-top: 1px solid var(--line);
}

/* ---------- Utility ---------- */

.mono {
font-family: var(--mono);
}

/* ---------- Conway's Game of Life ---------- */

.game-card {
min-width: 0;
}

.life-wrap {
margin-top: 22px;
}

.life-grid {
display: grid;

grid-template-columns: repeat(16, 1fr);

width: 100%;
aspect-ratio: 1 / 1;

background: #05070c;

border: 1px solid var(--line);
border-radius: 10px;

overflow: hidden;

touch-action: manipulation;
}

.life-cell {
appearance: none;

padding: 0;

background: transparent;

border: 0;
border-right: 1px solid rgba(124, 196, 255, 0.08);
border-bottom: 1px solid rgba(124, 196, 255, 0.08);

cursor: pointer;

transition:
background 0.12s,
box-shadow 0.12s;
}

.life-cell.alive {
background: var(--accent);

box-shadow:
inset 0 0 7px rgba(255, 255, 255, 0.25);
}

.life-cell:hover {
background: rgba(124, 196, 255, 0.22);
}

.life-cell.alive:hover {
background: #a9dcff;
}

/* ---------- Game controls ---------- */

.life-controls {
display: flex;
flex-wrap: wrap;
gap: 7px;

margin-top: 12px;
}

.life-btn {
appearance: none;

padding: 7px 11px;

color: var(--text);

font-family: var(--mono);
font-size: 0.72rem;

background: rgba(14, 18, 27, 0.8);

border: 1px solid var(--line);
border-radius: 7px;

cursor: pointer;

transition:
border-color 0.2s,
background 0.2s,
transform 0.15s;
}

.life-btn:hover {
background: rgba(124, 196, 255, 0.08);

border-color: var(--accent);
}

.life-btn:active {
transform: scale(0.96);
}

.life-btn.primary {
color: #06121e;

background: var(--accent);
border-color: var(--accent);
}

/* ---------- Game status ---------- */

.life-status {
display: flex;
justify-content: space-between;

margin-top: 10px;

color: var(--muted);

font-family: var(--mono);
font-size: 0.68rem;
}

.life-status strong {
color: var(--accent);

font-weight: 500;
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {

.burger {
display: block;
}

.nav nav {
position: fixed;
inset: 0;
z-index: 55;


display: flex;

flex-direction: column;
justify-content: center;
align-items: center;

gap: 10px;

background: rgba(7, 9, 15, 0.96);

-webkit-backdrop-filter: blur(16px);
backdrop-filter: blur(16px);

opacity: 0;
visibility: hidden;

transition:
  opacity 0.3s,
  visibility 0.3s;


}

.nav nav.open {
opacity: 1;
visibility: visible;
}

.nav nav a {
padding: 12px 24px;


color: var(--text);

font-size: 1.6rem;

transform: translateY(12px);
opacity: 0;

transition:
  transform 0.4s,
  opacity 0.4s,
  color 0.2s;


}

.nav nav.open a {
transform: none;
opacity: 1;
}

.nav nav a::after {
display: none;
}

.hero {
padding-top: 10vh;
}

.btn {
padding: 14px 24px;
}

.life-grid {
grid-template-columns: repeat(16, 1fr);
}

.life-controls {
gap: 6px;
}

.life-btn {
flex: 1;


min-width: 60px;


}
}

/* ---------- Touch devices ---------- */

@media (hover: none) {

.card:hover {
box-shadow: none;
}

.card:active {
border-color: rgba(124, 196, 255, 0.45);
}

.life-cell:hover {
background: transparent;
}

.life-cell.alive:hover {
background: var(--accent);
}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {

html {
scroll-behavior: auto;
}

*,
*::before,
*::after {
animation: none !important;
transition: none !important;
}

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