:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --ink: #181713;
  --muted: #625f58;
  --line: #d7d0c2;
  --panel: #fffdf8;
  --teal: #0c6b64;
  --brick: #9c3f2e;
  --gold: #b47a16;
  --blue: #315f8c;
  --shadow: 0 18px 50px rgba(51, 43, 28, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

main {
  overflow: hidden;
}

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

a:focus-visible {
  outline: 3px solid rgba(12, 107, 100, 0.35);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 0 5vw;
  background: rgba(247, 244, 238, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 800;
}

.nav a:hover,
.hero-links a:hover,
.inline-link:hover,
.article-link a:hover,
.article a:hover,
.essay h3 a:hover,
.subject-grid h3 a:hover {
  color: var(--teal);
}

.inline-link,
.article-link a,
.article a {
  color: var(--teal);
  font-weight: 800;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: clamp(28px, 6vw, 72px);
  align-items: center;
  min-height: calc(100vh - 64px);
  padding: clamp(48px, 8vw, 92px) 5vw 48px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brick);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  max-width: 780px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.75rem, 8vw, 7.8rem);
  font-weight: 700;
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4.2rem);
}

h3 {
  font-size: 1.08rem;
}

.thesis {
  max-width: 690px;
  margin: 24px 0 0;
  color: #343029;
  font-size: clamp(1.08rem, 2vw, 1.38rem);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-weight: 700;
}

.hero-links a:nth-child(2) {
  border-color: var(--teal);
  color: var(--teal);
}

.boundary-diagram {
  margin: 0;
  min-width: 0;
  padding: clamp(18px, 4vw, 34px);
  background:
    linear-gradient(90deg, rgba(12, 107, 100, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(156, 63, 46, 0.08) 1px, transparent 1px),
    var(--panel);
  background-size: 28px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.diagram-row {
  display: grid;
  grid-template-columns: 1fr 38px 1fr 38px 1fr;
  align-items: center;
  gap: 10px;
}

.node {
  display: grid;
  place-items: center;
  min-height: 86px;
  padding: 12px;
  border: 2px solid currentColor;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  font-weight: 800;
  text-align: center;
  overflow-wrap: anywhere;
}

.user {
  color: var(--blue);
}

.model {
  color: var(--teal);
}

.agent {
  color: var(--brick);
}

.edge {
  height: 2px;
  background: var(--ink);
  position: relative;
}

.edge::after {
  position: absolute;
  right: -1px;
  top: -5px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--ink);
  content: "";
}

.diagram-boundary {
  margin: 24px 0;
  padding: 13px 16px;
  border-left: 6px solid var(--gold);
  background: rgba(180, 122, 22, 0.1);
  font-weight: 800;
}

.diagram-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.diagram-grid span {
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--muted);
  font-weight: 700;
}

.section {
  padding: clamp(48px, 8vw, 86px) 5vw;
  border-bottom: 1px solid var(--line);
}

.intro {
  padding-top: 34px;
  padding-bottom: 34px;
}

.intro p {
  max-width: 980px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  line-height: 1.35;
}

.section-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 28px;
}

.essay-list {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.essay {
  display: grid;
  grid-template-columns:
    minmax(96px, 150px)
    minmax(160px, 0.8fr)
    minmax(220px, 1.5fr);
  gap: 22px;
  align-items: baseline;
  padding: 22px;
  background: var(--panel);
}

.essay p,
.subject-grid p,
.method-grid p {
  margin: 0;
  color: var(--muted);
}

.status {
  color: var(--brick);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

.subject-grid article {
  min-height: 230px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.subject-grid h3 {
  margin-bottom: 14px;
}

.split {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 42px;
}

.lab-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lab-list li {
  padding: 16px 18px;
  background: var(--panel);
  border-left: 5px solid var(--teal);
}

.method {
  border-bottom: 0;
}

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

.method-grid p {
  min-height: 150px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.site-footer {
  padding: 26px 5vw;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer p {
  margin: 0;
}

.page-hero {
  padding: clamp(58px, 10vw, 118px) 5vw clamp(42px, 7vw, 76px);
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  max-width: 1040px;
}

.page-thesis {
  max-width: 820px;
  margin: 24px 0 0;
  color: #343029;
  font-size: clamp(1.1rem, 2vw, 1.42rem);
}

.page-section {
  padding-top: clamp(42px, 7vw, 72px);
}

.roadmap {
  display: grid;
  gap: 18px;
}

.roadmap-item {
  padding: clamp(22px, 4vw, 38px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.roadmap-item h2,
.subject-detail-grid h2,
.lab-grid h2,
.note-board h2 {
  margin-top: 8px;
}

.claim {
  max-width: 940px;
  margin: 18px 0 0;
  color: #343029;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2.3vw, 1.8rem);
  line-height: 1.35;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 26px 0 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.detail-list div {
  padding: 18px;
  background: var(--paper);
}

.detail-list dt {
  margin-bottom: 8px;
  color: var(--brick);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  color: var(--muted);
}

.subject-detail-grid,
.lab-grid,
.note-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.subject-detail-grid article,
.lab-grid article,
.note-board article {
  min-height: 300px;
  padding: clamp(20px, 3vw, 30px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.subject-detail-grid p,
.lab-grid p,
.note-board p {
  margin: 16px 0 0;
  color: var(--muted);
}

.compact-list {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding-left: 18px;
  color: #343029;
}

.article-link {
  margin: 22px 0 0;
}

.article {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(42px, 8vw, 88px) 24px;
}

.article-header {
  margin-bottom: clamp(36px, 7vw, 72px);
}

.article-header h1 {
  max-width: 900px;
  font-size: clamp(2.7rem, 7vw, 6rem);
}

.article-subtitle {
  max-width: 820px;
  margin: 24px 0 0;
  color: #343029;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.25rem, 2.4vw, 1.8rem);
  line-height: 1.35;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.86rem;
}

.article-meta span {
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.article-section {
  padding: clamp(26px, 5vw, 48px) 0;
  border-top: 1px solid var(--line);
}

.article-section h2 {
  max-width: 820px;
  margin-bottom: 18px;
  font-size: clamp(1.7rem, 3vw, 2.8rem);
}

.article-section h3 {
  max-width: 820px;
  margin: 8px 0 18px;
  color: var(--brick);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
}

.article-section p,
.article-section li {
  color: #343029;
  font-size: 1.04rem;
}

.article-section p {
  margin: 0 0 18px;
}

.article-section ul,
.article-section ol {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding-left: 24px;
}

.abstract p {
  color: #26231f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.16rem, 2vw, 1.5rem);
  line-height: 1.48;
}

.example {
  margin: 20px 0;
  padding: 18px;
  overflow-x: auto;
  background: #1f2725;
  border-radius: 8px;
  color: #f7f4ee;
  font-size: 0.95rem;
}

.example code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.code-listing {
  margin: 24px 0;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1e1c;
  border: 1px solid #2d3330;
}

.code-listing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: #222725;
  border-bottom: 1px solid #2d3330;
}

.code-listing-header span {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  color: #7a8a82;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.code-listing-header span + span::before {
  content: "/";
  margin-right: 12px;
  color: #4f5a55;
}

.code-listing pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  background: #1a1e1c;
}

.code-listing pre code,
.code-listing pre .k,
.code-listing pre .s,
.code-listing pre .c,
.code-listing pre .n,
.code-listing pre .f,
.code-listing pre .o {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #c9d1cc;
}

.code-listing pre .k {
  color: #6cbfb5;
}

.code-listing pre .s {
  color: #b5a064;
}

.code-listing pre .c {
  color: #5c6b63;
  font-style: italic;
}

.code-listing pre .n {
  color: #d4a06a;
}

.code-listing pre .f {
  color: #8cb8d4;
}

.code-listing pre .o {
  color: #7a8a82;
}

.code-note {
  margin: -8px 0 20px 0;
  padding: 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
}

.code-note code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
}

.math-block {
  margin: 22px 0;
  padding: 18px;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
}

.math-block mjx-container {
  margin: 0 !important;
}

.article-callout {
  margin: 22px 0;
  padding: 18px 20px;
  background: rgba(12, 107, 100, 0.09);
  border-left: 5px solid var(--teal);
  color: #273530;
}

.transformer-figure {
  margin: 28px 0;
  padding: 16px;
  background: #f7f3ea;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.transformer-figure figcaption {
  max-width: 900px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.paper-figure-link {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.paper-figure {
  display: block;
  width: auto;
  height: min(42vh, 340px);
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid rgba(217, 207, 193, 0.8);
  background: #fff;
  object-fit: contain;
}

.math-table-wrap {
  margin: 22px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.math-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.math-table th,
.math-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.math-table th {
  color: var(--brick);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.math-table tr:last-child td {
  border-bottom: 0;
}

.references {
  color: #343029;
}

@media (min-width: 1440px) {
  .site-header,
  .hero,
  .section,
  .page-hero,
  .site-footer {
    padding-left: max(5vw, calc((100vw - 1320px) / 2));
    padding-right: max(5vw, calc((100vw - 1320px) / 2));
  }
}

@media (max-width: 1120px) {
  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .essay {
    grid-template-columns: minmax(90px, 120px) minmax(180px, 0.9fr) minmax(220px, 1.3fr);
  }
}

@media (max-width: 980px) {
  .hero,
  .split {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 56px;
  }

  .boundary-diagram {
    max-width: 760px;
  }

  .method-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-list,
  .subject-detail-grid,
  .lab-grid,
  .note-board,
  .architecture-strip {
    grid-template-columns: 1fr;
  }

  .essay {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .brand {
    font-size: 1rem;
  }

  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    font-size: 0.84rem;
  }

  .nav a {
    justify-content: center;
    min-height: 40px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 253, 248, 0.72);
    text-align: center;
  }

  .hero {
    padding-top: 36px;
    padding-bottom: 36px;
  }

  h1 {
    font-size: clamp(2.55rem, 15vw, 4.6rem);
  }

  h2 {
    font-size: clamp(1.85rem, 11vw, 3rem);
  }

  .thesis {
    margin-top: 18px;
    font-size: 1.05rem;
  }

  .hero-links {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 24px;
  }

  .hero-links a {
    justify-content: center;
    width: 100%;
    min-height: 46px;
  }

  .diagram-row {
    grid-template-columns: 1fr;
  }

  .edge {
    width: 2px;
    height: 30px;
    margin: 0 auto;
  }

  .edge::after {
    top: auto;
    right: -5px;
    bottom: -1px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--ink);
    border-bottom: 0;
  }

  .diagram-grid,
  .subject-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }

  .boundary-diagram {
    padding: 16px;
    background-size: 22px 22px;
  }

  .node {
    min-height: 64px;
  }

  .diagram-boundary {
    margin: 18px 0;
    padding: 12px 13px;
  }

  .diagram-grid {
    gap: 8px;
  }

  .diagram-grid span {
    min-height: 46px;
  }

  .section {
    padding-top: 44px;
    padding-bottom: 44px;
  }

  .intro {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .essay,
  .subject-grid article,
  .method-grid p {
    padding: 18px;
  }

  .subject-grid article,
  .method-grid p {
    min-height: auto;
  }

  .article {
    padding-left: 18px;
    padding-right: 18px;
  }

  .article-section p,
  .article-section li {
    font-size: 1rem;
  }
}

@media (max-width: 420px) {
  .site-header,
  .hero,
  .section,
  .page-hero,
  .site-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .eyebrow,
  .status {
    font-size: 0.72rem;
  }

  .intro p {
    font-size: 1.18rem;
  }

  .essay-list {
    border-left: 0;
    border-right: 0;
    margin-left: -18px;
    margin-right: -18px;
  }

  .essay {
    padding-left: 18px;
    padding-right: 18px;
  }
}
