:root{
  --bg: #050713;
  --panel: rgba(255,255,255,.06);
  --panel-2: rgba(255,255,255,.09);
  --border: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.7);
  --faint: rgba(255,255,255,.55);
  --shadow: 0 18px 60px rgba(0,0,0,.55);

  --brand: #34495e;
  --brand-2: #51687d;
  --good: #34D399;

  --r: 18px;
  --r2: 14px;
  --container: 1100px;
  --header-h: 76px;
  --timeline-line: rgba(255,255,255,.10);
  --contact-link: rgba(169, 199, 224, .98);
  --secondary-btn-border: var(--border);
}
[data-theme="light"]{
  --bg: #f6f7fb;
  --panel: rgba(0,0,0,.04);
  --panel-2: rgba(0,0,0,.06);
  --border: rgba(0,0,0,.12);
  --text: rgba(0,0,0,.90);
  --muted: rgba(0,0,0,.62);
  --faint: rgba(0,0,0,.48);
  --shadow: 0 18px 60px rgba(0,0,0,.12);
  --timeline-line: #34495EB3;
  --contact-link: var(--brand);
  --secondary-btn-border: var(--brand);
}
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="search"],
[data-theme="light"] .contact-form textarea{
  background: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.12);
}
html{ scroll-padding-top: var(--header-h); }
*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  padding-top: var(--header-h);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a{ color: inherit; }
.container{ width: min(var(--container), calc(100% - 48px)); margin: 0 auto; }
.muted{ color: var(--muted); }
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
.skip-link{
  position: absolute;
  left: 12px; top: 12px;
  transform: translateY(-120%);
  padding: 10px 12px;
  border-radius: 12px;
  background: #111827;
  border: 1px solid var(--border);
  color: var(--text);
  z-index: 999;
}
.skip-link:focus{ transform: translateY(0); outline: none; box-shadow: 0 0 0 3px #34495E59; }

.site-header{
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.header-inner{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}
.brand{ display:flex; align-items:center; gap: 12px; min-width: 220px; }
.brand-mark{ width: 38px; height: 38px; border-radius: 14px; object-fit: contain; display:block; flex-shrink: 0; }
.brand-name{ font-weight: 700; letter-spacing: .2px; }
.brand-tag{ font-size: 13px; color: var(--muted); margin-top: 2px; }

.top-nav{ display:flex; align-items:center; gap: 10px; }
.nav-link{
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  border: 1px solid transparent;
}
.nav-link:hover{
  color: var(--text);
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
}

.theme-toggle{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 750;
}
.theme-toggle:hover{ color: var(--text); background: rgba(255,255,255,.04); }
.theme-toggle:focus{ outline:none; box-shadow: 0 0 0 3px #34495E47; }
.theme-toggle-track{
  width: 44px; height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--text);
  position: relative;
}
.theme-toggle-thumb{
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--bg);
  position:absolute;
  top: 50%; left: 3px;
  transform: translateY(-50%);
  transition: transform 160ms ease;
}
.theme-toggle[aria-checked="true"] .theme-toggle-thumb{ transform: translate(20px, -50%); }
.theme-toggle-label{ font-size: 13px; color: var(--muted); }
.theme-toggle:hover .theme-toggle-label{ color: var(--text); }

.hero{
  display:grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 44px 0 10px;
  align-items: start;
}
h1{ margin:0; font-size: clamp(30px, 3.2vw, 44px); line-height: 1.1; letter-spacing: -0.02em; }
.lead{ margin: 12px 0 0; color: var(--muted); max-width: 62ch; }
.hero-chips{ display:flex; flex-wrap:wrap; gap: 10px; margin-top: 16px; }
.chip{
  border-radius: 999px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  font-weight: 550;
}
.chip:hover{ border-color: #34495E8C; background: #34495E29; }
.card{
  border-radius: var(--r);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.pad{ padding: 18px; }

.hero-chat{ overflow: hidden; }
.chat-header{
  padding: 14px 14px 10px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.15);
}
.chat-actions{ display:flex; align-items:center; gap: 8px; }
.status-pill{ display:inline-flex; align-items:center; gap: 8px; font-weight: 650; font-size: 14px; color: var(--text); }
.dot{ width: 9px; height: 9px; border-radius: 999px; background: var(--good); box-shadow: 0 0 0 4px rgba(52,211,153,.14); }
.ghost-btn{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
}
.ghost-btn:hover{ background: var(--panel-2); }
.chat-log{ padding: 14px; display:flex; flex-direction: column; gap: 10px; height: 340px; overflow:auto; scroll-behavior:smooth; }
.msg{ display:flex; gap: 10px; align-items:flex-start; }
.msg.user{
  justify-content: flex-end;
  flex-direction: row-reverse;
}
.msg.user .avatar{ display:none; }
.msg.user .bubble{ margin-left: auto; }
.msg.bot .bubble{ margin-right: auto; }
.bubble{ width: fit-content; }
.avatar{
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  display:grid; place-items:center;
  color: var(--text);
  font-weight: 800;
  font-size: 12px;
}
.bubble{ padding: 10px 12px; border-radius: 16px; border: 1px solid rgba(255,255,255,.10); max-width: min(700px, 100%); }
.msg.user .bubble{ background: #34495E38; border-color: #34495E8C; }
.msg.bot .bubble{ background: rgba(255,255,255,.04); }
.msg.thinking .bubble{
  opacity: .9;
}
.thinking-dots{
  display:inline-flex;
  gap: 6px;
  align-items:center;
  height: 14px;
}
.thinking-dots span{
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
  animation: thinking-bounce 1s infinite ease-in-out;
}
.thinking-dots span:nth-child(2){ animation-delay: 120ms; }
.thinking-dots span:nth-child(3){ animation-delay: 240ms; }
@keyframes thinking-bounce{
  0%, 80%, 100%{ transform: translateY(0); opacity: .55; }
  40%{ transform: translateY(-4px); opacity: 1; }
}
.bubble p{ margin:0; color: var(--text); }
.bubble p + p{ margin-top: 10px; }
.bubble ul{ margin: 8px 0 0; padding-left: 18px; color: var(--text); }
.bubble a{ color: var(--contact-link); text-decoration:none; }
.bubble a:hover{ text-decoration: underline; }
.chat-input{ display:flex; gap: 10px; padding: 12px 14px 0; }
input[type="text"], input[type="email"], input[type="search"]{
  width: 100%;
  border-radius: 14px;
  padding: 12px 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  color: var(--text);
  outline:none;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="search"]:focus{
  border-color: #34495EB3;
  box-shadow: 0 0 0 3px #34495E47;
}
.primary-btn{
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: rgba(255,255,255,.95);
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.primary-btn:hover{ filter: brightness(1.06); }
.hint{ padding: 10px 14px 14px; color: var(--faint); font-size: 13px; }

.section{ padding: 36px 0 8px; }
.section-header{ display:flex; align-items:flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
h2{ margin:0; font-size: 22px; letter-spacing: -0.01em; }

.toolbar{ display:flex; align-items:center; gap: 12px; flex-wrap:wrap; margin-bottom: 14px; }
.filter{ min-width: min(520px, 100%); }
.tags{ display:flex; gap: 8px; flex-wrap: wrap; }
.tag{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor:pointer;
  font-weight: 650;
  font-size: 13px;
}
.tag[aria-pressed="true"]{
  border-color: #34495EF0;
  background: #34495E66;
  box-shadow: 0 10px 26px rgba(0,0,0,.35), 0 0 0 3px #34495E2E;
  transform: translateY(-1px);
}
.tag[aria-pressed="true"]:hover{
  background: #34495E7A;
}

.grid{ display:grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.project{
  grid-column: span 6;
  padding: 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
}
.project:hover{ border-color: #34495EA6; box-shadow: 0 16px 55px rgba(0,0,0,.25); }
.project h3{ margin:0; font-size: 17px; letter-spacing: -0.01em; }
.project .meta{ margin-top: 6px; display:flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.pill{
  display:inline-flex;
  gap: 6px;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}
.project .summary{ margin-top: 10px; color: var(--text); }
.project .tags{ margin-top: 10px; }
.project .tag{ cursor: default; }

.two-col{ display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
h3{ margin: 0 0 10px; font-size: 16px; letter-spacing: -0.01em; }
.bullets{ margin:0; padding-left: 18px; color: var(--text); }
.bullets li{ margin: 6px 0; }

.contact{ display:flex; align-items:center; justify-content:center; gap: 12px; flex-wrap:wrap; }
.contact-link{ color: var(--contact-link); text-decoration:none; font-weight: 750; }
.contact-link:hover{ text-decoration: underline; }
.sep{ color: var(--faint); }

.social-section{ margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.social-heading{ margin: 0 0 10px; font-size: 13px; font-weight: 750; letter-spacing: -0.01em; color: var(--text); }
.social-links{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.social-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.social-link:hover{
  background: var(--panel-2);
  border-color: #34495EB3;
  color: var(--contact-link);
  transform: translateY(-1px);
}
.social-link:focus{ outline: none; box-shadow: 0 0 0 3px #34495E47; }
.social-link svg{ width: 22px; height: 22px; flex-shrink: 0; }

.contact-form{ display: grid; gap: 14px; }
.contact-grid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field{ display: grid; gap: 8px; }
.field label{ font-weight: 750; color: var(--text); font-size: 13px; }
.contact-form textarea{
  width: 100%;
  border-radius: 14px;
  padding: 12px 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 120px;
}
.contact-form textarea:focus{
  border-color: #34495EB3;
  box-shadow: 0 0 0 3px #34495E47;
}
.contact-actions{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.site-footer{ margin-top: 28px; border-top: 1px solid rgba(255,255,255,.08); background: var(--bg); }
.footer-inner{ padding: 18px 0; display:flex; justify-content: space-between; gap: 12px; flex-wrap:wrap; }

/* project page */
.back-link{ display:inline-block; text-decoration:none; color: var(--contact-link); font-weight: 750; margin-bottom: 10px; }
.back-link:hover{ text-decoration: underline; }
.project-meta{ margin-top: 10px; }
.project-tag-row{ margin-top: 14px; display:flex; gap: 8px; flex-wrap:wrap; }
.hero-figure{ margin:0; border-radius: var(--r); overflow:hidden; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.02); box-shadow: var(--shadow); }
.hero-image{ display:block; width: 100%; height:auto; }
.artifact-gallery{ margin-top: 10px; display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.artifact-figure{ margin:0; border-radius: 16px; border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.02); padding: 12px; }
.artifact-caption{ font-weight: 800; color: var(--text); margin-bottom: 8px; }
.artifact-media{ display:block; border-radius: 14px; overflow:hidden; border: 1px solid rgba(255,255,255,.10); background: rgba(0,0,0,.18); }
.artifact-media img{ display:block; width: 100%; height:auto; }
.artifact-video{ position: relative; }
.artifact-video video{ display:block; width: 100%; height:auto; }
.artifact-play{
  appearance:none;
  position:absolute;
  left: 12px; bottom: 12px;
  width: 36px; height: 36px;
  border-radius: 999px;
  display:grid; place-items:center;
  color: var(--text);
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.artifact-play:focus{ outline:none; box-shadow: 0 0 0 3px #34495E47; }

.detail .kvs{ display:grid; grid-template-columns: 180px 1fr; gap: 10px 14px; margin-top: 12px; }
.kv-k{ color: var(--muted); font-weight: 650; }
.kv-v{ color: var(--text); }
.case-study{ margin-top: 16px; }
.case-study-section + .case-study-section{ margin-top: 24px; }
.case-study-section h4{ margin: 12px 0 6px; font-size: 14px; letter-spacing: -0.01em; color: var(--text); }
.case-study-section p{ margin: 0 0 10px; color: var(--text); max-width: 78ch; }

.link-btn{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--secondary-btn-border);
  text-decoration:none;
  font-weight: 750;
  color: var(--text);
}
.link-btn:hover{ background: rgba(255,255,255,.06); border-color: #34495EB3; }

.artifact-links{
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.artifact-list{
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 12px;
}
.artifact{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.02);
  padding: 12px;
}
.artifact a{
  color: var(--contact-link);
  text-decoration: none;
  font-weight: 750;
}
.artifact a:hover{ text-decoration: underline; }

.timeline-list{ list-style:none; padding: 6px 0; margin:0; display:grid; position: relative; }
.timeline-list::before{
  content:"";
  position:absolute;
  left: 13px;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--timeline-line);
}
.timeline-item{ display:grid; grid-template-columns: 28px 1fr; gap: 14px; align-items:start; padding-bottom: 14px; }
.timeline-rail{ width: 28px; display:grid; justify-items:center; }
.timeline-dot{
  width: 12px; height: 12px;
  border-radius: 999px;
  margin-top: 10px;
  background: #34495EE6;
  box-shadow: 0 0 0 4px #34495E33;
  border: 1px solid rgba(255,255,255,.16);
}
.timeline-content{ border-radius: 16px; border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.03); padding: 14px; }
.timeline-header{ display:flex; gap: 12px; align-items:flex-start; }
.timeline-logo{ width: 32px; height: 32px; max-width: 32px; object-fit: contain; }
.timeline-company{ margin-top: 2px; font-size: 13px; }
.timeline-bullets{ margin: 10px 0 0; padding-left: 18px; color: var(--text); }
.timeline-actions{ margin-top: 14px; display:flex; gap: 10px; flex-wrap:wrap; }

/* lightbox */
.lightbox{
  border: 0;
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  width: 100vw;
  height: 100vh;
  padding: 0;
}
.lightbox::backdrop{ background: rgba(0,0,0,.55); backdrop-filter: blur(8px); }
.lightbox-inner{
  padding: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.lightbox-topbar{ display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.lightbox-actions{ display:flex; align-items:center; gap: 8px; flex-wrap:wrap; }
.lightbox-close{
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 12px;
  cursor:pointer;
}
.lightbox-close:hover{ background: var(--panel-2); }
.lightbox-figure{
  margin: 0;
  padding-top: 10px;
  flex: 1 1 auto;
  min-height: 0;
  display:flex;
  flex-direction: column;
}
.lightbox-stage{
  flex: 1 1 auto;
  min-height: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:auto;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 12px;
  user-select:none;
  touch-action:none;
}
.lightbox-img, .lightbox-video{
  display:block;
  max-width: 100%;
  max-height: 100%;
  transform-origin: 0 0;
}
.lightbox-video{
  width: auto;
  height: auto;
}
.lightbox-caption{ margin-top: 10px; flex: 0 0 auto; }

@media (max-width: 980px){
  .top-nav{ display:none; }
  .project{ grid-column: span 12; }
  .two-col{ grid-template-columns: 1fr; }
  .artifact-gallery{ grid-template-columns: 1fr; }
  .contact-grid{ grid-template-columns: 1fr; }
}
