:root {
  color-scheme: light;
  --bg: #f4efe5;
  --panel: #fbf8f1;
  --ink: #24201d;
  --muted: #70675f;
  --line: #d8cfc0;
  --accent: #9b481d;
  --accent-dark: #793715;
  --orange: #e85d04;
  --orange-light: #ff9f1c;
  --orange-text: #a43f00;
  --content-width: 1040px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 4%, rgba(255, 159, 28, 0.13), transparent 28rem),
    linear-gradient(135deg, rgba(121, 55, 21, 0.045), transparent 42rem),
    var(--bg);
  color: var(--ink);
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

a:focus-visible {
  border-radius: 3px;
  outline: 3px solid var(--accent-dark);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus {
  color: #fff;
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid rgba(217, 210, 198, 0.85);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(10px);
}

.header-inner,
.page-width,
.site-footer {
  width: min(calc(100% - 40px), var(--content-width));
  margin-inline: auto;
}

.header-inner {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 2px solid #d66b18;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #ffd27a 0 16%, transparent 17%),
    linear-gradient(135deg, var(--orange-light), var(--orange));
  box-shadow: 0 3px 10px rgba(232, 93, 4, 0.22);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 20px;
}

.site-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-weight: 720;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent-dark);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--orange-text);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.lede {
  max-width: 44rem;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.28rem);
  line-height: 1.7;
}

.writings-layout,
.article-layout {
  display: grid;
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
  gap: clamp(40px, 7vw, 88px);
  align-items: start;
  padding-block: clamp(48px, 8vw, 92px) clamp(72px, 10vw, 120px);
}

.writings-intro {
  display: flex;
  min-height: min(62vh, 620px);
  grid-column: 2;
  grid-row: 1;
  flex-direction: column;
  justify-content: center;
}

.writings-intro h1 {
  max-width: 13ch;
}

.writings-layout > .writing-sidebar {
  grid-column: 1;
  grid-row: 1;
}

.writing-sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 6px clamp(20px, 3vw, 34px) 6px 6px;
  border-right: 1px solid var(--line);
  scrollbar-gutter: stable;
}

.writing-sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.writing-sidebar-heading .eyebrow {
  margin-bottom: 7px;
}

.writing-sidebar h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.writing-sidebar h2 a {
  color: var(--ink);
  text-decoration: none;
}

.writing-sidebar h2 a:hover,
.writing-sidebar h2 a[aria-current="page"] {
  color: var(--accent-dark);
}

.writing-count {
  display: inline-grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  padding-inline: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.collection-empty {
  margin: 24px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.6;
}

.sidebar-writing-list {
  margin: 20px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.sidebar-writing-list li + li {
  margin-top: 6px;
}

.sidebar-writing-link {
  display: grid;
  min-height: 52px;
  gap: 5px;
  padding: 12px 14px;
  border-left: 3px solid transparent;
  border-radius: 0 7px 7px 0;
  color: var(--ink);
  text-decoration: none;
}

.sidebar-writing-link:hover {
  border-left-color: var(--orange);
  background: rgba(255, 253, 248, 0.72);
  color: var(--accent-dark);
}

.sidebar-writing-link[aria-current="page"] {
  border-left-color: var(--accent);
  background: rgba(13, 118, 110, 0.09);
  color: var(--accent-dark);
}

.sidebar-writing-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar-writing-link time,
.article-header time {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.article-layout > .writing-sidebar {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.article-header {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: clamp(16px, 4vw, 46px) 0 18px;
}

.article-column {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  width: 100%;
  max-width: 760px;
}

.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font-weight: 750;
  text-decoration: none;
}

.article-header h1 {
  max-width: 18ch;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.1;
}

.article-summary {
  max-width: 42rem;
  margin: 24px 0 18px;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.65;
}

.thought-threads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.thought-threads li {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
}

.article-body {
  padding-block: 18px 64px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 2vw, 1.2rem);
  line-height: 1.78;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body h2,
.article-body h3 {
  margin: 2.2em 0 0.65em;
  color: var(--ink);
  line-height: 1.2;
}

.article-body h2 {
  font-size: 1.7em;
}

.article-body h3 {
  font-size: 1.3em;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote {
  margin-block: 1.2em;
}

.article-body blockquote {
  margin-inline: 0;
  padding-left: 22px;
  border-left: 3px solid var(--orange);
  color: var(--muted);
  font-style: italic;
}

.article-body img {
  max-width: 100%;
  height: auto;
}

.article-jump-link {
  margin-bottom: 2rem;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
}

.article-jump-link a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--accent-dark);
  font-weight: 750;
  text-decoration: none;
}

.article-jump-link a:hover {
  border-color: var(--orange);
  color: var(--ink);
}

#water-cooled-pcs {
  scroll-margin-top: 24px;
}

.writing-media {
  margin: 2rem 0;
}

.writing-media--compact,
.writing-media--portrait {
  max-width: 600px;
  margin-inline: auto;
}

.writing-media img {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.72);
}

.writing-media figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.5;
  text-align: center;
}

.writing-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.writing-video-frame {
  width: min(100%, 400px);
  aspect-ratio: 9 / 16;
  margin-inline: auto;
}

.writing-video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 10px;
  background: #000;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-footer time {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-style: italic;
}

.site-footer {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 680px) {
  .header-inner,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-inner {
    padding-block: 14px;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .site-footer {
    justify-content: center;
    padding-block: 22px;
  }

  .article-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .writing-gallery {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .writings-layout,
  .article-layout {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: 40px;
  }

  .writings-intro,
  .article-header {
    grid-column: 1;
    grid-row: 1;
  }

  .writings-layout > .writing-sidebar,
  .article-layout > .writing-sidebar {
    grid-column: 1;
    grid-row: 2;
  }

  .article-column {
    grid-column: 1;
    grid-row: 3;
  }

  .writing-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 253, 248, 0.68);
  }

  .sidebar-writing-list {
    max-height: 230px;
    overflow-y: auto;
    padding-right: 4px;
  }

  .writings-intro {
    min-height: auto;
    padding-block: 12px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
