:root{
  --bg: #0F1416;
  --surface: #141B1D;
  --surface-raised: #182022;
  --line: #263030;
  --text: #E8EDEA;
  --text-dim: #8FA39B;
  --text-faint: #5C716B;
  --accent: #4FD1A5;
  --accent-dim: #2C6E56;
  --ease: cubic-bezier(.65,0,.35,1);
  --dur: 480ms;
  --sidebar-w: 300px;
}

*{ box-sizing: border-box; }

html, body{
  height: 100%;
  margin: 0;
}

body{
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; }

/* ============================================================
   LANGUAGE GATE — first-visit overlay
   ============================================================ */
#gate{
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 24px;
  z-index: 100;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

#gate.is-leaving{
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

.gate-eyebrow{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.gate-eyebrow::before{
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.gate-options{
  display: flex;
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
}

.lang-btn{
  appearance: none;
  border: none;
  background: var(--surface);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 17px;
  font-weight: 500;
  padding: 18px 30px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 128px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.lang-btn small{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 400;
  transition: color var(--dur) var(--ease);
}

.lang-btn:hover, .lang-btn:focus-visible{
  background: var(--accent);
  color: #06110D;
  outline: none;
}

.lang-btn:hover small, .lang-btn:focus-visible small{
  color: #06110D;
  opacity: 0.65;
}

.lang-btn:focus-visible{
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

@media (max-width: 520px){
  .gate-options{ flex-direction: column; }
  .lang-btn{ width: 100%; }
}

/* ============================================================
   APP SHELL — sidebar + content, revealed once a language is set
   ============================================================ */
#app{
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease);
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

#app.is-visible{
  opacity: 1;
  pointer-events: auto;
}

/* ---------- sidebar ---------- */
#sidebar{
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 40px 28px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.avatar{
  width: 112px;
  height: 112px;
  border: 1px dashed var(--line);
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}

.avatar svg{ width: 40px; height: 40px; }

.identity{ display: flex; flex-direction: column; gap: 6px; }

.identity h1{
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 22px;
  margin: 0;
}

.identity .title{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0;
}

.contact-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.contact-list li{
  display: flex;
  align-items: center;
  gap: 10px;
}

.contact-list svg{
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--text-faint);
}

.contact-list a:hover{ color: var(--text); }

/* ---------- sidebar nav ---------- */
.nav-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn{
  appearance: none;
  border: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  background: transparent;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.nav-btn::before{
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.nav-btn:hover, .nav-btn:focus-visible{
  color: var(--text);
  background: var(--surface-raised);
  outline: none;
}

.nav-btn[aria-current="true"]{
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--surface-raised);
}

/* ---------- sidebar footer: language switcher + copyright ---------- */
#sidebar-footer{
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#lang-switcher{
  display: flex;
  gap: 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
}

#lang-switcher button{
  appearance: none;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 0;
}

#lang-switcher button[aria-current="true"]{ color: var(--accent); }

#lang-switcher button:hover, #lang-switcher button:focus-visible{
  color: var(--text);
  outline: none;
}

.copyright{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.6;
  color: var(--text-faint);
  margin: 0;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#main{
  padding: 56px 56px 80px;
  max-width: 720px;
}

.view{ display: none; }
.view.is-active{ display: block; }

.view-eyebrow{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}

/* language blocks: only the active language's copy is shown */
.lang-block{ display: none; }
.lang-block.is-active{ display: block; }

/* ---------- CV sections ---------- */
.cv-section{
  margin-bottom: 44px;
}

.cv-section:last-child{ margin-bottom: 0; }

.cv-section h2{
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 20px;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.cv-section > p{
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0;
  max-width: 58ch;
}

.entry{
  margin-bottom: 24px;
}

.entry:last-child{ margin-bottom: 0; }

.entry-head{
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 6px;
}

.entry-title{
  font-weight: 600;
  font-size: 15px;
}

.entry-org{
  color: var(--text-dim);
  font-weight: 400;
}

.entry-dates{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

.entry ul{
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
}

.entry ul li{ margin-bottom: 4px; }

.tag-list{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-list li{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 5px 10px;
}

.skill-group{
  margin-bottom: 18px;
}

.skill-group:last-child{ margin-bottom: 0; }

.skill-group-label{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 10px;
}

/* ---------- Projects ---------- */
.project{
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.project:last-child{ border-bottom: none; }

.project h3{
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-weight: 600;
  font-size: 17px;
  margin: 0 0 8px;
}

.project p{
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0;
  max-width: 58ch;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px){
  #app{ grid-template-columns: 1fr; }
  #sidebar{
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 32px;
    padding: 24px;
  }
  .avatar{ width: 72px; height: 72px; }
  .nav-list{ flex-direction: row; flex: 1 1 100%; }
  .nav-btn{ width: auto; }
  #sidebar-footer{ margin-top: 0; flex: 1 1 100%; padding-top: 16px; }
  #main{ padding: 36px 24px 60px; }
}

@media (prefers-reduced-motion: reduce){
  :root{ --dur: 1ms; }
}
