/*
  Design read: redesign of a data-systems personal site for observability
  and infrastructure readers, warehouse-scale / telemetry language,
  native CSS + real satellite and datacenter photography.
  Dials: VARIANCE 6, MOTION 4, DENSITY 6.
  Not Inter. Not purple. Not a fake dashboard. Accent stays oxidized teal.
*/

:root {
  color-scheme: light;
  --bg: #ecefee;
  --bg-soft: #e3e8e5;
  --ink: #17211f;
  --muted: #3f4c49;
  --line: #c5cec9;
  --accent: #0f6e68;
  --accent-hover: #0c5a55;
  --on-accent: #f3f7f5;
  --code-bg: #e7ece9;
  --shadow: none;
  --radius: 0;
  --measure: 65ch;
  --shell: 70rem;
  --header-h: 4rem;
  --font: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1218;
  --bg-soft: #121b22;
  --ink: #e8eef2;
  --muted: #93a4ad;
  --line: #24313a;
  --accent: #3dbeae;
  --accent-hover: #6ed4c6;
  --on-accent: #06201c;
  --code-bg: #121b22;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

img,
video,
iframe {
  max-width: 100%;
}

img {
  display: block;
  height: auto;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-hover);
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 30;
  padding: 0.4rem 0.7rem;
  background: var(--accent);
  color: var(--on-accent);
}

.skip-link:focus {
  top: 0.75rem;
}

.shell,
.site-main > section:not(.hero):not(.about-visual),
.site-main > article,
.site-main > ol,
.site-main > ul,
.site-main > nav {
  width: min(calc(100% - 2.5rem), var(--shell));
  margin-inline: auto;
}

.site-main {
  padding: 1.5rem 0 4.5rem;
}

.site-main:has(.hero) {
  padding-top: 0;
}

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

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  width: 1.7rem;
  height: 1.7rem;
  object-fit: cover;
  object-position: center 18%;
  background: var(--bg-soft);
}

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

.nav-desktop {
  display: none;
  align-items: center;
  gap: 1.15rem;
  margin-left: 0.4rem;
}

.nav-desktop a,
.nav-mobile a {
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-desktop a:hover,
.nav-mobile a:hover,
.nav-desktop a.is-active,
.nav-mobile a.is-active {
  color: var(--ink);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-left: auto;
}

.github-link {
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
}

.github-link:hover {
  color: var(--ink);
}

.theme-toggle,
.copy-btn,
.hub-copy,
.nav-mobile summary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle,
.nav-mobile summary {
  padding: 0.42rem 0.65rem;
}

.copy-btn,
.hub-copy {
  margin-left: 0.45rem;
  padding: 0.18rem 0.5rem;
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn.is-copied,
.hub-copy.is-copied {
  color: var(--ink);
  border-color: var(--line);
}

.nav-mobile {
  position: relative;
}

.nav-mobile summary {
  list-style: none;
}

.nav-mobile summary::-webkit-details-marker {
  display: none;
}

.nav-mobile nav {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  display: grid;
  min-width: 9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg);
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 1.8rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer-inner p {
  margin: 0;
}

.footer-inner a {
  color: var(--muted);
  text-decoration: none;
}

.footer-inner a:hover {
  color: var(--ink);
}

.page-intro {
  max-width: 42rem;
  margin-bottom: 2.4rem;
}

.page-intro h1,
.post-header h1,
.hero-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.page-intro h1,
.post-header h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.page-intro p,
.about-now p {
  margin: 0.9rem 0 0;
  color: var(--muted);
  max-width: var(--measure);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.section-head h2,
.writing-feature h2,
.notes-index h2,
.about-now h2,
.project-refs h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.section-link {
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}

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

.hero {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  background: var(--bg);
}

.hero-copy {
  width: min(calc(100% - 2.5rem), var(--shell));
  margin-inline: auto;
  padding: 1.35rem 0 1.1rem;
}

.hero-title {
  max-width: 12em;
  font-size: clamp(1.85rem, 4.2vw, 3.1rem);
}

.hero-lead {
  margin: 0.85rem 0 0;
  max-width: 28rem;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.1rem;
  margin: 1.25rem 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.45rem 0.95rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.btn-text {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

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

.hero-figure {
  flex: none;
  margin: 0;
  background: #070c10;
}

.hero-figure img {
  display: block;
  width: 100%;
  height: min(32vh, 20rem);
  object-fit: cover;
  object-position: center;
}

.corpus {
  margin-top: 1rem;
  padding-bottom: 0.35rem;
}

.corpus-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.35rem;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.home-projects,
.home-writing,
.writing-feature,
.writing-index,
.notes-index,
.about-now,
.about-follow,
.project-refs {
  margin-top: 2.6rem;
}

.project-index {
  display: grid;
}

.project-row {
  display: grid;
  gap: 0.85rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.project-row:last-child {
  border-bottom: 1px solid var(--line);
}

.project-row:hover {
  color: inherit;
}

.project-row img,
.project-photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #070c10;
}

.project-row-copy {
  display: grid;
  gap: 0.25rem;
}

.project-row-kicker,
.project-kicker,
.follow-name {
  color: var(--muted);
  font-size: 0.9rem;
}

.project-row-title {
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.project-row.is-lead .project-row-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.project-row-home {
  color: var(--muted);
}

.feature-story {
  display: grid;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
}

.feature-story:hover {
  color: inherit;
}

.feature-story img,
.post-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg-soft);
}

.feature-story-body h3 {
  margin: 0.25rem 0 0.45rem;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.feature-story-body p,
.note-item p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.feature-story time,
.note-item time,
.month-group h3,
.post-meta,
.post-index time,
.title-grid time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.note-pair {
  display: grid;
  gap: 1.2rem;
  margin-top: 1.4rem;
}

.note-item {
  color: inherit;
  text-decoration: none;
}

.note-item:hover {
  color: inherit;
}

.note-item strong {
  display: block;
  margin: 0.2rem 0 0.35rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.writing-feature-grid {
  display: grid;
  gap: 1.4rem;
  margin-top: 1rem;
}

.follow {
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 1px solid var(--line);
}

.follow p {
  margin: 0 0 0.55rem;
}

.follow img {
  width: 10.5rem;
  margin: 0.7rem 0;
  background: #fff;
}

.follow-caption {
  color: var(--muted);
}

.month-group + .month-group {
  margin-top: 1.8rem;
}

.month-group h3,
.note-group h3 {
  margin: 0 0 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.note-group {
  margin-top: 1.6rem;
}

.note-group:first-of-type {
  margin-top: 1.2rem;
}

.title-grid {
  display: grid;
  gap: 0.85rem 1.5rem;
}

.catalog-item {
  display: grid;
  grid-template-columns: 5.4rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  color: inherit;
  text-decoration: none;
}

.catalog-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--bg-soft);
}

.catalog-copy {
  display: grid;
  gap: 0.2rem;
}

.catalog-item:hover span {
  color: var(--accent);
}

.about-visual {
  width: 100%;
  margin: 0 0 2rem;
  background: #070c10;
}

.about-visual img {
  width: 100%;
  max-height: 22rem;
  object-fit: cover;
  object-position: center 70%;
}

.about-slogan {
  color: var(--ink) !important;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.about-now p {
  max-width: 42rem;
}

.project-block {
  padding: 1.6rem 0 2rem;
  border-top: 1px solid var(--line);
}

.project-block h2 {
  margin: 0.2rem 0 0.8rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.project-block p,
.project-block li,
.project-refs li {
  color: var(--muted);
}

.project-kicker {
  margin: 0;
}

.project-photo {
  margin: 0.9rem 0 1rem;
}

.video-frame {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-top: 1.2rem;
  border: 1px solid var(--line);
  background: #0c1010;
}

.video-frame iframe,
.video-frame video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.post {
  max-width: 76rem;
}

.post-header {
  max-width: var(--measure);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  margin: 0.8rem 0 0;
}

.post-meta a {
  color: var(--muted);
  text-decoration: none;
}

.post-meta a:hover {
  color: var(--accent);
}

.post-cover {
  margin: 1.4rem 0 1.6rem;
}

.toc {
  max-width: var(--measure);
  margin: 0 0 1.6rem;
}

.toc summary {
  cursor: pointer;
  color: var(--muted);
}

.toc ol {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
}

.article {
  max-width: var(--measure);
}

.article > *:first-child {
  margin-top: 0;
}

.article h2,
.article h3,
.article h4 {
  margin: 2rem 0 0.7rem;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.article p,
.article li {
  line-height: 1.85;
}

.article img {
  margin: 1rem 0;
}

.article blockquote {
  margin: 1.2rem 0;
  padding: 0 0 0 1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.article hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.article table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.article th,
.article td {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  text-align: left;
}

.article code,
.article pre,
.highlight {
  font-family: var(--mono);
  font-size: 0.88em;
}

.article :not(pre) > code {
  padding: 0.1em 0.28em;
  background: var(--code-bg);
}

.highlight {
  overflow-x: auto;
  margin: 1.2rem 0;
  background: var(--code-bg);
  color: var(--ink);
}

.highlight table,
.highlight tr,
.highlight td {
  border: 0;
  margin: 0;
  padding: 0;
}

.highlight .gutter {
  padding: 0.9rem 0.7rem;
  color: var(--muted);
  user-select: none;
}

.highlight .code {
  padding: 0.9rem 1rem 0.9rem 0;
}

.highlight .comment,
.highlight .quote {
  color: var(--muted);
}

.highlight .keyword,
.highlight .selector-tag,
.highlight .addition {
  color: var(--accent);
}

.highlight .string,
.highlight .attr {
  color: var(--ink);
}

.wechat-follow {
  margin-top: 2.6rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
}

.wechat-follow img {
  width: 9.5rem;
  margin-top: 0.7rem;
  background: #fff;
}

.post-index,
.chip-index,
.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-index li + li {
  margin-top: 0.85rem;
}

.post-index a,
.chip-index a {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 0.8rem;
  color: inherit;
  text-decoration: none;
}

.chip-index a {
  grid-template-columns: minmax(0, 1fr) auto;
}

.post-index a:hover span,
.chip-index a:hover span {
  color: var(--accent);
}

.link-group {
  margin-top: 2rem;
}

.link-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  margin-top: 0.55rem;
}

.link-list span,
.chip-index time {
  color: var(--muted);
}

.pager {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .nav-desktop {
    display: flex;
  }

  .nav-mobile {
    display: none;
  }

  .hero-copy {
    padding: 1.6rem 0 1.2rem;
  }

  .project-row {
    grid-template-columns: 13rem minmax(0, 1fr);
    align-items: center;
  }

  .project-row.is-lead {
    grid-template-columns: minmax(18rem, 0.9fr) minmax(0, 1.1fr);
  }

  .project-row img {
    aspect-ratio: 4 / 3;
  }

  .project-row.is-lead img {
    aspect-ratio: 16 / 10;
  }

  .note-pair,
  .title-grid {
    grid-template-columns: 1fr 1fr;
  }

  .writing-feature-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 0.7fr);
    align-items: start;
  }

  .about-visual img {
    max-height: 28rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
a,
.btn,
.theme-toggle,
.github-link,
.copy-btn,
.hub-copy {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  }
}

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