/*
 * CSS LAYER
 * ---------
 * HTML/JSX says what each element means; CSS says how it looks and where it
 * sits. This file follows the same top-to-bottom order as index.html, so it is
 * easy to connect a class in the HTML with its visual rules here.
 */

/* 1. Reusable design values ------------------------------------------------ */
:root {
  --paper: #f5f1e8;
  --paper-deep: #eee9de;
  --ink: #22221f;
  --muted: #77746d;
  --quiet: #969188;
  --olive: #4f5946;
  --line: rgba(34, 34, 31, 0.12);
  --line-strong: rgba(34, 34, 31, 0.26);
  --page-width: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  color: inherit;
  font: inherit;
}

::selection {
  background: var(--olive);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 5px;
}

/* 2. Desktop grid: 42% profile / 58% content ------------------------------ */
.main-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  gap: clamp(4rem, 7vw, 6rem);
  width: min(100%, var(--page-width));
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 clamp(3rem, 5vw, 4.5rem);
}

/* 3. Sticky profile column ------------------------------------------------- */
.profile {
  position: sticky;
  top: 12vh;
  display: flex;
  height: 76vh;
  min-height: 580px;
  flex-direction: column;
  align-self: start;
  justify-content: space-between;
  padding: 1.5rem 0 0;
}

.profile-kicker,
.section-number,
.article-meta,
.article-category,
.article-date,
.article-nav,
.filter-button,
.project-summary,
.project-number,
.project-year {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.profile-kicker {
  margin: 0 0 1.25rem;
  color: var(--quiet);
  font-size: 0.7rem;
}

.profile h1 {
  margin: 0;
  font-size: clamp(4rem, 6.3vw, 5rem);
  font-weight: 680;
  letter-spacing: -0.07em;
  line-height: 0.9;
}

.role {
  margin: 1.6rem 0 0;
  font-size: clamp(1.55rem, 2.3vw, 1.85rem);
  font-weight: 470;
  letter-spacing: -0.035em;
}

.statement {
  max-width: 22rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.12rem);
  line-height: 1.7;
}

.site-nav {
  display: flex;
  width: fit-content;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 3rem;
}

.site-nav a {
  position: relative;
  width: fit-content;
  color: var(--muted);
  font-size: 0.86rem;
  transition: color 180ms ease, transform 180ms ease;
}

.site-nav a::before {
  position: absolute;
  top: 50%;
  left: -1.1rem;
  width: 0;
  height: 1px;
  background: var(--olive);
  content: "";
  transition: width 180ms ease;
}

.site-nav a:hover {
  color: var(--ink);
  transform: translateX(1.1rem);
}

.site-nav a:hover::before {
  width: 0.7rem;
}

.language-toggle {
  width: fit-content;
  margin: 0;
  padding: 0.5rem 0.8rem;
  min-height: 2rem;
  min-width: 4.5rem;
  border: 1px solid #ddbeb6;
  border-radius: 999px;
  background: transparent;
  color: #b45f55;
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease,
    background-color 180ms ease;
}

.language-toggle:hover {
  border-color: #cc7167;
  background: #f6e5df;
  color: #a95249;
}

.language-toggle:focus-visible { outline: 2px solid #cc7167; outline-offset: 3px; }

.site-nav .language-toggle {
  margin-top: 0.45rem;
}

.availability {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  color: var(--quiet);
  font-size: 0.68rem;
  line-height: 1.5;
}

.availability-dot {
  width: 0.38rem;
  height: 0.38rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--olive);
  animation: breathe 2.5s ease-in-out infinite;
}

/* 4. Right content column -------------------------------------------------- */
.content-column {
  min-width: 0;
}

.writing-section {
  display: flex;
  min-height: 78vh;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 0 3rem;
}

.section-heading {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 520;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-number {
  margin: 0;
  color: var(--quiet);
  font-size: 0.61rem;
}

/* 5. Compact featured article --------------------------------------------- */
.article-list {
  display: grid;
  width: min(100%, 580px);
  gap: 1rem;
}

.article-card {
  display: grid;
  grid-template-columns: minmax(150px, 0.78fr) minmax(220px, 1.22fr);
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(238, 233, 222, 0.46);
  transition: border-color 200ms ease, transform 200ms ease;
}

.article-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.article-thumbnail {
  position: relative;
  display: flex;
  min-height: 210px;
  overflow: hidden;
  flex-direction: column;
  justify-content: center;
  padding: 2.4rem 1.4rem 1.4rem;
  background: #d9d5c9;
  transition: transform 350ms ease;
}

.article-card:hover .article-thumbnail {
  transform: scale(1.025);
}

.article-thumbnail-photo {
  padding: 0;
  background: #20262a;
}

.article-thumbnail-photo img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  object-position: center;
}

.article-thumbnail-illustration {
  padding: 0;
  background: var(--paper-deep);
}

.article-thumbnail-illustration img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  object-fit: contain;
  object-position: center;
}

.article-card-odyssey .article-copy h3 {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(1.18rem, 1.65vw, 1.4rem);
  letter-spacing: -0.035em;
  line-height: 1.35;
}

html[data-language="en"] .article-card-odyssey .article-copy h3,
html[data-language="en"] .writing-archive-item h2 {
  font-family: Georgia, "Times New Roman", serif;
}

.thumbnail-browser-bar {
  position: absolute;
  top: 1.15rem;
  right: 1.15rem;
  left: 1.15rem;
  height: 1px;
  background: rgba(34, 34, 31, 0.22);
}

.thumbnail-browser-bar::before {
  position: absolute;
  top: -2px;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--olive);
  box-shadow: 9px 0 0 rgba(34, 34, 31, 0.2);
  content: "";
}

.thumbnail-title-line,
.thumbnail-copy-line {
  display: block;
  width: 54%;
  height: 3px;
  margin-top: 0.34rem;
  background: rgba(34, 34, 31, 0.62);
}

.thumbnail-title-line-long {
  width: 83%;
  margin-top: 0;
}

.thumbnail-copy-line {
  width: 70%;
  height: 1px;
  margin-top: 1.05rem;
  background: rgba(34, 34, 31, 0.28);
}

.thumbnail-copy-line-short {
  width: 45%;
  margin-top: 0.3rem;
}

.article-copy {
  display: flex;
  flex-direction: column;
  padding: 1.7rem;
}

.article-meta {
  margin: 0 0 auto;
  color: var(--quiet);
  font-size: 0.56rem;
}

.article-copy h3 {
  margin: 2rem 0 0.55rem;
  font-size: clamp(1.3rem, 2vw, 1.58rem);
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 1.12;
  transition: color 180ms ease;
}

.article-card:hover h3 {
  color: var(--olive);
}

.article-copy > p:not(.article-meta) {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.read-link {
  display: flex;
  justify-content: space-between;
  margin-top: 1.45rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.69rem;
}

/* 6. Projects -------------------------------------------------------------- */
.projects-section {
  padding: 6rem 0 8rem;
}

.project-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.project-filters {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filter-button {
  padding: 0.48rem 0.68rem;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--quiet);
  cursor: pointer;
  font-size: 0.56rem;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.filter-button:hover {
  color: var(--ink);
}

.filter-button.active {
  border-color: var(--line-strong);
  background: rgba(238, 233, 222, 0.72);
  color: var(--olive);
}

.project-summary {
  margin: 0;
  color: var(--quiet);
  font-size: 0.56rem;
}

.project-list {
  position: relative;
  border-top: 1px solid var(--line-strong);
}

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

.project-item.expanded {
  background: rgba(238, 233, 222, 0.24);
}

.project-button {
  display: grid;
  width: 100%;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto 1.5rem;
  align-items: center;
  gap: 1rem;
  padding: 1.55rem 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.project-number,
.project-year {
  color: var(--quiet);
  font-size: 0.57rem;
}

.project-title {
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  letter-spacing: -0.025em;
  transition: color 180ms ease, transform 180ms ease;
}

.project-button:hover .project-title {
  color: var(--olive);
  transform: translateX(0.25rem);
}

.project-toggle {
  color: var(--muted);
  font-size: 1rem;
}

.project-details {
  padding: 0 3rem 1.6rem 3.5rem;
}

.project-details p {
  max-width: 31rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

/* 7. Notes and footer ------------------------------------------------------ */
.notes-section {
  padding: 5rem 0 9rem;
  border-top: 1px solid var(--line);
}

.note-copy {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  line-height: 1.5;
}

.logs-section {
  padding: 5rem 0 8rem;
  border-top: 1px solid var(--line);
}

.learning-log-list {
  width: min(100%, 580px);
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.learning-log-item {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.25rem;
  align-items: baseline;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--line);
}

.learning-log-item time,
.learning-log-status,
.logs-view-all,
.featured-view-all,
.writing-archive-meta,
.writing-archive-link {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.06em;
}

.learning-log-item time {
  color: var(--quiet);
  font-size: 0.63rem;
  text-transform: uppercase;
}

.learning-log-item p {
  margin: 0;
  color: #46443f;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.04rem;
  line-height: 1.6;
}

.learning-log-status {
  margin: 1.25rem 0 0;
  color: var(--quiet);
  font-size: 0.62rem;
  line-height: 1.6;
}

.logs-view-all,
.featured-view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.66rem;
  transition: color 180ms ease, gap 180ms ease;
}

.logs-view-all:hover,
.featured-view-all:hover {
  gap: 0.9rem;
  color: var(--ink);
}

.featured-view-all {
  margin-top: 1.75rem;
}

.logs-archive {
  --essay-measure: 70ch;
  --essay-space-4: 4rem;

  width: 100%;
  max-width: var(--essay-measure);
  min-width: 0;
  margin: 0 auto;
}

.logs-archive-header {
  padding: clamp(4.5rem, 10vh, 7rem) 0 3rem;
}

.logs-archive-header h1 {
  max-width: 10ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.25rem, 8vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.logs-archive-header > p:last-child {
  max-width: 48ch;
  margin: 1.75rem 0 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.7;
}

.learning-log-list-archive {
  width: 100%;
}

.writing-archive {
  --essay-measure: 70ch;
  --essay-space-4: 4rem;

  width: 100%;
  max-width: var(--essay-measure);
  min-width: 0;
  margin: 0 auto;
}

.writing-archive-header {
  padding: clamp(4.5rem, 10vh, 7rem) 0 3rem;
}

.writing-archive-header h1 {
  max-width: 10ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.25rem, 8vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.writing-archive-header > p:last-child {
  max-width: 48ch;
  margin: 1.75rem 0 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.7;
}

.writing-archive-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.writing-archive-list > li {
  border-bottom: 1px solid var(--line);
}

.writing-archive-item {
  display: block;
  padding: 2.4rem 0 2.1rem;
}

.writing-archive-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  color: var(--quiet);
  font-size: 0.59rem;
  line-height: 1.5;
  text-transform: uppercase;
}

.writing-archive-item h2 {
  max-width: 22ch;
  margin: 1.1rem 0 0.7rem;
  font-family: "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  font-weight: 520;
  letter-spacing: -0.04em;
  line-height: 1.3;
  transition: color 180ms ease;
}

.writing-archive-item > p {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font-family: "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.75;
}

.writing-archive-link {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.64rem;
  transition: color 180ms ease;
}

.writing-archive-item:hover h2,
.writing-archive-item:hover .writing-archive-link {
  color: var(--olive);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 0.68rem;
}

.site-footer p {
  margin: 0;
}

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

/* 8. Article page ---------------------------------------------------------- */
.article-page {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 5vw, 4.5rem) 5rem;
}

.article-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.6rem;
}

.article-nav a:hover {
  color: var(--ink);
}

.article-nav-home {
  margin-left: auto;
}

[data-language-content][hidden] {
  display: none !important;
}

.article-body {
  --essay-measure: 70ch;
  --essay-figure-width: 36rem;
  --essay-portrait-width: 28rem;
  --essay-space-1: 0.75rem;
  --essay-space-2: 1.5rem;
  --essay-space-3: 2.5rem;
  --essay-space-4: 4rem;

  width: 100%;
  max-width: var(--essay-measure);
  min-width: 0;
  margin: 0 auto;
}

.article-header,
.article-prose,
.article-footer {
  width: 100%;
  max-width: none;
  margin-right: 0;
  margin-left: 0;
}

.article-header {
  padding: clamp(4.5rem, 10vh, 7rem) 0 var(--essay-space-3);
}

.article-category,
.article-date {
  color: var(--quiet);
  font-size: 0.6rem;
  line-height: 1.5;
}

.article-category {
  margin: 0 0 var(--essay-space-2);
}

.article-header h1 {
  max-width: 12ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 6.2rem);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.article-header-chinese h1 {
  max-width: 15ch;
  font-family: "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  font-size: clamp(2.65rem, 6vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 1.12;
}

html[data-language="en"] .article-header-chinese h1 {
  max-width: 18ch;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.05;
}

.article-deck {
  max-width: 60ch;
  margin: var(--essay-space-2) 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  line-height: 1.65;
}

.article-date {
  margin: var(--essay-space-1) 0 0;
}

.article-prose {
  margin: 0;
}

.article-prose p {
  margin: 0 0 var(--essay-space-2);
  color: #4e4c47;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.07rem;
  line-height: 1.9;
}

.article-prose-chinese p {
  color: #44423e;
  font-family: "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.95;
}

.article-prose-chinese strong {
  color: var(--ink);
  font-weight: 650;
}

.article-prose-chinese ul {
  margin: 0 0 var(--essay-space-2);
  padding-left: 1.35rem;
  color: #44423e;
  font-family: "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  line-height: 1.95;
}

.article-prose:not(.article-prose-chinese) ul {
  margin: 0 0 var(--essay-space-2);
  padding-left: 1.35rem;
  color: #4e4c47;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.07rem;
  line-height: 1.9;
}

.article-prose:not(.article-prose-chinese) li + li {
  margin-top: 0.4rem;
}

.article-prose-chinese li + li {
  margin-top: 0.4rem;
}

.article-prose-chinese blockquote p {
  margin-bottom: 0.55rem;
  color: inherit;
  font-size: 1.16rem;
  line-height: 1.7;
}

.article-prose-chinese blockquote p:last-child {
  margin-bottom: 0;
}

.article-figure {
  width: min(100%, var(--essay-figure-width));
  max-width: 100%;
  min-width: 0;
  margin: var(--essay-space-3) 0;
}

.article-figure img {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  border-radius: 3px;
  object-fit: contain;
}

.article-figure-portrait {
  max-width: var(--essay-portrait-width);
}

.article-figure figcaption {
  margin: 0.6rem 0 0;
  color: var(--quiet);
  font-size: 0.64rem;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-align: left;
}

.article-prose .article-emphasis {
  margin: var(--essay-space-3) 0;
  color: var(--olive);
  font-size: 1.24rem;
  line-height: 1.75;
}

.article-prose .article-lead {
  margin-bottom: var(--essay-space-3);
  color: var(--ink);
  font-size: 1.28rem;
  line-height: 1.72;
}

.article-prose h2 {
  margin: 4rem 0 1.25rem;
  font-size: 1.35rem;
  font-weight: 570;
  letter-spacing: -0.03em;
}

.article-prose-chinese h2 {
  font-family: "Songti SC", "STSong", Georgia, "Times New Roman", serif;
  line-height: 1.45;
}

.article-prose blockquote {
  margin: var(--essay-space-3) 0;
  padding: 0 0 0 var(--essay-space-2);
  border-left: 2px solid var(--olive);
  color: var(--olive);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.7;
}

.article-prose hr {
  width: 3rem;
  height: 1px;
  margin: var(--essay-space-4) 0;
  border: 0;
  background: var(--line-strong);
}

.article-footer {
  display: flex;
  justify-content: space-between;
  margin-top: var(--essay-space-4);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.article-footer p {
  margin: 0;
}

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

/* 9. Responsive reflow: two columns become one ---------------------------- */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 0 clamp(1.5rem, 7vw, 4rem);
  }

  .profile {
    position: static;
    height: auto;
    min-height: min(720px, 85svh);
    padding: 12vh 0 3rem;
  }

  .profile h1 {
    font-size: clamp(3.5rem, 11vw, 4.25rem);
  }

  .site-nav {
    margin-top: 3.5rem;
  }

  .writing-section {
    min-height: auto;
    padding: 6rem 0 7rem;
  }

  .projects-section {
    padding-top: 4rem;
  }
}

/* A phone card stacks the image above its text instead of squeezing it. */
@media (max-width: 600px) {
  .article-page {
    padding-right: 1.25rem;
    padding-bottom: 3.5rem;
    padding-left: 1.25rem;
  }

  .article-card {
    grid-template-columns: 1fr;
  }

  .article-thumbnail {
    min-height: 190px;
  }

  .article-meta {
    margin-bottom: 1.7rem;
  }

  .article-copy h3 {
    margin-top: 0;
  }

  .project-button {
    grid-template-columns: 1.8rem minmax(0, 1fr) 1.25rem;
    gap: 0.65rem;
  }

  .project-controls {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .project-year {
    display: none;
  }

  .project-details {
    padding-left: 2.45rem;
  }

  .site-footer,
  .article-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.75rem;
  }

  .article-header {
    padding-top: 4rem;
    padding-bottom: 2.25rem;
  }

  .article-header-chinese h1 {
    font-size: clamp(2.25rem, 10vw, 3.35rem);
    line-height: 1.15;
  }

  .article-deck {
    margin-top: 1.25rem;
  }

  .article-prose-chinese p {
    font-size: 1.02rem;
    line-height: 1.9;
  }

  .article-prose-chinese ul {
    font-size: 1.02rem;
    line-height: 1.9;
  }

  .article-prose .article-lead {
    font-size: 1.18rem;
  }

  .article-prose blockquote {
    padding-left: 1rem;
  }

  .article-prose-chinese blockquote p {
    font-size: 1.08rem;
  }

  .article-figure {
    max-width: 100%;
  }

  .learning-log-item {
    grid-template-columns: 3.75rem minmax(0, 1fr);
    gap: 0.9rem;
  }

  .learning-log-item p {
    font-size: 1rem;
  }

  .logs-archive-header {
    padding-top: 4rem;
    padding-bottom: 2.5rem;
  }

  .logs-archive-header h1 {
    font-size: clamp(2.8rem, 15vw, 4.3rem);
  }

  .writing-archive-header {
    padding-top: 4rem;
    padding-bottom: 2.5rem;
  }

  .writing-archive-header h1 {
    font-size: clamp(2.8rem, 15vw, 4.3rem);
  }

  .writing-archive-item {
    padding: 2rem 0 1.8rem;
  }
}

/* Respect visitors who ask their device to reduce animation. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.35;
  }

  50% {
    opacity: 1;
  }
}

/* Homepage: retain the original editorial grid; only its right pane scrolls. */
.home-page .content-column { container-type: inline-size; }
.home-page .site-nav a { transform: none; transition: color 200ms ease; }
.home-page .nav-label { display: inline-block; pointer-events: none; transform-origin: left center; transition: transform 200ms ease; }
.home-page .site-nav a:hover .nav-label,
.home-page .site-nav a:focus-visible .nav-label { transform: scale(1.03); }
.home-page .site-nav a::before { width: .7rem; opacity: 0; transition: opacity 200ms ease; }
.home-page .site-nav a:hover::before,
.home-page .site-nav a:focus-visible::before,
.home-page .site-nav a[aria-current="location"]::before { opacity: 1; }
.home-page .site-nav a[aria-current="location"] { color: var(--ink); }
.nav-phrase { position: absolute; top: 50%; left: calc(100% + 1rem); transform: translateY(-50%); width: 24ch; pointer-events: none; color: var(--muted); background: var(--paper); font: italic .7rem/1.45 Georgia, serif; }
.home-page .logs-section { border-top: 0; padding: 6rem 0 2rem; }
.home-page .writing-section { border-top: 1px solid var(--line); }
.home-page section { scroll-margin-top: 2rem; }
.learning-subtitle { color: var(--muted); font: 1.25rem/1.5 Georgia, serif; margin: -.25rem 0 1.5rem; }
.learning-grid { display: grid; gap: 2rem; }
.learning-grid > * { min-width: 0; }
.learning-label { margin: 0 0 1.25rem; color: var(--muted); font: 500 .65rem/1.5 "SFMono-Regular", Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.learning-empty, .calendar-caption { color: var(--muted); font-size: .78rem; line-height: 1.7; }
.learning-empty { margin: 0; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
.activity-calendar { width: 100%; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; border-block: 1px solid var(--line); }
.calendar-toolbar p { margin: .75rem 0; font-size: .75rem; }
.calendar-toolbar button, .calendar-grid button { border: 0; background: transparent; cursor: pointer; }
.calendar-toolbar button { padding: .65rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: .3rem; padding-block: .75rem; border-bottom: 1px solid var(--line); }
.calendar-grid > * { min-width: 0; min-height: 2rem; display: grid; place-items: center; font: .68rem/1.5 "SFMono-Regular", Consolas, monospace; }
.calendar-grid .weekday { color: var(--muted); }
.calendar-grid .calendar-day { min-height: 1.75rem; position: relative; border: 1px solid transparent; border-radius: 2px; background: rgba(34,34,31,.035); color: var(--quiet); padding-bottom: 4px; }
.calendar-grid button.calendar-day { color: var(--ink); background: rgba(34,34,31,.035); }
.calendar-grid button.calendar-day::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; background: #399677; border-radius: 50%; }
.calendar-grid .today { border-color: var(--line-strong); }
.calendar-grid button:hover { background: var(--paper-deep); }
.calendar-caption { margin: .5rem 0 0; }
.recent-note { width: 100%; padding: 1rem 0; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: left; }
.recent-note time { color: var(--quiet); font-size: .65rem; }
.recent-note strong { display: block; margin: .5rem 0; font: 500 1.1rem/1.4 Georgia, serif; }
.recent-note p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.6; }
#learning-note { width: min(90vw,42rem); max-height: 80dvh; overflow: auto; padding: 2rem; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink); }
#learning-note::backdrop { background: rgba(34,34,31,.3); }
.note-controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; position: sticky; top: -2rem; z-index: 1; padding-block: .75rem; background: var(--paper); }
.note-close { display: block; margin-left: auto; border: 0; background: none; cursor: pointer; }
#learning-note-body article + article { border-top: 1px solid var(--line); margin-top: 2rem; }
#learning-note-body p { white-space: pre-wrap; line-height: 1.8; }
@media (min-width: 901px) {
  body.home-page { height: 100dvh; overflow: hidden; }
  .home-page .main-layout { height: 100dvh; min-height: 0; grid-template-columns: minmax(240px,.8fr) minmax(0,1.2fr); }
  .home-page .profile { top: 12vh; height: 76vh; min-height: 0; }
  .home-page .content-column { height: 100dvh; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
}
@media (min-width: 901px) and (max-height: 740px) {
  .home-page .profile { top: 4vh; height: 92vh; padding-top: .5rem; }
  .home-page .site-nav { margin-top: 1.5rem; }
}
@media (max-width: 900px) {
  .home-page .profile { min-height: 0; gap: 2.5rem; }
  .home-page .site-nav { margin-top: 0; }
  .home-page .logs-section { padding-top: 2rem; }
  .home-page .content-column { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .home-page .nav-label, .home-page .site-nav a::before { transition: none; }
}

/* Daily reports retain paragraph breaks in the archive, too. */
.logs-archive .learning-log-item p { white-space: pre-wrap; overflow-wrap: anywhere; }
.log-entry { min-width: 0; }
.log-prose { overflow-wrap: anywhere; line-height: 1.9; }
.log-prose p { white-space: pre-wrap; margin: 1.2em 0; }
.log-prose strong { font-weight: 700; }
.log-prose figure { margin: 1.5em 0; }
.log-prose img { display: block; width: 100%; height: auto; border-radius: 8px; }
.log-prose code { font-family: monospace; background: var(--paper-deep); padding: .1em .25em; border-radius: 3px; }
.log-prose h4 { margin: 2em 0 .75em; color: inherit; font-size: 1.12em; line-height: 1.5; }
.log-prose h5 { margin: 1.5em 0 .6em; color: inherit; font-size: 1em; line-height: 1.5; }
.log-prose pre { max-width: 100%; overflow-x: auto; margin: 1.3em 0; padding: 1em; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-deep); line-height: 1.6; font-size: .85em; white-space: pre; tab-size: 4; }
.log-prose pre code { padding: 0; background: none; border-radius: 0; }
.log-prose a { color: #b45f55; text-decoration: underline; text-underline-offset: .15em; }
.log-table { overflow-x: auto; margin: 1.5em 0; }
.log-table table { width: 100%; border-collapse: collapse; font-size: .85em; }
.log-table th, .log-table td { padding: .65em; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
