:root {
  --paper: #f3efe6;
  --surface: #fffdf8;
  --ink: #062f35;
  --muted: #52676a;
  --line: #b8c2b9;
  --accent: #42aa84;
  --accent-soft: #d9eee5;
  --dark: #062f35;
  --serif: Cambria, Georgia, "Times New Roman", serif;
  --sans: Aptos, "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #071c20;
  --surface: #0c282d;
  --ink: #edf8f3;
  --muted: #abc0bb;
  --line: #385257;
  --accent: #59c99d;
  --accent-soft: #123d36;
  --dark: #edf8f3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .25em; }
button, input, textarea { font: inherit; }
button { color: inherit; touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

[data-language="vi"] [data-lang="en"],
[data-language="en"] [data-lang="vi"] { display: none !important; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--ink); color: var(--paper); padding: .7rem 1rem; }
.skip-link:focus { top: 1rem; }
.shell { width: min(1324px, calc(100% - 2rem)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent); background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(16px); }
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { font-size: 1.05rem; font-weight: 850; text-decoration: none; letter-spacing: -.04em; }
.brand::after { content: "."; color: var(--accent); }
.nav { display: flex; align-items: center; gap: 2rem; }
.nav a { text-decoration: none; font-size: .92rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }
.header-tools { display: flex; align-items: center; gap: .5rem; }
.text-button, .menu-button { border: 0; background: transparent; cursor: pointer; padding: .5rem; font-size: .82rem; }
.text-button:hover, .menu-button:hover { color: var(--accent); }
.menu-button { display: none; }

.eyebrow { margin: 0 0 .7rem; font-size: .76rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.display { margin: 0; font: 700 clamp(4rem, 10vw, 8.5rem)/.82 var(--serif); letter-spacing: -.075em; }
.display .dot { color: var(--accent); }
.page-title { margin: 0; max-width: 960px; font: 700 clamp(3rem, 6.5vw, 6.2rem)/.94 var(--serif); letter-spacing: -.035em; }
.section-title { margin: 0; font: 700 clamp(2.2rem, 5vw, 4.5rem)/1 var(--serif); letter-spacing: -.04em; }
.lede { max-width: 760px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.3rem); }
.display, .page-title, .section-title, .headline, .card-title, .blog-card h2 { text-wrap: balance; }
p, li { text-wrap: pretty; }

.hero { padding: 0 0 6rem; }
.hero-visual { position: relative; min-height: min(560px, 62vw); background: #09242a; overflow: hidden; }
.hero-visual > img { width: 100%; height: min(560px, 62vw); object-fit: cover; }
.hero-stamp { position: absolute; top: 2rem; left: 2.6rem; color: white; text-shadow: 0 1px 15px rgba(0,0,0,.4); }
.hero-location { position: absolute; top: 2rem; right: 2.6rem; color: white; }
.hero-intro { display: grid; grid-template-columns: minmax(250px, .8fr) 1.7fr; gap: clamp(3rem, 8vw, 8rem); align-items: end; margin-top: -12rem; padding-inline: 2.6rem; position: relative; }
.portrait-wrap { align-self: start; }
.portrait { aspect-ratio: .72; width: min(340px, 100%); object-fit: cover; object-position: center top; background: white; border: .7rem solid var(--surface); border-radius: 46% 46% .4rem .4rem; box-shadow: 0 1.8rem 4rem rgba(5, 37, 39, .16); }
.portrait-caption { margin-top: .7rem; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.intro-copy { padding: 15rem 0 0; }
.headline { margin: 1.7rem 0 .8rem; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.045em; line-height: 1.1; }
.actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.2rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: .65rem 1.35rem; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); text-decoration: none; font-weight: 750; transition: transform .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease; }
.button:hover { background: var(--accent); border-color: var(--accent); color: #041b1f; }
.button:active { transform: translateY(1px) scale(.99); }
.button-secondary { background: transparent; color: var(--ink); border-color: var(--line); }

.section { padding: 6rem 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2.5rem; }
.section-head p { max-width: 550px; color: var(--muted); margin: 0; }
.grid { display: grid; gap: 1.25rem; }
.project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-card { min-width: 0; }
.project-card a { display: block; text-decoration: none; }
.card-image { aspect-ratio: 1.32; width: 100%; object-fit: cover; background: var(--surface); filter: saturate(.88); transition: transform .25s ease, filter .25s ease; }
.project-card a:hover .card-image { transform: translateY(-4px); filter: saturate(1.08); }
.card-meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1rem; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; }
.card-title { margin: .3rem 0 .4rem; font: 700 1.6rem/1.1 var(--serif); letter-spacing: -.025em; }
.card-copy { margin: 0; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.tag { display: inline-flex; padding: .25rem .65rem; border: 1px solid var(--line); border-radius: 999px; font-size: .73rem; }

.page-hero { padding: clamp(5rem, 10vw, 9rem) 0 4rem; }
.page-hero .lede { margin-top: 1.7rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 2.5rem; }
.search { flex: 1 1 280px; min-height: 48px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .7rem 1rem; }
.search:focus-visible { border-color: var(--accent); }
.filter { min-height: 44px; padding: .55rem .9rem; border: 1px solid var(--line); background: transparent; cursor: pointer; transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease; }
.filter.is-active, .filter:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filter:active { transform: translateY(1px); }
.empty { padding: 3rem; border: 1px dashed var(--line); text-align: center; color: var(--muted); }

.case-hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 3rem; align-items: center; padding: 5rem 0; }
.case-hero img { aspect-ratio: 1.25; width: 100%; object-fit: cover; }
.case-meta { color: var(--muted); }
.case-sections { max-width: 920px; margin-inline: auto; }
.case-section { display: grid; grid-template-columns: 170px 1fr; gap: 2rem; padding: 3rem 0; border-top: 1px solid var(--line); }
.case-section h2 { margin: 0; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.case-section p { margin: 0; font-size: 1.16rem; }

.blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.blog-card { display: grid; grid-template-columns: 180px 1fr; gap: 1.2rem; padding: 1rem; background: var(--surface); border: 1px solid transparent; }
.blog-card:hover { border-color: var(--line); }
.blog-card img { width: 100%; height: 100%; min-height: 180px; object-fit: cover; }
.blog-card > a:first-child { min-height: 180px; }
.blog-card a { text-decoration: none; }
.blog-card h2 { font: 700 1.55rem/1.16 var(--serif); margin: .4rem 0 .6rem; }
.article-cover { height: 100%; min-height: 180px; padding: 1.25rem; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; background: linear-gradient(145deg, #0d3d42, #17636a); color: #f6f2e9; }
.article-cover::after { content: ''; position: absolute; width: 170px; height: 170px; right: -45px; bottom: -70px; border: 1px solid color-mix(in srgb, currentColor 34%, transparent); border-radius: 50%; box-shadow: 0 0 0 26px color-mix(in srgb, currentColor 8%, transparent), 0 0 0 58px color-mix(in srgb, currentColor 5%, transparent); }
.article-cover span { position: relative; z-index: 1; font: 700 .72rem/1.2 var(--sans); letter-spacing: .13em; text-transform: uppercase; opacity: .78; }
.article-cover strong { position: relative; z-index: 1; max-width: 11ch; font: 700 1.7rem/1 var(--serif); text-transform: capitalize; }
.article-cover-rag, .article-cover-vector-search { background: linear-gradient(145deg, #4b224f, #a44b6f); }
.article-cover-agent-systems, .article-cover-architecture { background: linear-gradient(145deg, #153463, #2d73a5); }
.article-cover-ai-safety, .article-cover-security { background: linear-gradient(145deg, #552118, #b85c2d); }
.article-cover-development, .article-cover-product { background: linear-gradient(145deg, #32451d, #78934a); }
.article-cover-hero { min-height: 360px; margin-bottom: 2rem; padding: 2rem; }
.article-cover-hero strong { font-size: clamp(2.4rem, 7vw, 5.5rem); max-width: 8ch; }
.source-note { margin: 0 0 2.5rem; padding: .9rem 1rem; border-left: 3px solid var(--accent); background: var(--surface); color: var(--muted); }
.library-summary { display: flex; align-items: baseline; gap: .7rem; margin-bottom: 1.5rem; color: var(--muted); }
.library-summary strong { font: 700 2.6rem/1 var(--serif); color: var(--ink); }
.article { max-width: 820px; margin-inline: auto; padding: 2rem 0 7rem; }
.article-hero { width: 100%; max-height: 560px; object-fit: cover; margin-bottom: 3rem; }
.prose { font-size: 1.08rem; }
.prose h2 { margin: 2.6rem 0 .7rem; font: 700 2rem/1.15 var(--serif); }
.prose p, .prose ul { color: var(--muted); }
.prose strong { color: var(--ink); }

.about-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(3rem, 8vw, 8rem); align-items: start; }
.about-grid .portrait { width: 100%; }
.focus-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin-top: 2rem; }
.focus-item { padding: 1rem; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.note { padding: 1.2rem 1.4rem; background: var(--accent-soft); border-left: 4px solid var(--accent); }

.contact-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: clamp(2.5rem, 7vw, 7rem); align-items: start; }
.contact-panel { padding: clamp(1.5rem, 4vw, 3.5rem); background: var(--surface); border-top: 4px solid var(--accent); }
.contact-panel .section-title { max-width: 14ch; margin-bottom: 2rem; }
.contact-form { display: grid; gap: 1.25rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-field { display: grid; gap: .5rem; }
.form-field label { font-size: .83rem; font-weight: 800; letter-spacing: .05em; }
.form-field input, .form-field textarea { width: 100%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); padding: .85rem 1rem; border-radius: 0; }
.form-field input { min-height: 52px; }
.form-field textarea { resize: vertical; min-height: 170px; }
.form-field input:focus-visible, .form-field textarea:focus-visible { border-color: var(--accent); outline: 3px solid color-mix(in srgb, var(--accent) 22%, transparent); outline-offset: 1px; }
.form-footer { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.form-status { flex: 1 1 260px; margin: 0; color: var(--muted); }
.form-status.is-success { color: var(--accent); font-weight: 700; }
.form-status.is-error { color: #a23c2c; font-weight: 700; }
.form-privacy { margin: 0; color: var(--muted); font-size: .85rem; }
.contact-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }
.contact-aside { padding-top: 1rem; }
.contact-aside h2 { margin: .2rem 0 .7rem; font: 700 2.6rem/1 var(--serif); }
.contact-aside > p:not(.eyebrow) { color: var(--muted); }
.contact-topics { margin-top: 3rem; }
.contact-topics ul { margin: 1.25rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.contact-topics li { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.policy { max-width: 850px; }
.policy section { padding: 2.2rem 0; border-top: 1px solid var(--line); }
.policy h2 { margin: 0 0 .7rem; font: 700 1.7rem/1.15 var(--serif); }
.policy p { margin: 0; color: var(--muted); }

.site-footer { padding: 3rem 0; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 2rem; color: var(--muted); font-size: .88rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }

@media (max-width: 900px) {
  .menu-button { display: inline-flex; }
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; padding: 1.2rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line); flex-direction: column; align-items: flex-start; gap: 1rem; }
  .nav.is-open { display: flex; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-intro { grid-template-columns: 230px 1fr; gap: 2.5rem; margin-top: -7rem; }
  .intro-copy { padding-top: 10rem; }
  .case-hero, .contact-layout { grid-template-columns: 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .shell { width: min(100% - 1.2rem, 1324px); }
  .header-inner { min-height: 62px; }
  .header-tools { gap: .1rem; }
  .hero { padding-bottom: 3rem; }
  .hero-visual, .hero-visual > img { min-height: 360px; height: 55vh; }
  .hero-stamp, .hero-location { top: 1rem; }
  .hero-stamp { left: 1rem; }
  .hero-location { right: 1rem; }
  .hero-intro { grid-template-columns: 1fr; margin-top: -7rem; padding-inline: 1rem; gap: 1.5rem; }
  .portrait-wrap { width: 52%; min-width: 190px; }
  .intro-copy { padding-top: 0; }
  .display { font-size: clamp(4.2rem, 25vw, 7rem); }
  .section { padding: 4rem 0; }
  .section-head { display: block; }
  .section-head p { margin-top: 1rem; }
  .project-grid { grid-template-columns: 1fr; }
  .case-section { grid-template-columns: 1fr; gap: .8rem; }
  .blog-card { grid-template-columns: 1fr; }
  .blog-card img { aspect-ratio: 1.6; }
  .about-grid { grid-template-columns: 1fr; }
  .focus-list { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: .4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
