/* ------------------------------------------------------------------
   Bo Kaung — personal site
   One stylesheet, system light/dark, no external dependencies.
   ------------------------------------------------------------------ */

:root {
  color-scheme: light;
  --bg: #fbfbf8;
  --bg-elev: #ffffff;
  --fg: #171b1f;
  --fg-soft: #303a42;
  --muted: #5b6672;
  --border: #dfe3e6;
  --border-strong: #c6cfd6;
  --panel: #f3f5f6;
  --link: #0a6a9e;
  --link-hover: #07507a;
  --accent: #0b6b5f;
  --accent-soft: #d9f2ec;
  --shadow: 0 1px 2px rgba(16, 24, 32, .04), 0 8px 24px rgba(16, 24, 32, .05);
  --radius: 14px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1216;
    --bg-elev: #141a20;
    --fg: #e6edf3;
    --fg-soft: #c9d3dc;
    --muted: #93a1ae;
    --border: #26303a;
    --border-strong: #3a4753;
    --panel: #12181e;
    --link: #79c0ff;
    --link-hover: #a5d6ff;
    --accent: #5eead4;
    --accent-soft: #123832;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.7 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

::selection { background: var(--accent-soft); color: var(--fg); }

img, svg { max-width: 100%; }

a { color: var(--link); text-decoration-thickness: .08em; text-underline-offset: .15em; }
a:hover { color: var(--link-hover); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--fg);
}

.wrap {
  width: min(100% - 40px, 1060px);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -.01em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  font: 600 12px/1 var(--font-mono);
}

.brand-glyph {
  display: block;
  width: 26px;
  height: 26px;
  background: currentColor;
  -webkit-mask: url("../cicada-mark.svg") center / contain no-repeat;
  mask: url("../cicada-mark.svg") center / contain no-repeat;
}

.brand:hover { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: .92rem;
  font-weight: 600;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--fg); }
.site-nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* ---------- Shared type ---------- */

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font: 600 11px/1.3 var(--font-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}

.dek {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag-list li {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font: 500 11px/1 var(--font-mono);
  letter-spacing: .01em;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, .75fr);
  gap: clamp(32px, 6vw, 76px);
  align-items: center;
  padding: clamp(56px, 9vw, 104px) 0 clamp(40px, 6vw, 64px);
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.25rem, 5.2vw, 3.55rem);
  line-height: 1.05;
  letter-spacing: -.035em;
}

.hero .accent { color: var(--accent); }

.lead {
  max-width: 48ch;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.6vw, 1.16rem);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--fg);
  font-size: .94rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}
.btn-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.hero-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.card-label {
  margin: 0 0 14px;
  color: var(--muted);
  font: 600 11px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.now-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.now-list li {
  position: relative;
  padding-left: 16px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}
.now-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .58em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.now-list strong { color: var(--fg); font-weight: 650; }
.now-list a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}
.now-list a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.card-foot {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .84rem;
}
.card-foot a { font-weight: 600; text-decoration: none; }

/* ---------- Sections ---------- */

.section { padding: clamp(32px, 5vw, 54px) 0; }
.section + .section { border-top: 1px solid var(--border); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.section-head h2 { margin: 0; font-size: clamp(1.4rem, 2.4vw, 1.75rem); }
.section-head .eyebrow { margin-bottom: 8px; }

.more {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.more:hover { color: var(--accent); }

/* ---------- Cards ---------- */

.card-grid, .project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.post-card, .project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.post-card:hover, .project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.post-meta {
  margin: 0;
  color: var(--muted);
  font: 500 11.5px/1.5 var(--font-mono);
  letter-spacing: .03em;
  text-transform: uppercase;
}

.post-card h3, .project-card h3 {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.3;
  letter-spacing: -.015em;
}
.post-card h3 a {
  color: var(--fg);
  text-decoration: none;
}
.post-card h3 a:hover { color: var(--accent); }

.post-desc, .project-desc {
  margin: 0;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.6;
}

.post-card .tag-list, .project-card .tag-list { margin-top: auto; padding-top: 8px; }

.project-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.project-role {
  flex: none;
  color: var(--accent);
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.project-tagline {
  margin: 0;
  color: var(--fg-soft);
  font-size: .96rem;
  font-weight: 600;
  line-height: 1.5;
}
.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 6px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 600;
}
.project-links a { text-decoration: none; }
.project-links a:hover { text-decoration: underline; text-underline-offset: .15em; }

/* ---------- Page shell ---------- */

.page { padding: clamp(48px, 7vw, 78px) 0 72px; }

.page-head {
  max-width: 680px;
  margin-bottom: 40px;
}
.page-head h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.6vw, 2.85rem);
  line-height: 1.1;
  letter-spacing: -.03em;
}

.page-body { max-width: 720px; }
.page-body h2 {
  margin: 2.4rem 0 .7rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.35rem;
}
.page-body h3 { margin: 1.8rem 0 .5rem; font-size: 1.1rem; }
.page-body p { margin: 0 0 1.1rem; }
.page-body ul, .page-body ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.page-body li { margin: .3rem 0; }
.page-body a { font-weight: 500; }
.page-body table {
  display: block;
  width: 100%;
  margin: 1rem 0 1.6rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: .92rem;
}
.page-body th, .page-body td {
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.page-body th {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- Writing index ---------- */

.post-list { border-top: 1px solid var(--border); }

.post-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
}
.post-row time {
  padding-top: .2rem;
  color: var(--muted);
  font: 500 12px/1.5 var(--font-mono);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.post-row h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  line-height: 1.3;
}
.post-row h2 a { color: var(--fg); text-decoration: none; }
.post-row h2 a:hover { color: var(--accent); }
.post-row p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .96rem;
}

/* ---------- Post ---------- */

.post {
  max-width: 800px;
  padding: clamp(40px, 7vw, 70px) 0 72px;
}

.post-header { margin-bottom: 30px; }
.post-header h1 {
  margin: 0 0 16px;
  font-size: clamp(1.95rem, 4.8vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -.032em;
}
.post-header .dek { margin-bottom: 18px; }
.post-header .post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.post-tags { margin-top: 16px; }

.post-cover {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.post-body { font-size: 1.06rem; line-height: 1.75; }
.post-body p { margin: 0 0 1.15rem; }
.post-body h2 {
  margin: 2.7rem 0 .8rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.45rem;
  line-height: 1.3;
}
.post-body h3 { margin: 1.9rem 0 .6rem; font-size: 1.16rem; }
.post-body h4 { margin: 1.6rem 0 .5rem; font-size: 1rem; }

.post-body a { color: var(--link); }
.post-body a:hover { color: var(--link-hover); }

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.8rem auto .3rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

/* Captions: a paragraph of only <em> that directly follows an image. */
.post-body p:has(> img) + p > em:only-child {
  display: block;
  margin: .2rem 0 1.8rem;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.55;
  text-align: center;
}

.post-body code {
  padding: .08em .32em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  font: .88em var(--font-mono);
  overflow-wrap: anywhere;
}
.post-body pre {
  margin: 0 0 1.4rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.post-body pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: .88rem;
  line-height: 1.6;
  overflow-wrap: normal;
}

.post-body blockquote {
  margin: 1.5rem 0;
  padding: .2rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.post-body blockquote p:last-child { margin-bottom: 0; }

.post-body ul, .post-body ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.post-body li { margin: .28rem 0; }
.post-body li > p { margin: 0 0 .45rem; }

.post-body hr {
  margin: 2.6rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.post-body table {
  display: block;
  width: 100%;
  margin: 1rem 0 1.6rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: .92rem;
}
.post-body th, .post-body td {
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.post-body th {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.post-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: .9rem;
}
.post-footer .back { font-weight: 600; text-decoration: none; }

/* ---------- Elsewhere / link lists ---------- */

.elsewhere { margin-top: 44px; }
.elsewhere h2 { margin: 0 0 10px; font-size: 1.25rem; }
.elsewhere p { margin: 0 0 16px; color: var(--muted); }

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.link-row li {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elev);
  font-size: .88rem;
  font-weight: 600;
}
.link-row a { text-decoration: none; }

.link-list { padding-left: 1.3rem; }
.link-list a { font-weight: 500; }

.about-body .link-list { margin-bottom: 1.4rem; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 64px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: .86rem;
}
.footer-inner p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 48px;
  }
  .hero-card { max-width: 520px; }
  .card-grid, .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .wrap { width: min(100% - 32px, 1060px); }
  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
  }
  .site-nav { gap: 16px; font-size: .86rem; }
  .hero { padding-top: 36px; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.6rem); }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .post-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 20px 0;
  }
  .post-row time { padding-top: 0; }
  .post-body { font-size: 1.01rem; }
  .post-body table { font-size: .86rem; }
  .post-footer { flex-direction: column; align-items: flex-start; }
}

/* ---------- Print ---------- */

@media print {
  .site-header, .site-footer, .skip-link, .post-footer, .hero-links { display: none; }
  body { background: #fff; color: #000; }
  .post, .page { padding: 0; }
  a { color: #000; text-decoration: underline; }
  .post-body img { border: 0; }
}
