:root{
  --bg: #0b0f14;
  --panel: rgba(255,255,255,0.04);
  --panel2: rgba(255,255,255,0.06);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --faint: rgba(255,255,255,0.45);
  --line: rgba(255,255,255,0.12);
  --accent: #f3c969;     /* gold-ish */
  --accent2: #e9b84b;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,0.35);
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  background: radial-gradient(1200px 600px at 20% -10%, rgba(243,201,105,0.08), transparent 55%),
              radial-gradient(1200px 600px at 90% 0%, rgba(243,201,105,0.06), transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

a{ color: inherit; }
code{ color: var(--accent); }

.container{
  max-width: 1080px;
  margin: 0 auto;
  padding: 120px 22px 60px;
}

/* Topbar */
.topbar{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 84px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 22px;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(11,15,20,0.9), rgba(11,15,20,0.65));
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 30;
}

.logo{
  width: 44px;
  height: 44px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  display:grid;
  place-items:center;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.nav{
  display:flex;
  gap: 20px;
  align-items:center;
  font-size: 14px;
}
.nav a{
  text-decoration:none;
  color: var(--muted);
}
.nav a:hover{ color: var(--text); }
.num{ color: var(--accent); margin-right: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  text-decoration:none;
  cursor:pointer;
}
.btn-primary{
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.btn-primary:hover{
  background: rgba(243,201,105,0.08);
}
.btn-outline{
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
}
.btn-outline:hover{ background: rgba(243,201,105,0.08); }

/* Rails */
.rail{
  position: fixed;
  bottom: 0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 14px;
  z-index: 25;
}
.rail-left{ left: 24px; }
.rail-right{ right: 24px; }

.rail-line{
  width: 1px;
  height: 120px;
  background: rgba(255,255,255,0.18);
  margin-top: 10px;
}

.icon{
  width: 28px;
  height: 28px;
  display:grid;
  place-items:center;
  opacity: 0.75;
}
.icon:hover{ opacity: 1; transform: translateY(-2px); }
.icon svg{ width: 22px; height: 22px; fill: rgba(255,255,255,0.75); }
.icon:hover svg{ fill: var(--accent); }

.email-vertical{
  writing-mode: vertical-rl;
  text-decoration:none;
  letter-spacing: 0.6px;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}
.email-vertical:hover{ color: var(--accent); transform: translateY(-2px); }

/* Hero */
.hero{
  padding-top: 6px;
  min-height: 72vh;
  display:flex;
  flex-direction:column;
  justify-content:center;
}
.kicker{
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 0 0 14px;
}
.headline{
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 7vw, 78px);
  line-height: 1.03;
  margin: 0 0 18px;
}
.headline-muted{
  color: rgba(255,255,255,0.35);
}
.dot{ color: var(--accent); }
.lede{
  color: var(--muted);
  max-width: 62ch;
  font-size: 16px;
  margin: 0 0 28px;
}

/* Sections */
.section{
  padding: 70px 0 0;
}
.section-title{
  display:flex;
  align-items:center;
  gap: 12px;
  font-size: 22px;
  margin: 0 0 26px;
}
.section-title::after{
  content:"";
  height: 1px;
  flex: 1;
  background: rgba(255,255,255,0.12);
  max-width: 360px;
}
.muted{ color: var(--muted); }

/* About */
.about-grid{
  display:grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 36px;
}
.bullets{
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}
.bullets li{ margin: 8px 0; }

.portrait-frame{
  border-radius: var(--radius);
  border: 1px solid rgba(243,201,105,0.35);
  padding: 10px;
  background: rgba(255,255,255,0.02);
  box-shadow: var(--shadow);
}
.portrait img{
  width: 100%;
  border-radius: 12px;
  display:block;
  filter: grayscale(60%) contrast(1.05);
}
.portrait-fallback{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  display:grid;
  place-items:center;
  color: rgba(255,255,255,0.55);
  border: 1px dashed rgba(255,255,255,0.18);
}

/* Tabs (Experience) */
.tabs{
  display:grid;
  grid-template-columns: 240px 1fr;
  gap: 26px;
}
.tablist{
  border-left: 1px solid rgba(255,255,255,0.12);
  padding-left: 10px;
}
.tab{
  width: 100%;
  text-align:left;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  padding: 12px 10px;
  cursor:pointer;
  border-left: 2px solid transparent;
  margin-left: -12px;
}
.tab:hover{ color: var(--text); }
.tab.active{
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(243,201,105,0.06);
}
.panel{ display:none; }
.panel.active{ display:block; }
.accent{ color: var(--accent); }

/* Featured project */
.featured{
  display:grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  align-items:center;
  margin-top: 14px;
}
.featured-media{
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.10);
  min-height: 280px;
  box-shadow: var(--shadow);
  overflow:hidden;
  position: relative;
}
.featured-img-fallback{
  height: 100%;
  display:grid;
  place-items:center;
  color: rgba(255,255,255,0.6);
  padding: 18px;
}
.featured-card{
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.featured-label{
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 0 0 8px;
  font-size: 12px;
}
.featured-title{
  font-size: 26px;
  margin: 0 0 10px;
}
.featured-desc{
  color: var(--muted);
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 12px;
  border-radius: 12px;
}
.tech{
  color: rgba(255,255,255,0.65);
  margin: 12px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.tech.small{ font-size: 11px; }
.links{
  display:flex;
  gap: 10px;
  align-items:center;
  margin-top: 14px;
}
.icon-link svg{ width: 20px; height: 20px; fill: rgba(255,255,255,0.75); }
.icon-link:hover svg{ fill: var(--accent); }

/* Project grid */
.subhead{
  margin: 50px 0 18px;
  text-align:center;
  color: rgba(255,255,255,0.85);
}
.grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.card{
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:hover{
  transform: translateY(-5px);
  border-color: rgba(243,201,105,0.35);
}
.card-top{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.folder{
  width: 18px; height: 14px;
  border: 1px solid rgba(243,201,105,0.6);
  border-radius: 3px;
  position: relative;
}
.folder::before{
  content:"";
  position:absolute;
  top:-6px; left:0;
  width: 10px; height: 6px;
  border: 1px solid rgba(243,201,105,0.6);
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  background: transparent;
}
.card h4{ margin: 10px 0 8px; font-size: 18px; }
.card p{ margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.card-icons a{ text-decoration:none; color: var(--faint); }
.card-icons a:hover{ color: var(--accent); }

.hidden{ display:none; }
.center{ display:flex; justify-content:center; margin-top: 26px; }

/* Contact */
.contact{
  text-align:center;
  padding-bottom: 40px;
}
.contact-title{
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: 54px;
  margin: 10px 0 12px;
}
.footer{
  margin-top: 36px;
  text-align:center;
  color: rgba(255,255,255,0.45);
}

/* Mobile */
.hamburger{
  display:none;
  background: transparent;
  border: 1px solid rgba(243,201,105,0.4);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  cursor:pointer;
}
.hamburger span{
  display:block;
  height: 2px;
  width: 22px;
  background: rgba(255,255,255,0.75);
  margin: 5px auto;
}

.mobile-menu{
  position: fixed;
  top: 84px;
  right: 16px;
  left: 16px;
  background: rgba(11,15,20,0.95);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 14px;
  z-index: 40;
  box-shadow: var(--shadow);
}
.mobile-menu a{
  display:block;
  padding: 10px 8px;
  text-decoration:none;
  color: rgba(255,255,255,0.8);
}
.mobile-menu a:hover{ color: var(--accent); }

@media (max-width: 980px){
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .featured{ grid-template-columns: 1fr; }
  .about-grid{ grid-template-columns: 1fr; }
  .tabs{ grid-template-columns: 1fr; }
  .tablist{ display:flex; gap: 10px; overflow:auto; border-left:none; padding-left:0; }
  .tab{ border-left:none; border-bottom: 2px solid transparent; margin-left:0; white-space:nowrap; }
  .tab.active{ border-bottom-color: var(--accent); }
}

@media (max-width: 760px){
  .nav{ display:none; }
  .hamburger{ display:inline-block; }
  .rail-left, .rail-right{ display:none; }
  .container{ padding-top: 110px; }
  .grid{ grid-template-columns: 1fr; }
  .contact-title{ font-size: 44px; }
}

/* ===== Intro overlay ===== */
.intro{
  position: fixed;
  inset: 0;
  z-index: 999;
  background: radial-gradient(900px 500px at 20% 10%, rgba(243,201,105,0.10), transparent 55%),
              rgba(11,15,20,0.96);
  display: grid;
  place-items: center;
  transition: opacity 450ms ease, visibility 450ms ease;
}

.intro.hidden{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-box{
  width: min(860px, calc(100% - 40px));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 20px 70px rgba(0,0,0,0.45);
  padding: 18px 18px 16px;
  position: relative;
}

.intro-badge{
  width: 56px;
  height: 56px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.intro-text{
  margin: 0;
  min-height: 190px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 14px;
  color: rgba(255,255,255,0.78);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.intro-cursor{
  width: 10px;
  height: 18px;
  background: var(--accent);
  display: inline-block;
  margin-left: 6px;
  animation: blink 1s steps(1) infinite;
  vertical-align: text-bottom;
}

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

.intro-skip{
  position: absolute;
  top: 18px;
  right: 18px;
  border: 1px solid rgba(243,201,105,0.5);
  background: transparent;
  color: var(--accent);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.intro-skip:hover{ background: rgba(243,201,105,0.08); }

/* ===== Sequential reveal after intro ===== */
.stagger .kicker,
.stagger .headline,
.stagger .lede,
.stagger .btn{
  opacity: 0;
  transform: translateY(10px);
}

body.loaded .stagger .kicker{ animation: fadeUp 550ms ease forwards; animation-delay: 120ms; }
body.loaded .stagger .headline{ animation: fadeUp 650ms ease forwards; animation-delay: 220ms; }
body.loaded .stagger .lede{ animation: fadeUp 650ms ease forwards; animation-delay: 360ms; }
body.loaded .stagger .btn{ animation: fadeUp 650ms ease forwards; animation-delay: 520ms; }

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

/* ===== Scroll reveal for sections ===== */
.reveal{
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.reveal.show{
  opacity: 1;
  transform: translateY(0);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .intro, .intro *{ animation: none !important; transition: none !important; }
  .reveal{ opacity: 1; transform: none; }
  .stagger .kicker, .stagger .headline, .stagger .lede, .stagger .btn{
    opacity: 1; transform: none;
  }
}

/* ===== Intro overlay (Option B: equation morph) ===== */
.intro{
  position: fixed;
  inset: 0;
  z-index: 999;
  background: radial-gradient(900px 500px at 25% 10%, rgba(243,201,105,0.10), transparent 60%),
              radial-gradient(900px 500px at 80% 0%, rgba(243,201,105,0.06), transparent 55%),
              rgba(11,15,20,0.96);
  display: grid;
  place-items: center;
  transition: opacity 450ms ease, visibility 450ms ease;
}

.intro.hidden{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-skip{
  position: absolute;
  top: 18px;
  right: 18px;
  border: 1px solid rgba(243,201,105,0.5);
  background: transparent;
  color: var(--accent);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.intro-skip:hover{ background: rgba(243,201,105,0.08); }

.morph-wrap{
  width: min(860px, calc(100% - 40px));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 20px 70px rgba(0,0,0,0.45);
  padding: 22px 20px 18px;
}

.morph-kicker{
  color: rgba(255,255,255,0.65);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  margin-bottom: 14px;
}

.morph-main{
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.morph-text{
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(54px, 8vw, 92px);
  line-height: 1.0;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 20px 70px rgba(0,0,0,0.45);
  transition: transform 380ms ease, filter 380ms ease, opacity 380ms ease;
}

.morph-cursor{
  width: 10px;
  height: 22px;
  background: var(--accent);
  display: inline-block;
  animation: blink 1s steps(1) infinite;
  transform: translateY(-6px);
}
@keyframes blink{ 50%{ opacity: 0; } }

.morph-sub{
  margin-top: 10px;
  color: rgba(255,255,255,0.65);
  font-size: 14px;
}
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: rgba(243,201,105,0.92);
}

.morph-bar{
  margin-top: 14px;
  height: 1px;
  background: linear-gradient(90deg, rgba(243,201,105,0.0), rgba(243,201,105,0.55), rgba(243,201,105,0.0));
  opacity: 0.9;
}

/* Morph effect helpers (JS toggles these) */
.morph-out{
  opacity: 0;
  transform: translateY(6px) scale(0.985);
  filter: blur(6px);
}

.morph-in{
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* ===== Sequential reveal after intro (keep this) ===== */
.stagger .kicker,
.stagger .headline,
.stagger .lede,
.stagger .btn{
  opacity: 0;
  transform: translateY(10px);
}

body.loaded .stagger .kicker{ animation: fadeUp 550ms ease forwards; animation-delay: 120ms; }
body.loaded .stagger .headline{ animation: fadeUp 650ms ease forwards; animation-delay: 220ms; }
body.loaded .stagger .lede{ animation: fadeUp 650ms ease forwards; animation-delay: 360ms; }
body.loaded .stagger .btn{ animation: fadeUp 650ms ease forwards; animation-delay: 520ms; }

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

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .intro, .intro *{ animation: none !important; transition: none !important; }
  .morph-text{ filter:none !important; transform:none !important; opacity:1 !important; }
  .stagger .kicker, .stagger .headline, .stagger .lede, .stagger .btn{
    opacity: 1; transform: none;
  }
}


/* Intro scramble helper */
.dud{opacity:0.35;}

/* Make intro text read like sentences (not giant symbols) */
.intro.intro-scramble .morph-main{
  font-size: clamp(26px, 4vw, 46px);
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.intro.intro-scramble .morph-sub{
  font-size: 16px;
  opacity: 0.9;
}
