/* =========================================================
   TOKENS
========================================================= */
:root {
  --bg: #10131A;
  --surface: #171B24;
  --surface-alt: #1B2029;
  --surface-raised: #1E2430;
  --border: #2A2F3D;
  --text: #EDEBE4;
  --text-muted: #9099AC;
  --text-dim: #6B7383;

  --blue: #5FA8D8;
  --blue-dim: #3D6E8F;
  --gold: #E3A73B;
  --gold-dim: #9C7429;
  --green: #4FD1A5;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --radius: 6px;
  --radius-sm: 4px;
  --max-width: 1120px;
  --transition: 200ms ease;
}

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

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

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

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, textarea { font: inherit; color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: var(--bg);
  padding: 10px 16px;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

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

/* =========================================================
   LAYOUT HELPERS
========================================================= */
.section {
  padding: 96px 24px;
}
.section--alt { background: var(--surface); }

.section__head {
  max-width: var(--max-width);
  margin: 0 auto 48px;
}
.section__tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  margin-bottom: 14px;
}
.section__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

/* =========================================================
   TABBAR NAV — signature element
========================================================= */
.tabbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  height: 64px;
  background: rgba(16, 19, 26, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.tabbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.tabbar__mark {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--bg);
  background: var(--gold);
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.tabbar__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.tabbar__tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar__tabs::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-bottom: none;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}
.tab__type { color: var(--text-dim); }
.tab:hover { color: var(--text); background: var(--surface-alt); }
.tab.is-active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.tab.is-active .tab__type { color: var(--gold); }

.tabbar__toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}
.tabbar__toggle span {
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* =========================================================
   HERO
========================================================= */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 160px 24px 96px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 18px;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 4.2vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}
.hero__accent { font-style: italic; }
.hero__accent--blue { color: var(--blue); }
.hero__accent--gold { color: var(--gold); }

.hero__lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin-bottom: 36px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
  border: 1px solid transparent;
}
.btn--primary { background: var(--gold); color: #14171F; }
.btn--primary:hover { transform: translateY(-1px); background: #EEB854; }
.btn--ghost { border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn--text { color: var(--text-muted); padding: 13px 4px; }
.btn--text:hover { color: var(--text); }

.hero__panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.hero__panel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot--blue { background: var(--blue); }
.dot--gold { background: var(--gold); }
.dot--green { background: var(--green); }
.hero__panel-title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
}
.hero__code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 22px;
  color: var(--text-muted);
  overflow-x: auto;
  line-height: 1.9;
}
.code-key { color: var(--blue); }
.code-str { color: var(--gold); }

/* =========================================================
   ABOUT
========================================================= */
.about__grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
}
.about__photo {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface-raised), var(--surface));
}
.about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about__photo-placeholder {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface-raised), var(--surface));
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--text-dim);
}
.about__body p {
  color: var(--text-muted);
  margin-bottom: 18px;
  max-width: 62ch;
}
.about__body strong { color: var(--text); }

.about__stats {
  display: flex;
  gap: 40px;
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.stat__num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold);
  font-weight: 600;
}
.stat__label {
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* =========================================================
   SKILLS
========================================================= */
.skills__grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.skillpane {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-raised);
}
.skillpane__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.skillpane__bar--office { justify-content: flex-start; }
.skillpane__title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-left: 6px;
}
.skillpane__bar--office .skillpane__title { margin-left: 0; color: var(--gold); }

.skillpane__body { padding: 20px; }

.skillpane--extra { grid-column: 1 / -1; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tagchip {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}
.tagchip:hover { border-color: var(--blue); color: var(--text); }

.skilllist { display: flex; flex-direction: column; gap: 16px; }
.skillitem {
  display: grid;
  grid-template-columns: 20px 1fr 90px;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}
.skillitem__prompt { color: var(--blue); font-family: var(--font-mono); }
.skillitem__icon {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  background: var(--gold-dim);
  color: #14171F;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 3px;
}
.skillitem__name { color: var(--text-muted); }
.bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.bar__fill { display: block; height: 100%; background: var(--blue); border-radius: 2px; }
.bar__fill--gold { background: var(--gold); }

/* =========================================================
   PROJECTS
========================================================= */
.filterbar {
  max-width: var(--max-width);
  margin: 0 auto 32px;
  display: flex;
  gap: 8px;
}
.filter {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.filter[aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.project-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface-raised);
  transition: border-color var(--transition), transform var(--transition);
  opacity: 0;
  transform: translateY(12px);
}
.project-card.is-visible { opacity: 1; transform: translateY(0); }
.project-card:hover { border-color: var(--blue-dim); }

.project-card__kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  display: block;
}
.project-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin-bottom: 10px;
}
.project-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
}
.project-card__links { display: flex; gap: 16px; }
.project-card__links a {
  font-size: 0.82rem;
  color: var(--blue);
  border-bottom: 1px solid transparent;
}
.project-card__links a:hover { border-color: var(--blue); }

/* =========================================================
   EXPERIENCE / TIMELINE
========================================================= */
.timeline {
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
  padding-left: 28px;
  border-left: 1px solid var(--border);
}
.timeline__item { position: relative; padding-bottom: 40px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 4px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg);
}
.timeline__date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}
.timeline__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 6px 0 8px;
}
.timeline__desc { color: var(--text-muted); max-width: 60ch; font-size: 0.92rem; }

/* =========================================================
   SERVICES
========================================================= */
.services__grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.service {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
}
.service__mark {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.service__mark--blue { background: rgba(95,168,216,0.15); color: var(--blue); }
.service__mark--gold { background: rgba(227,167,59,0.15); color: var(--gold); }
.service h3 { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 8px; }
.service p { color: var(--text-muted); font-size: 0.88rem; }

/* =========================================================
   TESTIMONIALS (empty state)
========================================================= */
.empty-state {
  max-width: var(--max-width);
  margin: 0 auto;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
}
.empty-state__title { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 10px; }
.empty-state__body { color: var(--text-muted); max-width: 50ch; margin: 0 auto; font-size: 0.92rem; }

/* =========================================================
   CONTACT
========================================================= */
.contact__grid {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 56px;
}
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.field input, .field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color var(--transition);
}
.field input:focus, .field textarea:focus {
  border-color: var(--blue);
  outline: none;
}
.form-status {
  margin-top: 14px;
  font-size: 0.88rem;
  min-height: 1.2em;
}
.form-status.is-success { color: var(--green); }
.form-status.is-error { color: #E56B6F; }

.contact-side__lede { color: var(--text-muted); margin-bottom: 24px; max-width: 40ch; }
.social-list { display: flex; flex-direction: column; gap: 4px; }
.social-list a {
  display: inline-block;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  transition: color var(--transition);
}
.social-list a:hover { color: var(--gold); }

/* =========================================================
   FOOTER
========================================================= */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 12px;
}
.footer__links { display: flex; gap: 20px; }
.footer__links a:hover { color: var(--text); }

/* =========================================================
   SCROLL REVEAL
========================================================= */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* =========================================================
   AI CHAT WIDGET
========================================================= */
.chatwidget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
}

.chatwidget__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gold);
  color: #14171F;
  padding: 14px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transition: transform var(--transition);
}
.chatwidget__toggle:hover { transform: translateY(-2px); }
.chatwidget__toggle-icon { font-family: var(--font-mono); }

.chatwidget__panel {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 48px);
  height: 460px;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.chatwidget__panel[hidden] { display: none; }

.chatwidget__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chatwidget__title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-left: 6px;
}
.chatwidget__close {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 2px 6px;
}
.chatwidget__close:hover { color: var(--text); }

.chatwidget__messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatmsg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  line-height: 1.5;
}
.chatmsg--bot {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text-muted);
}
.chatmsg--user {
  background: var(--gold);
  color: #14171F;
  align-self: flex-end;
}
.chatmsg--typing { font-family: var(--font-mono); color: var(--text-dim); font-style: italic; }

.chatwidget__form {
  display: flex;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chatwidget__form input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 14px;
  color: var(--text);
  font-size: 0.87rem;
}
.chatwidget__form input:focus { outline: none; }
.chatwidget__form input:disabled { opacity: 0.5; }
.chatwidget__form button {
  padding: 0 18px;
  color: var(--blue);
  font-weight: 700;
  font-size: 1.1rem;
  transition: color var(--transition);
}
.chatwidget__form button:hover { color: var(--text); }

@media (max-width: 480px) {
  .chatwidget { right: 16px; bottom: 16px; }
  .chatwidget__panel {
    width: calc(100vw - 32px);
    right: -8px;
    height: 380px;
    max-height: 60vh;
  }
  .chatwidget__toggle { padding: 12px 18px; font-size: 0.85rem; }
}


/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 140px; }
  .about__grid { grid-template-columns: 1fr; }
  .about__photo { max-width: 160px; }
  .skills__grid { grid-template-columns: 1fr; }
  .contact__grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 720px) {
  .tabbar__tabs {
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    display: none;
  }
  .tabbar__tabs.is-open { display: flex; }
  .tab { border-radius: var(--radius-sm); border: 1px solid transparent; padding: 12px; }
  .tab.is-active { border-color: var(--border); }
  .tabbar__toggle { display: flex; }
  .about__stats { flex-wrap: wrap; gap: 24px; }
  .section { padding: 64px 20px; }
}
