:root{
  --paper:    #fafaf7;
  --paper-2:  #f0eee6;
  --ink:      #1a1814;
  --ink-2:    #3b362d;
  --muted:    #74695a;
  --rule:     #d9d4c4;
  --rule-2:   #e6e1d2;
  --accent:   oklch(0.70 0.17 55);
  --accent-2: oklch(0.62 0.19 45);
  --hl:       oklch(0.95 0.04 70);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--paper);color:var(--ink);font-family:var(--serif);}
body{
  font-size:17px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  background-image: radial-gradient(rgba(26,24,20,.025) 1px, transparent 1.2px);
  background-size: 5px 5px;
  background-position: 0 0;
}

a{color:inherit;text-decoration:none}

/* ---- LAYOUT ---- */
.shell{
  display:grid;
  grid-template-columns: 260px 1fr;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 36px 96px;
  gap: 48px;
}

/* ---- SIDEBAR ---- */
aside.side{
  position:sticky;
  top:28px;
  align-self:start;
  height: calc(100vh - 56px);
  display:flex;
  flex-direction:column;
  gap: 26px;
  padding-right: 12px;
  border-right: 1px dashed var(--rule);
  overflow-y: auto;
}

.brand{
  display:flex;
  flex-direction:column;
  gap: 10px;
  padding: 4px 0 16px;
}
.brand-mark{
  width: 110px;
  display:block;
  position: relative;
  padding: 4px 0;
}
.brand-mark img{
  width: 100%;
  height: auto;
  display:block;
}
.brand-name{
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  display:flex; align-items:center; gap:8px;
}
.brand-name .dot{
  width:6px; height:6px; background:var(--accent);
  display:inline-block;
}
.brand-tag{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .04em;
}

.nav-section + .nav-section{ margin-top: 4px }
.nav-label{
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  display:flex; align-items:center; gap:8px;
}
.nav-label::before{
  content:"//";
  color: var(--accent-2);
  font-weight:600;
}

nav.side-nav ul{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap: 4px }
nav.side-nav a{
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-2);
  padding: 4px 0 4px 14px;
  position: relative;
  display:block;
  transition: color .15s ease, background .15s ease;
}
nav.side-nav a::before{
  content:"";
  position:absolute; left:0; top:11px;
  width:6px; height:1px;
  background: var(--rule);
}
nav.side-nav a:hover{ color: var(--accent-2) }
nav.side-nav a:hover::before{ background: var(--accent); width:10px }
nav.side-nav a.is-active{
  color: var(--ink);
  background: var(--hl);
}
nav.side-nav a.is-active::before{
  content:"\25B8";
  background: transparent;
  width:auto; height:auto;
  top: 4px; left:1px;
  color: var(--accent-2);
  font-size: 10px;
}

/* CSS-driven active state, set via body[data-active-side="..."] and a[data-side="..."] */
body[data-active-side] nav.side-nav a[data-side]{ /* default; overridden by match below */ }
body[data-active-side="introduction"]      nav.side-nav a[data-side="introduction"],
body[data-active-side="work"]              nav.side-nav a[data-side="work"],
body[data-active-side="testimonials"]      nav.side-nav a[data-side="testimonials"],
body[data-active-side="blogs"]             nav.side-nav a[data-side="blogs"],
body[data-active-side="sxd-archive"]       nav.side-nav a[data-side="sxd-archive"],
body[data-active-side="ai-articles"]       nav.side-nav a[data-side="ai-articles"],
body[data-active-side="obsidian"]          nav.side-nav a[data-side="obsidian"],
body[data-active-side="knowledge-graph"]   nav.side-nav a[data-side="knowledge-graph"],
body[data-active-side="conversational-ai"] nav.side-nav a[data-side="conversational-ai"],
body[data-active-side="design-theory"]     nav.side-nav a[data-side="design-theory"],
body[data-active-side="domain-specific"]   nav.side-nav a[data-side="domain-specific"],
body[data-active-side="emotional"]         nav.side-nav a[data-side="emotional"],
body[data-active-side="interestingness"]   nav.side-nav a[data-side="interestingness"],
body[data-active-side="org-design"]        nav.side-nav a[data-side="org-design"],
body[data-active-side="personalization"]   nav.side-nav a[data-side="personalization"],
body[data-active-side="prompts"]           nav.side-nav a[data-side="prompts"]{
  color: var(--ink);
  background: var(--hl);
}
body[data-active-side="introduction"]      nav.side-nav a[data-side="introduction"]::before,
body[data-active-side="work"]              nav.side-nav a[data-side="work"]::before,
body[data-active-side="testimonials"]      nav.side-nav a[data-side="testimonials"]::before,
body[data-active-side="blogs"]             nav.side-nav a[data-side="blogs"]::before,
body[data-active-side="sxd-archive"]       nav.side-nav a[data-side="sxd-archive"]::before,
body[data-active-side="ai-articles"]       nav.side-nav a[data-side="ai-articles"]::before,
body[data-active-side="obsidian"]          nav.side-nav a[data-side="obsidian"]::before,
body[data-active-side="knowledge-graph"]   nav.side-nav a[data-side="knowledge-graph"]::before,
body[data-active-side="conversational-ai"] nav.side-nav a[data-side="conversational-ai"]::before,
body[data-active-side="design-theory"]     nav.side-nav a[data-side="design-theory"]::before,
body[data-active-side="domain-specific"]   nav.side-nav a[data-side="domain-specific"]::before,
body[data-active-side="emotional"]         nav.side-nav a[data-side="emotional"]::before,
body[data-active-side="interestingness"]   nav.side-nav a[data-side="interestingness"]::before,
body[data-active-side="org-design"]        nav.side-nav a[data-side="org-design"]::before,
body[data-active-side="personalization"]   nav.side-nav a[data-side="personalization"]::before,
body[data-active-side="prompts"]           nav.side-nav a[data-side="prompts"]::before{
  content:"\25B8";
  background: transparent;
  width:auto; height:auto;
  top: 4px; left:1px;
  color: var(--accent-2);
  font-size: 10px;
}

.side-foot{
  margin-top:auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .04em;
  line-height:1.5;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
}
.side-foot .ln{ display:flex; justify-content:space-between }

/* ---- MAIN ---- */
main.main{ min-width:0 }

.top-nav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 36px;
  gap: 24px;
  flex-wrap: wrap;
}
.top-nav .links{
  display:flex; gap: 28px; align-items:baseline;
}
.top-nav a{
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink-2);
  position:relative;
  padding-bottom: 4px;
}
.top-nav a:hover{ color: var(--accent-2) }

/* CSS-driven active topnav: set via body[data-section="..."] and a[data-section="..."] */
body[data-section="about"]         .top-nav a[data-section="about"],
body[data-section="design-and-ai"] .top-nav a[data-section="design-and-ai"],
body[data-section="sxd"]           .top-nav a[data-section="sxd"],
body[data-section="home"]          .top-nav a[data-section="home"]{
  color: var(--ink);
}
body[data-section="about"]         .top-nav a[data-section="about"]::after,
body[data-section="design-and-ai"] .top-nav a[data-section="design-and-ai"]::after,
body[data-section="sxd"]           .top-nav a[data-section="sxd"]::after,
body[data-section="home"]          .top-nav a[data-section="home"]::after{
  content:"";
  position:absolute; left:0; right:0; bottom:-19px;
  height: 2px; background: var(--accent);
}

.top-nav .meta{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .08em;
  display:flex; gap:16px; align-items:center;
}
.top-nav .meta .live{
  display:inline-flex; align-items:center; gap:6px;
}

/* ---- ARTICLE HEADER ---- */
.article-meta{
  display:flex;
  gap: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 18px;
  align-items:center;
  flex-wrap: wrap;
}
.article-meta .tag{
  background: var(--ink);
  color: var(--paper);
  padding: 3px 8px;
  letter-spacing: .12em;
}
.article-meta .sep{ width: 24px; height:1px; background: var(--rule) }

h1.article-title{
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  color: var(--ink);
  text-wrap: balance;
}
.deck{
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 720px;
  margin: 0 0 32px;
  text-wrap: pretty;
  font-style: italic;
}

/* ---- BODY GRID ---- */
.article{
  display:grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 56px;
  align-items:start;
}
.article.no-margin{
  grid-template-columns: minmax(0, 1fr);
}
.prose{ max-width: 680px; }
.prose.wide{ max-width: 100%; }
.prose p{
  margin: 0 0 18px;
  font-size: 17.5px;
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}
.prose .drop-first > p:first-of-type::first-letter,
.prose.drop-first > p:first-of-type::first-letter{
  font-family: var(--serif);
  font-weight: 500;
  float: left;
  font-size: 64px;
  line-height: .9;
  padding: 6px 10px 0 0;
  color: var(--accent-2);
}
.prose h2{
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -.01em;
  margin: 44px 0 16px;
  color: var(--ink);
  display:flex; align-items: baseline; gap:12px;
}
.prose h2::before{
  content: "\00A7";
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
  color: var(--accent-2);
  transform: translateY(-2px);
}
.prose h2.plain::before{ content: none }
.prose h3{
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 32px 0 10px;
  color: var(--ink);
}
.prose a,
.prose a.in-line{
  color: var(--accent-2);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
}
.prose a:hover,
.prose a.in-line:hover{ border-color: var(--accent) }
.prose em{ color: var(--ink) }
.prose strong{ color: var(--ink); font-weight:600 }
.prose ul, .prose ol{ margin: 0 0 18px; padding-left: 22px; }
.prose ul li, .prose ol li{
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 8px;
}
.prose img{ max-width: 100%; height: auto; }
.prose figure.thumb{
  float: left;
  margin: 4px 22px 12px 0;
}
.prose figure.thumb img{ display:block }

/* ---- ASIDE / MARGIN ---- */
.margin{
  position: sticky;
  top: 28px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  letter-spacing: .01em;
  display:flex; flex-direction: column; gap: 22px;
}
.margin .card{
  border-top: 1px solid var(--ink);
  padding-top: 10px;
}
.margin .card .ttl{
  color: var(--ink);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-size: 10.5px;
}
.margin .card p{ margin:0 0 8px }
.margin .card .kv{ display:flex; justify-content:space-between; padding:3px 0; border-bottom: 1px dashed var(--rule); }
.margin .card .kv:last-child{ border-bottom:0 }
.margin .card .kv b{ color: var(--ink); font-weight:500 }
.margin .card a{ color: var(--ink-2); border-bottom: 1px solid var(--rule); padding-bottom:1px }
.margin .card a:hover{ color: var(--accent-2); border-color: var(--accent) }

/* ---- TAXONOMY TABLE (figure) ---- */
figure.fig{
  margin: 28px 0 32px;
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 22px 22px 18px;
  position: relative;
}
figure.fig .fig-title{
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align:center;
  margin-bottom: 16px;
}
table.tax{
  width:100%;
  border-collapse: collapse;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.4;
}
table.tax thead th{
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink);
}
table.tax tbody td{
  padding: 12px 12px;
  border-bottom: 1px dashed var(--rule);
  vertical-align: top;
  color: var(--ink-2);
}
table.tax tbody tr:last-child td{ border-bottom: 0 }
table.tax td:first-child{
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--ink);
  width: 28%;
}
figure.fig figcaption{
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: 14px;
  line-height: 1.5;
}

/* ---- PULL QUOTE ---- */
.pull{
  margin: 36px 0;
  padding: 18px 0 18px 22px;
  border-left: 2px solid var(--accent);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.35;
  font-style: italic;
  color: var(--ink);
  text-wrap: balance;
}
.pull cite{
  display:block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 12px;
}

/* ---- FOOTER ---- */
footer.foot{
  margin-top: 80px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 16px;
}
footer.foot a{ color: var(--ink-2) }
footer.foot a:hover{ color: var(--accent-2) }
footer.foot .social{
  display:flex; gap: 14px; align-items:center;
}
footer.foot .social a{
  display:inline-flex; align-items:center; justify-content:center;
  width: 22px; height: 22px;
  opacity: .8;
  transition: opacity .15s ease;
}
footer.foot .social a:hover{ opacity: 1 }
footer.foot .social img{ width: 16px; height: 16px; display:block }

/* mobile drawer button */
.menu-btn{
  display:none;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1080px){
  .article{ grid-template-columns: 1fr; gap: 32px }
  .margin{ position: static; flex-direction: row; flex-wrap:wrap; gap: 24px }
  .margin .card{ flex: 1 1 240px }
}
@media (max-width: 820px){
  .shell{
    grid-template-columns: 1fr;
    gap: 0;
    padding: 16px 20px 64px;
  }
  aside.side{
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px dashed var(--rule);
    padding: 0 0 18px;
    margin-bottom: 22px;
    gap: 18px;
    overflow-y: visible;
  }
  .brand{ flex-direction: row; align-items: center; gap: 14px; padding: 0 }
  .brand-mark{ width: 64px; padding: 0 }
  .brand-text{ display:flex; flex-direction:column; gap:4px }
  .nav-section{ display:none }
  .side.is-open .nav-section{ display:block }
  .side-foot{ display:none }
  .menu-btn{ display:inline-block; align-self:flex-start; margin-left:auto }
  .brand{ width: 100% }

  .top-nav{ margin-bottom: 24px; gap: 14px }
  .top-nav .links{ gap: 18px; flex-wrap: wrap }
  .top-nav a{ font-size: 16px }
  .top-nav .meta{ display:none }

  h1.article-title{ font-size: 32px }
  .deck{ font-size: 17px }
  .prose p{ font-size: 16px }
  .prose .drop-first p:first-of-type::first-letter{ font-size: 48px }
  figure.fig{ padding: 18px 14px 14px; overflow-x:auto }
  table.tax{ font-size: 13px; min-width: 480px }
}
