:root{
  --paper: #F2F0EA;
  --paper-2: #E9E6DD;
  --ink: #17191B;
  --muted: #6B6E70;
  --accent: #2F4B7C;
  --highlight: #F2B705;
  --line: #D8D4C8;
  --radius: 2px;
  --max: 1040px;
}

html[data-theme="dark"]{
  --paper: #16181A;
  --paper-2: #1F2224;
  --ink: #F2F0EA;
  --muted: #93968F;
  --accent: #7FA6E8;
  --highlight: #F2B705;
  --line: #303336;
}

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

html{ scroll-behavior: smooth; }

body{
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.35s ease, color 0.35s ease;
}

h1, h2, h3{
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.mono{
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.02em;
}

::selection{ background: var(--highlight); color: #17191B; }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

/* ---------- NAV ---------- */
header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  transition: background 0.35s ease, border-color 0.35s ease;
}
nav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 20px;
  padding: 18px 28px;
  max-width: var(--max);
  margin: 0 auto;
}
.logo{
  font-family:'Space Grotesk', sans-serif;
  font-weight:700;
  font-size:1.1rem;
}
.logo span{ color: var(--accent); }
.nav-links{
  display:flex;
  gap: 28px;
  font-family:'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: auto;
  margin-left: 40px;
}
.nav-links a{
  position:relative;
  padding-bottom:4px;
  color: var(--muted);
  transition: color 0.2s ease;
}
.nav-links a::after{
  content:'';
  position:absolute;
  left:0; bottom:0;
  width:0%;
  height:1px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.nav-links a:hover{ color: var(--ink); }
.nav-links a:hover::after{ width:100%; }
.nav-links a.active{
  color: var(--ink);
}
.nav-links a.active::after{ width:100%; }

.theme-toggle{
  width: 42px;
  height: 24px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.theme-toggle .dot{
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.3s ease, background 0.3s ease;
}
html[data-theme="dark"] .theme-toggle .dot{
  transform: translateX(18px);
  background: var(--highlight);
}

/* ---------- HERO ---------- */
.hero{
  padding: 100px 0 80px;
  border-bottom: 1px solid var(--line);
}
.eyebrow{
  font-family:'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
  display:flex;
  align-items:center;
  gap: 10px;
  opacity: 0;
  animation: fadeUp 0.7s ease forwards;
}
.eyebrow::before{
  content:'';
  width: 8px; height: 8px;
  background: var(--highlight);
  border-radius: 50%;
  display:inline-block;
}
.hero-title{
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.05;
  max-width: 820px;
  overflow: hidden;
}
.hero-title .line{
  display:block;
  opacity: 0;
  transform: translateY(100%);
  animation: revealLine 0.7s cubic-bezier(.2,.7,.2,1) forwards;
}
.hero-title .line:nth-child(2){ animation-delay: 0.12s; }
.hero-title em{
  font-style: normal;
  color: var(--accent);
}
.hero p.lede{
  margin-top: 26px;
  max-width: 560px;
  font-size: 1.08rem;
  color: var(--muted);
  opacity: 0;
  animation: fadeUp 0.7s ease forwards;
  animation-delay: 0.3s;
}
.hero-cta{
  margin-top: 40px;
  display:flex;
  gap: 16px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.7s ease forwards;
  animation-delay: 0.42s;
}

@keyframes fadeUp{
  from{ opacity:0; transform: translateY(14px); }
  to{ opacity:1; transform: translateY(0); }
}
@keyframes revealLine{
  from{ opacity:0; transform: translateY(100%); }
  to{ opacity:1; transform: translateY(0); }
}

.btn{
  font-family:'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 13px 24px;
  border-radius: var(--radius);
  display:inline-block;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-primary{
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover{
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}
.btn-ghost{
  border: 1px solid var(--ink);
}
.btn-ghost:hover{
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-2px);
}

/* ---------- SECTION TITLES ---------- */
.section{
  padding: 90px 0;
  border-bottom: 1px solid var(--line);
}
.section-title{
  display:flex;
  align-items:baseline;
  gap: 16px;
  margin-bottom: 48px;
}
.section-title .num{
  font-family:'IBM Plex Mono', monospace;
  color: var(--muted);
  font-size: 0.85rem;
}
.section-title h2{
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

/* ---------- ABOUT ---------- */
.about-grid{
  display:grid;
  grid-template-columns: 220px 1fr;
  gap: 56px;
  align-items: start;
}
.avatar{
  width: 220px;
  height: 220px;
  border-radius: var(--radius);
  background: linear-gradient(155deg, var(--accent), #17191B);
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:'Space Grotesk', sans-serif;
  color: var(--paper);
  font-size: 3.4rem;
  font-weight: 700;
  user-select:none;
}
.about-text p{
  max-width: 620px;
  margin-bottom: 18px;
  color: var(--ink);
}
.about-text p.muted{ color: var(--muted); }

.tags{
  margin-top: 30px;
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag{
  font-family:'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ---------- WORK ---------- */
.work-list{
  position: relative;
}
.work-row{
  display:grid;
  grid-template-columns: 70px 1fr auto;
  align-items:center;
  gap: 20px;
  padding: 26px 10px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: padding-left 0.25s ease;
}
.work-row:last-child{ border-bottom: 1px solid var(--line); }
.work-row:hover{ padding-left: 22px; }
.work-row .year{
  font-family:'IBM Plex Mono', monospace;
  color: var(--muted);
  font-size: 0.85rem;
}
.work-row .title{
  font-family:'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
}
.work-row .cat{
  font-family:'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align:right;
}

.swatch-panel{
  position: fixed;
  top: 0; left: 0;
  width: 160px;
  height: 110px;
  pointer-events: none;
  border-radius: var(--radius);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 100;
  display:flex;
  align-items:flex-end;
  padding: 10px;
  font-family:'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: #fff;
}
.swatch-panel.active{
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---------- TESTIMONI ---------- */
.testi-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.testi-card{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  background: var(--paper-2);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.testi-card:hover{
  transform: translateY(-4px);
  border-color: var(--accent);
}
.testi-card p{
  font-size: 0.98rem;
  margin-bottom: 20px;
}
.testi-card .attrib{
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- CONTACT ---------- */
.contact{
  padding: 90px 0 60px;
}
.contact h2{
  font-size: clamp(2rem, 5vw, 3.2rem);
  max-width: 700px;
}
.contact p.muted{
  color: var(--muted);
  margin-top: 18px;
  max-width: 480px;
}
.contact-links{
  margin-top: 44px;
  display:flex;
  flex-wrap: wrap;
  gap: 14px;
}

footer{
  padding: 28px 0 40px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap: wrap;
  gap: 12px;
  font-family:'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

/* ---------- reveal on scroll ---------- */
.reveal{
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.in{
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; scroll-behavior: auto !important; animation: none !important; }
  .reveal{ opacity:1; transform:none; }
  .hero-title .line, .eyebrow, .hero p.lede, .hero-cta{ opacity:1; transform:none; }
}

@media (max-width: 860px){
  .testi-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 720px){
  nav{ padding: 16px 20px; flex-wrap: wrap; }
  .nav-links{ gap: 16px; font-size: 0.72rem; margin-left: 0; order: 3; width: 100%; }
  .about-grid{ grid-template-columns: 1fr; }
  .avatar{ width: 120px; height: 120px; font-size: 2rem; }
  .work-row{ grid-template-columns: 50px 1fr; }
  .work-row .cat{ display:none; }
  .swatch-panel{ display:none; }
}
