*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #060a08;
  --bg-secondary: #0b1410;
  --bg-card: #0f1e16;
  --jade-darkest: #0d2818;
  --jade-dark: #1a5c36;
  --jade: #1f8a4c;
  --jade-bright: #2ec27e;
  --jade-light: #77dd9a;
  --jade-pale: #a8e6cf;
  --jade-glow: rgba(46, 194, 126, 0.15);
  --text-primary: #d4e6da;
  --text-secondary: #7a9e86;
  --text-dim: #3d5c49;
  --marble-dark: #0a1a12;
  --marble-light: #102a1c;
  --pixel-size: 4px;
  --transition: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  font-size: 16px;
  /*scroll-behavior: smooth;*/
}

body {
  font-family: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  background: var(--bg-primary);
  color: #d4e6da;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ---- Marble overlay ---- */
.marble-overlay {
  position: fixed;
  /*inset: 0;*/
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  background:
    radial-gradient(ellipse 140% 80% at 20% 30%, var(--marble-light) 0%, transparent 60%),
    radial-gradient(ellipse 80% 120% at 80% 70%, var(--marble-dark) 0%, transparent 50%),
    repeating-linear-gradient(
      75deg,
      transparent,
      transparent 40px,
      rgba(46, 194, 126, 0.015) 40px,
      rgba(46, 194, 126, 0.015) 41px
    ),
    repeating-linear-gradient(
      -25deg,
      transparent,
      transparent 60px,
      rgba(31, 138, 76, 0.02) 60px,
      rgba(31, 138, 76, 0.02) 61px
    );
}

/* ---- Pixel canvas ---- */
#pixel-canvas {
  position: fixed;
  /*inset: 0;*/
  z-index: 1;
  pointer-events: none;
  opacity: 0.12;
  /*image-rendering: pixelated;*/
}

/* ---- Typography ---- */
h1, h2, h3 {
  font-weight: 400;
  letter-spacing: -0.01em;
}

a {
  color: #2ec27e;
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: #77dd9a;
}

/* ---- Layout ---- */
header, main, footer {
  position: relative;
  z-index: 2;
}

header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(31, 138, 76, 0.12);
  /*backdrop-filter: blur(12px);*/
  -webkit-backdrop-filter: blur(12px);
  background: rgba(6, 10, 8, 0.7);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-grid {
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pixel-badge {
  display: flex;
  gap: 2px;
}

.pixel-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1a5c36;
  border: 1px solid #1a5c36;
  /*image-rendering: pixelated;*/
  transition: all var(--transition);
}

.pixel-badge:hover .pixel-char {
  color: #2ec27e;
  border-color: #2ec27e;
  box-shadow: 0 0 8px  rgba(46, 194, 126, 0.15);
}

nav {
  display: flex;
  gap: 2rem;
}

.nav-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #7a9e86;
  position: relative;
  padding: 0.25rem 0;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: #2ec27e;
  transition: width var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link.active {
  color: #2ec27e;
}

/* ---- Hero ---- */
#hero {
  max-width: 840px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

#hero h1 {
  /*font-size: clamp(2.2rem, 6vw, 4rem);*/
  line-height: 1.15;
  font-weight: 300;
}

.line {
  display: block;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.8s var(--transition) forwards;
}

.line-1 { animation-delay: 0.1s; color: #2ec27e; font-weight: 600; }
.line-2 { animation-delay: 0.3s; }
.line-3 { animation-delay: 0.5s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.hero-tags {
  margin-top: 1.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: #3d5c49;
  letter-spacing: 0.05em;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.7s forwards;
}

/* ---- Content sections ---- */
main {
  max-width: 840px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.content-section {
  display: none;
  padding-top: 1rem;
}

.content-section.active {
  display: block;
  animation: fadeUp 0.5s var(--transition) forwards;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.section-marker {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: #1a5c36;
}

.section-header h2 {
  font-size: 1.4rem;
  color: #77dd9a;
  font-weight: 300;
  letter-spacing: 0.02em;
}

/* ---- Works grid ---- */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.work-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(31, 138, 76, 0.08);
  padding: 1.75rem;
  transition: all var(--transition);
  overflow: hidden;
}

.work-card::before {
  content: '';
  position: absolute;
  /*inset: 0;*/
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent var(--pixel-size),
      rgba(31, 138, 76, 0.02) var(--pixel-size),
      rgba(31, 138, 76, 0.02) calc(var(--pixel-size) + 1px)
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent var(--pixel-size),
      rgba(31, 138, 76, 0.02) var(--pixel-size),
      rgba(31, 138, 76, 0.02) calc(var(--pixel-size) + 1px)
    );
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
}

.work-card:hover::before {
  opacity: 1;
}

.work-card-border {
  position: absolute;
  /*inset: -1px;*/
  border: 1px solid transparent;
  transition: border-color var(--transition);
  pointer-events: none;
}

.work-card:hover .work-card-border {
  border-color: #1f8a4c;
}

.work-card:hover {
  border-color: rgba(31, 138, 76, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 24px  rgba(46, 194, 126, 0.15);
}

.work-card h3 {
  font-size: 1.15rem;
  color: #d4e6da;
  margin-bottom: 0.4rem;
  font-weight: 400;
}

.work-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: #3d5c49;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.75rem;
}

.work-desc {
  font-size: 0.9rem;
  color: #7a9e86;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.read-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: #1f8a4c;
  letter-spacing: 0.05em;
  position: relative;
}

.read-link:hover {
  color: #2ec27e;
}

/* ---- About ---- */
.about-body {
  max-width: 620px;
}

.about-body p {
  margin-bottom: 1.2rem;
  font-size: 1rem;
  color: #7a9e86;
  line-height: 1.8;
}

.about-body em {
  color: #77dd9a;
  font-style: italic;
}

/* ---- Contact ---- */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-item {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  color: #7a9e86;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(31, 138, 76, 0.08);
  transition: all var(--transition);
  width: fit-content;
}

.contact-item:hover {
  color: #2ec27e;
  border-bottom-color: #1f8a4c;
  padding-left: 0.5rem;
}

/* ---- Footer ---- */
footer {
  max-width: 840px;
  margin: 0 auto;
  padding: 2rem;
  border-top: 1px solid rgba(31, 138, 76, 0.06);
  text-align: center;
}

footer p {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: #3d5c49;
  letter-spacing: 0.05em;
}

/* ---- Selection ---- */
::selection {
  background: rgba(46, 194, 126, 0.3);
  color: #d4e6da;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  header { padding: 1rem; }
  #hero { padding: 3rem 1rem 2rem; }
  main { padding: 0 1rem 3rem; }
  nav { gap: 1rem; }
  .works-grid { grid-template-columns: 1fr; }
  .contact-links { gap: 0.5rem; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .works-grid { grid-template-columns: repeat(2, 1fr); }
}