﻿/* ==========================================================================
   Editorial redesign for the public site.
   Loaded after style.css; new components are ed-* prefixed, article content
   keeps its existing classes and gets typographic overrides.
   ========================================================================== */

:root {
  --ed-paper: #f6f2ea;
  --ed-paper-top: #f8f5ee;
  --ed-paper-soft: #fbf8f2;
  --ed-card: #fffdf8;
  --ed-ink: #17140f;
  --ed-ink-soft: #3f3a30;
  --ed-muted: #746c5e;
  --ed-rule: #e3dccd;
  --ed-rule-strong: #cdc3ae;
  --ed-accent: #17497c;
  --ed-accent-soft: #e9eef5;
  --ed-rust: #a1451b;
  --ed-rust-soft: #f6e7dd;
  --ed-header-bg: rgba(246, 242, 234, 0.82);
  --ed-invert-bg: #17140f;
  --ed-invert-fg: #f7f2e8;
  --ed-code-bg: #221f1a;
  --ed-code-fg: #efe9dd;
  --ed-code-inline: #efe9dd;
  --ed-highlight: rgba(23, 73, 124, 0.05);
  --ed-highlight-strong: rgba(23, 73, 124, 0.16);
  --ed-shadow-color: rgba(23, 20, 15, 0.55);
  --ed-serif: Georgia, "Times New Roman", "Songti SC", "STSong", "Source Han Serif SC", "Source Han Serif CN", "Noto Serif SC", "Noto Serif CJK SC", SimSun, serif;
  --ed-sans: "HarmonyOS Sans SC", "HarmonyOS Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ed-mono: ui-monospace, "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  --ed-shell: 1180px;
  --ed-rail: 322px;
  --ed-header-h: 64px;
  color-scheme: light;
}

/* Dark theme. The effective theme is resolved before paint by the inline script
   in main.html (data-theme="light|dark"), so there is one source of truth here. */
:root[data-theme="dark"] {
  --ed-paper: #131110;
  --ed-paper-top: #191614;
  --ed-paper-soft: #1a1714;
  --ed-card: #1d1a16;
  --ed-ink: #ece5d8;
  --ed-ink-soft: #cfc6b6;
  --ed-muted: #a49b8b;
  --ed-rule: #2f2a23;
  --ed-rule-strong: #4c4438;
  --ed-accent: #93b8dd;
  --ed-accent-soft: #1c2836;
  --ed-rust: #e29267;
  --ed-rust-soft: #34231a;
  --ed-header-bg: rgba(19, 17, 16, 0.86);
  --ed-invert-bg: #ece5d8;
  --ed-invert-fg: #17140f;
  --ed-code-bg: #0e0c0a;
  --ed-code-fg: #d9d1c3;
  --ed-code-inline: #2a251f;
  --ed-highlight: rgba(147, 184, 221, 0.1);
  --ed-highlight-strong: rgba(147, 184, 221, 0.24);
  --ed-shadow-color: rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

html {
  scroll-padding-top: calc(var(--ed-header-h) + 18px);
  scroll-behavior: smooth;
}

body {
  background: var(--ed-paper);
  background-image: linear-gradient(180deg, var(--ed-paper-top), var(--ed-paper) 320px);
  background-repeat: no-repeat;
  color: var(--ed-ink);
  font-family: var(--ed-sans);
  padding-bottom: 0;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

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

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

.ed-promo:focus-visible,
.ed-tool:focus-visible,
.ed-tile:focus-visible {
  outline-offset: 4px;
}

.ed-shell {
  width: min(var(--ed-shell), calc(100% - 48px));
  margin-inline: auto;
}

.ed-serif {
  font-family: var(--ed-serif);
}

.ed-kicker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ed-rust);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ed-kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
}

.ed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  color: var(--ed-muted);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.ed-meta a {
  color: var(--ed-ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--ed-rule-strong);
}

.ed-meta a:hover {
  color: var(--ed-rust);
  border-bottom-color: var(--ed-rust);
}

/* ---------- header ---------- */

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

@supports ((-webkit-backdrop-filter: blur(6px)) or (backdrop-filter: blur(6px))) {
  .ed-header {
    background: var(--ed-header-bg);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    backdrop-filter: saturate(140%) blur(10px);
  }
}

.ed-header-inner {
  display: flex;
  min-height: var(--ed-header-h);
  align-items: center;
  gap: 28px;
}

.ed-brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.ed-brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ed-ink);
  border: 1px solid var(--ed-rule-strong);
  border-radius: 50%;
  background: var(--ed-card);
  font-size: 16px;
  line-height: 1;
}

.ed-brand-text {
  display: grid;
  line-height: 1.15;
}

.ed-brand-text strong {
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ed-brand-text em {
  color: var(--ed-muted);
  font-size: 10.5px;
  font-style: normal;
  letter-spacing: 0.14em;
}

.ed-nav {
  display: flex;
  min-width: 0;
  flex: 1;
  gap: 2px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.ed-nav::-webkit-scrollbar {
  display: none;
}

.ed-nav a {
  position: relative;
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 12px;
  color: var(--ed-ink-soft);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.16s ease;
}

.ed-nav a::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 4px;
  left: 12px;
  height: 1px;
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.ed-nav a:hover,
.ed-nav a.is-active {
  color: var(--ed-rust);
}

.ed-nav a:hover::after,
.ed-nav a.is-active::after {
  opacity: 1;
  transform: none;
}

.ed-nav .ed-nav-split {
  width: 1px;
  height: 18px;
  margin: 0 8px;
  background: var(--ed-rule-strong);
}

.ed-header-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

.ed-search {
  display: flex;
  height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--ed-rule);
  border-radius: 999px;
  background: var(--ed-card);
  transition: border-color 0.18s ease, width 0.2s ease;
}

.ed-search:focus-within {
  border-color: var(--ed-rule-strong);
}

.ed-search svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--ed-muted);
}

.ed-search input {
  width: 118px;
  padding: 0;
  color: var(--ed-ink);
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.ed-search input::placeholder {
  color: var(--ed-muted);
  opacity: 0.8;
}

/* Logged-in name only; the login entry lives in the comment form. */
.ed-user {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 10px;
  color: var(--ed-muted);
  font-size: 12.5px;
  white-space: nowrap;
}

/* Header icon buttons share one shape: same size, radius and border. */
.ed-theme-btn,
.ed-menu-btn {
  width: 40px;
  height: 40px;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ed-ink-soft);
  border: 1px solid var(--ed-rule-strong);
  border-radius: 10px;
  background: var(--ed-card);
  cursor: pointer;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.ed-theme-btn:hover,
.ed-menu-btn:hover {
  color: var(--ed-rust);
  border-color: var(--ed-rust);
}

.ed-theme-btn {
  display: grid;
  place-items: center;
  /* Circle on desktop, rounded square at phone widths; the value follows the
     viewport so dragging the window morphs it instead of snapping. */
  border-radius: clamp(10px, calc(10px + (100vw - 780px) * 0.0455), 20px);
  transition: color 0.16s ease, border-color 0.16s ease, border-radius 0.16s ease;
}

.ed-menu-btn {
  display: none;
}

.ed-theme-btn svg,
.ed-menu-btn svg {
  width: 18px;
  height: 18px;
}

.ed-theme-btn .theme-sun {
  display: none;
}

:root[data-theme="dark"] .ed-theme-btn .theme-moon {
  display: none;
}

:root[data-theme="dark"] .ed-theme-btn .theme-sun {
  display: block;
}

/* ---------- home ---------- */

.ed-home {
  padding: 40px 0 72px;
}

.ed-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
  gap: 46px;
  align-items: center;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--ed-rule);
}

.ed-hero--text {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.ed-hero--text .ed-hero-copy {
  max-width: 46em;
}

.ed-hero-copy {
  display: grid;
  gap: 18px;
  align-content: start;
}

.ed-hero-copy h1 {
  margin: 0;
  font-family: var(--ed-serif);
  font-size: clamp(30px, 3.6vw, 46px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.01em;
}

.ed-hero-copy h1 a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}

.ed-hero-copy h1 a:hover {
  color: var(--ed-rust);
}

.ed-hero-copy > p {
  margin: 0;
  max-width: 46em;
  color: var(--ed-ink-soft);
  font-size: 15.5px;
  line-height: 1.9;
}

.ed-hero-more {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-self: start;
  color: var(--ed-rust);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
}

.ed-hero-figure {
  position: relative;
  margin: 0;
  padding: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

/* No white mat: the screenshot sits directly on the paper with a soft shadow so
   it blends with the page instead of looking like a pasted photo. */
.ed-hero-figure a {
  display: block;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 26px 54px -38px var(--ed-shadow-color);
}

.ed-hero-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  border: 0;
  border-radius: 10px;
  background: var(--ed-paper-soft);
  transition: transform 0.45s ease;
}

.ed-hero-figure:hover img {
  transform: scale(1.015);
}

.ed-hero-figure figcaption {
  margin-top: 10px;
  padding: 0 4px 2px;
  color: var(--ed-muted);
  font-family: var(--ed-serif);
  font-size: 12px;
}

.ed-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ed-rail);
  gap: 56px;
  padding-top: 40px;
}

.ed-home .ed-main {
  display: grid;
  gap: 54px;
}

.ed-home .ed-block {
  display: grid;
  gap: 16px;
}

.ed-block-head {
  display: flex;
  gap: 18px;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ed-ink);
}

.ed-block-head h2 {
  margin: 0;
  font-family: var(--ed-serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.ed-block-head p {
  margin: 0;
  color: var(--ed-muted);
  font-size: 12.5px;
}

.ed-block-head .ed-more {
  color: var(--ed-muted);
  font-size: 12.5px;
  text-decoration: none;
  white-space: nowrap;
}

.ed-block-head .ed-more:hover {
  color: var(--ed-rust);
}

.ed-head-desc {
  margin: 4px 0 0;
  color: var(--ed-muted);
  font-size: 12.5px;
}

.ed-block-foot {
  display: flex;
  justify-content: flex-end;
}

.ed-block-foot .ed-more {
  color: var(--ed-ink-soft);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid var(--ed-rule-strong);
  padding-bottom: 2px;
}

.ed-block-foot .ed-more:hover {
  color: var(--ed-rust);
  border-bottom-color: var(--ed-rust);
}

.ed-list {
  display: grid;
}

.ed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 24px;
  align-items: start;
  padding: 24px 0;
  border-bottom: 1px solid var(--ed-rule);
}

.ed-row:last-child {
  border-bottom: 0;
}

.ed-row-main {
  display: grid;
  gap: 8px;
  text-decoration: none;
}

.ed-row-index {
  color: var(--ed-muted);
  font-family: var(--ed-serif);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.ed-row h2,
.ed-row h3 {
  margin: 0;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 21.5px;
  font-weight: 700;
  line-height: 1.42;
}

.ed-row-main:hover h2,
.ed-row-main:hover h3 {
  color: var(--ed-rust);
}

.ed-row p {
  margin: 0;
  color: var(--ed-ink-soft);
  font-size: 14px;
  line-height: 1.85;
}

.ed-row-thumb {
  display: block;
  overflow: hidden;
  border: 1px solid var(--ed-rule);
  border-radius: 3px;
  background: var(--ed-card);
}

.ed-row-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.ed-row-thumb:hover img {
  transform: scale(1.04);
}

.ed-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 34px;
}

.ed-tile {
  display: grid;
  gap: 7px;
  padding: 18px 0;
  border-bottom: 1px solid var(--ed-rule);
  text-decoration: none;
}

.ed-tile time {
  color: var(--ed-muted);
  font-family: var(--ed-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.ed-tile h3 {
  margin: 0;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.45;
}

.ed-tile:hover h3 {
  color: var(--ed-rust);
}

.ed-tile p {
  margin: 0;
  color: var(--ed-muted);
  font-size: 13px;
  line-height: 1.8;
}

/* ---------- rail ---------- */

.ed-rail {
  display: grid;
  gap: 26px;
  align-content: start;
}

.ed-rail-sticky {
  position: sticky;
  top: calc(var(--ed-header-h) + 24px);
  display: grid;
  gap: 26px;
}

.ed-promo {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 16px 18px;
  overflow: hidden;
  color: var(--ed-ink);
  border: 1px solid var(--ed-rule);
  border-top: 3px solid var(--ed-accent);
  border-radius: 4px;
  background: var(--ed-card);
  text-decoration: none;
  transition: border-color 0.18s ease;
}

.ed-promo:hover {
  border-color: var(--ed-rule-strong);
  border-top-color: var(--ed-accent);
}

.ed-promo-label {
  color: var(--ed-accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ed-promo h3,
.ed-promo h2 {
  margin: 0;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

.ed-promo p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ed-muted);
  font-size: 12.5px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ed-promo-cta {
  justify-self: start;
  color: var(--ed-rust);
  font-size: 12px;
  font-weight: 700;
}

.ed-promo:hover .ed-promo-cta {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ed-promo--accent {
  border-top-color: var(--ed-rust);
}

.ed-promo--accent .ed-promo-label {
  color: var(--ed-rust);
}

.ed-card {
  padding: 20px;
  border: 1px solid var(--ed-rule);
  border-radius: 4px;
  background: var(--ed-card);
}

.ed-card h2,
.ed-card h3 {
  margin: 0;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* The rail is a stack of sections separated by one consistent hairline; color is
   reserved for the labels, not for the separators. */
.ed-author,
.ed-promo,
.ed-cats {
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--ed-rule-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ed-author {
  display: grid;
  gap: 12px;
  padding-top: 0;
  border-top: 0;
}

.ed-promo--accent {
  border-top-color: var(--ed-rule-strong);
}

.ed-author-top {
  display: flex;
  gap: 14px;
  align-items: center;
}

.ed-author-avatar {
  display: block;
  width: 56px;
  height: 56px;
  flex: none;
  padding: 2px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--ed-rust), var(--ed-rule-strong), var(--ed-accent), var(--ed-rust));
  transition: transform 0.3s ease;
}

.ed-author:hover .ed-author-avatar {
  transform: rotate(-4deg) scale(1.04);
}

.ed-author-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid var(--ed-card);
  border-radius: 50%;
  object-fit: cover;
}

.ed-author-name {
  margin: 0;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.ed-author-top > div {
  display: grid;
  gap: 3px;
}

.ed-author-role {
  margin: 0;
  color: var(--ed-rust);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.ed-author-motto {
  margin: 0;
  padding-left: 10px;
  color: var(--ed-muted);
  border-left: 2px solid var(--ed-rule);
  font-size: 12.5px;
  line-height: 1.8;
}

.ed-author-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  margin: 0;
  color: var(--ed-muted);
  font-size: 11.5px;
}

.ed-author-meta a {
  color: var(--ed-ink-soft);
  text-decoration: none;
  border-bottom: 1px dotted var(--ed-rule-strong);
}

.ed-author-meta a:hover {
  color: var(--ed-rust);
  border-bottom-color: var(--ed-rust);
}

.ed-author-link {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-self: start;
  color: var(--ed-rust);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
}

.ed-author-link span {
  transition: transform 0.2s ease;
}

.ed-author-link:hover span {
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .ed-author,
  .ed-author-avatar,
  .ed-author::before,
  .ed-author-link span {
    transition: none;
  }

  .ed-author:hover {
    transform: none;
  }
}

.ed-cats {
  display: grid;
  gap: 2px;
}

.ed-cats h3 {
  padding-bottom: 8px;
}

.ed-cats a {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ed-ink-soft);
  border-bottom: 1px dashed var(--ed-rule);
  font-size: 13.5px;
  text-decoration: none;
}

.ed-cats a:last-child {
  border-bottom: 0;
}

.ed-cats a:hover {
  color: var(--ed-rust);
}

.ed-cats span {
  color: var(--ed-muted);
  font-family: var(--ed-mono);
  font-size: 11px;
}

/* ---------- article ---------- */

.ed-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 100%;
  height: 2px;
  background: transparent;
}

.ed-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ed-rust);
  transition: width 0.1s linear;
}

.ed-article-shell {
  display: grid;
  grid-template-columns: minmax(0, 720px) 236px;
  gap: 48px;
  justify-content: space-between;
  width: min(1080px, calc(100% - 48px));
  margin: 34px auto 72px;
}

.ed-article {
  min-width: 0;
}

.ed-article-head h1 {
  margin: 14px 0 0;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

.ed-article-head .ed-meta {
  margin-top: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--ed-rule);
}

/* Lead paragraph with an oversized opening quote as the only ornament. */
.ed-summary {
  margin: 26px 0 0;
  padding: 0;
  color: var(--ed-ink-soft);
  border: 0;
  background: transparent;
  font-family: var(--ed-serif);
  font-size: 17px;
  line-height: 1.95;
  letter-spacing: 0.01em;
}

/* Rich summaries (admin may store a paragraph or a link) keep their own blocks. */
.ed-summary > :first-child {
  margin-top: 0;
}

.ed-summary > :last-child {
  margin-bottom: 0;
}

.ed-summary p {
  margin: 0;
}

.ed-summary p + p {
  margin-top: 0.55em;
}

/* Quotes only for the plain-text variant; markup brings its own structure. */
p.ed-summary::before,
p.ed-summary::after {
  display: inline-block;
  color: var(--ed-rust);
  font-family: var(--ed-serif);
  font-size: 2.15em;
  font-weight: 400;
  line-height: 0;
  vertical-align: -0.33em;
}

p.ed-summary::before {
  margin-right: 0.1em;
  content: "“";
}

p.ed-summary::after {
  margin-left: 0.1em;
  opacity: 0.45;
  content: "”";
}

/* The ad block above already carries its own bottom spacing. */
.ed-ad + .ed-summary {
  margin-top: 0;
}

.ed-article .article {
  margin-top: 36px;
  color: var(--ed-ink);
  font-family: var(--ed-sans);
  font-size: 17px;
  line-height: 1.95;
}

.ed-article .article > * + * {
  margin-top: 1.35em;
}

.ed-article .article h2,
.ed-article .article h3,
.ed-article .article h4 {
  margin-top: 2.1em;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.ed-article .article h2 {
  font-size: 25px;
}

.ed-article .article h3 {
  font-size: 20px;
}

.ed-article .article h4 {
  font-size: 17px;
}

/* Inline code also has to beat the legacy `.post-content ... code:not(...)` rule. */
.ed-article .article code:not([class*="language-"]) {
  padding: 2px 6px;
  color: var(--ed-ink);
  border-radius: 3px;
  background: var(--ed-code-inline);
}

.ed-article .article pre code,
.ed-article .article pre code:not([class*="language-"]) {
  padding: 0;
  color: inherit;
  background: transparent;
}

.ed-comments .comment mark {
  color: var(--ed-rust);
  background: transparent;
}

.ed-article .article a {
  color: var(--ed-accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--ed-accent) 35%, transparent);
}

.ed-article .article a:hover {
  border-bottom-color: var(--ed-accent);
}

.ed-article .article blockquote {
  margin: 1.8em 0;
  padding: 4px 0 4px 20px;
  color: var(--ed-ink-soft);
  border-left: 2px solid var(--ed-rule-strong);
  border-radius: 0;
  background: transparent;
  font-family: var(--ed-serif);
  font-size: 16px;
  line-height: 1.95;
}

/* The legacy template draws its own bar inside blockquotes. */
.ed-article .article blockquote::before {
  display: none;
}

.ed-article .article table th {
  color: var(--ed-ink);
  background: var(--ed-paper-soft);
}

.ed-article .article ul,
.ed-article .article ol {
  padding-left: 1.35em;
}

.ed-article .article li + li {
  margin-top: 0.5em;
}

.ed-article .article img,
.ed-article .article > img {
  max-width: 100%;
  height: auto;
  border: 0;
  border-radius: 6px;
  background: none;
  box-shadow: none;
}

/* The old template wrapped images in a patterned, shadowed frame; the reading
   column only needs a quiet figure with a caption. */
.ed-article .article figure,
.ed-article .article figure.image {
  margin: 1.9em 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.ed-article .article figure img,
.ed-article .article figure.image img {
  border: 0;
  border-radius: 6px;
  background: none;
  box-shadow: none;
}

.ed-article .article figure figcaption,
.ed-article .article figure.image figcaption {
  margin-top: 10px;
  color: var(--ed-muted);
  font-family: var(--ed-sans);
  font-size: 12.5px;
  line-height: 1.7;
  text-align: left;
}

/* Prev / next article navigation sits before the tool promos: what to read next
   matters more than what to buy. */
.ed-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 40px;
}

.ed-pager-item {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--ed-rule);
  border-radius: 4px;
  background: var(--ed-card);
  text-decoration: none;
  transition: border-color 0.18s ease;
}

.ed-pager-item:hover {
  border-color: var(--ed-rule-strong);
}

.ed-pager-item span {
  color: var(--ed-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.ed-pager-item strong {
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.5;
}

.ed-pager-item:hover strong {
  color: var(--ed-rust);
}

.ed-pager-next {
  text-align: right;
}

.ed-pager-next span,
.ed-pager-next strong {
  justify-self: end;
}

.ed-article .article code {
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--ed-code-inline);
  color: var(--ed-ink);
  font-family: var(--ed-mono);
  font-size: 0.86em;
}

.ed-article .article pre {
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--ed-rule);
  border-radius: 3px;
  background: var(--ed-code-bg);
  color: var(--ed-code-fg);
  font-size: 13px;
  line-height: 1.7;
}

.ed-article .article pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.ed-article .article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ed-article .article th,
.ed-article .article td {
  padding: 10px 12px;
  border: 1px solid var(--ed-rule);
  text-align: left;
}

.ed-article .article th {
  background: var(--ed-paper-soft);
  font-weight: 700;
}

.ed-article .is-speaking {
  border-radius: 3px;
  background: var(--ed-highlight);
}

.ed-article .speech-char--active {
  color: var(--ed-accent);
  background: var(--ed-highlight-strong);
}

.ed-toc {
  position: sticky;
  top: calc(var(--ed-header-h) + 24px);
  align-self: start;
  display: grid;
  gap: 10px;
  font-size: 12.5px;
}

.ed-toc p {
  margin: 0 0 4px;
  color: var(--ed-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ed-toc nav {
  display: grid;
  gap: 2px;
  padding-left: 14px;
  border-left: 1px solid var(--ed-rule);
}

.ed-toc a {
  display: block;
  padding: 5px 0;
  color: var(--ed-muted);
  line-height: 1.5;
  text-decoration: none;
}

.ed-toc a.level-3 {
  padding-left: 12px;
  font-size: 12px;
}

.ed-toc a:hover,
.ed-toc a.is-active {
  color: var(--ed-rust);
}

.ed-toc a.is-active {
  font-weight: 700;
}

.ed-toc-progress {
  display: flex;
  gap: 4px;
  align-items: baseline;
  margin-top: 10px;
  color: var(--ed-muted);
  font-family: var(--ed-mono);
  font-size: 11px;
}

.ed-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-top: 32px;
  padding: 18px 0;
  color: var(--ed-muted);
  border-top: 1px solid var(--ed-rule);
  border-bottom: 1px solid var(--ed-rule);
  font-size: 12.5px;
}

.ed-byline a {
  color: var(--ed-ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--ed-rule-strong);
}

.ed-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.ed-tags a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  color: var(--ed-ink-soft);
  border: 1px solid var(--ed-rule);
  border-radius: 999px;
  background: var(--ed-card);
  font-size: 12px;
  text-decoration: none;
}

.ed-tags a:hover {
  color: var(--ed-rust);
  border-color: var(--ed-rust);
}

.ed-article-promo {
  margin-top: 40px;
}

.ed-related {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.ed-related a {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--ed-rule);
  border-radius: 3px;
  background: var(--ed-card);
  text-decoration: none;
}

.ed-related a:hover {
  border-color: var(--ed-rule-strong);
}

.ed-related span {
  color: var(--ed-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.ed-related strong {
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.5;
}

.ed-comments {
  width: auto;
  margin: 48px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--ed-rule);
}

.ed-comments > summary {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  color: var(--ed-muted);
  font-size: 13px;
  list-style: none;
  cursor: pointer;
}

.ed-comments > summary::-webkit-details-marker {
  display: none;
}

.ed-comments > summary b {
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 17px;
  font-weight: 700;
}

.ed-comments > summary::after {
  content: "展开";
  margin-left: auto;
  color: var(--ed-accent);
  font-size: 12px;
}

.ed-comments[open] > summary::after {
  content: "收起";
}

.ed-comments-body {
  padding-top: 18px;
}

/* keep the existing comment markup readable inside the collapsed block */
.ed-comments .commentList {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ed-comments .commentList .item:last-child {
  border-bottom: 0;
}

/* ---------- catalog / search ---------- */

.ed-page-head {
  padding: 46px 0 26px;
  border-bottom: 1px solid var(--ed-rule);
}

.ed-page-head h1 {
  margin: 12px 0 0;
  font-family: var(--ed-serif);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 700;
  line-height: 1.25;
}

.ed-page-head .ed-desc {
  max-width: 54em;
  margin: 14px 0 0;
  color: var(--ed-ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.ed-page-head .ed-meta {
  margin-top: 16px;
}

.ed-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ed-rail);
  gap: 56px;
  padding: 34px 0 72px;
}

.ed-search-form {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.ed-search-form input {
  min-height: 44px;
  flex: 1;
  padding: 0 14px;
  color: var(--ed-ink);
  border: 1px solid var(--ed-rule-strong);
  border-radius: 4px;
  background: var(--ed-card);
  font-family: inherit;
  font-size: 14px;
}

.ed-search-form button {
  min-height: 44px;
  padding: 0 20px;
  color: var(--ed-invert-fg);
  border: 1px solid var(--ed-invert-bg);
  border-radius: 4px;
  background: var(--ed-invert-bg);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.ed-empty {
  padding: 30px 0;
  color: var(--ed-muted);
  font-size: 14px;
}

/* ---------- about ---------- */

.ed-about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  gap: 48px;
  align-items: start;
  padding: 46px 0 34px;
  border-bottom: 1px solid var(--ed-rule);
}

.ed-about-id {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.ed-about-id img {
  width: 96px;
  height: 96px;
  flex: none;
  border: 1px solid var(--ed-rule);
  border-radius: 50%;
  object-fit: cover;
}

.ed-about-id h1 {
  margin: 0;
  font-family: var(--ed-serif);
  font-size: clamp(28px, 3.2vw, 38px);
  font-weight: 700;
  line-height: 1.25;
}

.ed-about-id .ed-role {
  margin: 6px 0 0;
  color: var(--ed-rust);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.ed-about-id .ed-motto {
  margin: 12px 0 0;
  color: var(--ed-ink-soft);
  font-size: 14.5px;
  line-height: 1.85;
}

.ed-contact {
  display: grid;
  gap: 3px;
  padding: 20px;
  border: 1px solid var(--ed-rule);
  border-radius: 4px;
  background: var(--ed-card);
}

.ed-contact a {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ed-ink-soft);
  border-bottom: 1px dashed var(--ed-rule);
  font-size: 13px;
  text-decoration: none;
}

.ed-contact a:last-child {
  border-bottom: 0;
}

.ed-contact span {
  color: var(--ed-muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ed-about-body {
  display: grid;
  gap: 46px;
  padding: 40px 0 72px;
}

.ed-prose {
  max-width: 760px;
  color: var(--ed-ink-soft);
  font-size: 16px;
  line-height: 1.95;
}

.ed-prose h2 {
  margin: 0 0 14px;
  font-family: var(--ed-serif);
  font-size: 24px;
  font-weight: 700;
}

.ed-prose h3 {
  margin: 26px 0 10px;
  font-family: var(--ed-serif);
  font-size: 19px;
}

.ed-prose p {
  margin: 0 0 1.1em;
}

.ed-prose ul {
  padding-left: 1.3em;
}

.ed-prose li + li {
  margin-top: 0.4em;
}

/* weibo list keeps its structure, gets editorial spacing */
.ed-about-body .weibo-list {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.ed-about-body .weibo-item {
  border: 1px solid var(--ed-rule);
  border-radius: 4px;
  background: var(--ed-card);
  overflow: hidden;
}

.ed-about-body .weibo-link {
  padding: 18px 20px;
}

/* ---------- semantic helpers ---------- */

search {
  display: block;
}

.ed-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Quiet text action, not a pill: the floating share button already exists. */
.ed-share {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 28px;
  margin-left: auto;
  padding: 0;
  color: var(--ed-muted);
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.16s ease;
}

.ed-share span {
  font-size: 11px;
  opacity: 0.7;
}

.ed-share:hover {
  color: var(--ed-rust);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.ed-promo-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

/* ---------- tools index ---------- */

.ed-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 34px 0 72px;
}

.ed-tool {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 22px;
  border: 1px solid var(--ed-rule);
  border-radius: 4px;
  background: var(--ed-card);
  text-decoration: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.ed-tool:hover {
  border-color: var(--ed-rule-strong);
  transform: translateY(-2px);
}

.ed-tool-kicker {
  color: var(--ed-rust);
  font-family: var(--ed-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.ed-tool h2 {
  margin: 0;
  color: var(--ed-ink);
  font-family: var(--ed-serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
}

.ed-tool p {
  margin: 0;
  color: var(--ed-muted);
  font-size: 13px;
  line-height: 1.8;
}

.ed-tool-arrow {
  margin-top: 6px;
  color: var(--ed-accent);
  font-size: 12.5px;
  font-weight: 700;
}

#comments {
  scroll-margin-top: calc(var(--ed-header-h) + 18px);
}

@media (max-width: 680px) {
  .ed-promo-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .related > a {
    grid-template-columns: minmax(0, 1fr);
  }

}

/* Mobile-only shortcut row for the two business tools. */
.ed-tools-strip {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.ed-tools-strip a {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  color: var(--ed-invert-fg);
  border-radius: 4px;
  background: var(--ed-invert-bg);
  text-decoration: none;
}

.ed-tools-strip a.is-accent {
  background: var(--ed-rust);
}

.ed-tools-strip-label {
  color: inherit;
  opacity: 0.72;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.ed-tools-strip strong {
  padding-right: 18px;
  font-family: var(--ed-serif);
  font-size: 15px;
  font-weight: 700;
}

.ed-tools-strip-cta {
  position: absolute;
  right: 14px;
  bottom: 14px;
  font-size: 13px;
}

@media (max-width: 860px) {
  .ed-tools-strip {
    display: grid;
  }


  /* The shortcut row above already covers these two on phones. */
  .ed-rail .ed-promo {
    display: none;
  }
}

/* 404 listing reuses the row list with a little air above it. */
.ed-404-list {
  margin-top: 28px;
}

/* ---------- footer ---------- */

.ed-footer {
  margin-top: 20px;
  border-top: 1px solid var(--ed-rule);
  background: var(--ed-paper-soft);
}

.ed-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 0.7fr));
  gap: 40px;
  padding: 44px 0 30px;
}

.ed-footer h2 {
  margin: 0 0 12px;
  color: var(--ed-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.ed-footer p {
  margin: 0;
  color: var(--ed-muted);
  font-size: 13px;
  line-height: 1.85;
}

.ed-footer-grid > div:first-child {
  /* flex column, not grid: auto grid rows would stretch to the tallest footer
     column and leave a gap under the brand. */
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}

.ed-footer-note {
  max-width: 30em;
}

/* The article page keeps floating actions bottom-right; reserve room inside the
   footer instead of leaving an 80px body padding band under it. */
body:has(.article-actions) .ed-footer-grid {
  padding-bottom: 84px;
}

.ed-footer-links {
  display: grid;
  gap: 2px;
}

.ed-footer-links a {
  display: flex;
  min-height: 36px;
  align-items: center;
  color: var(--ed-ink-soft);
  font-size: 13.5px;
  text-decoration: none;
}

.ed-footer-links a:hover {
  color: var(--ed-rust);
}

.ed-footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 16px 0 30px;
  border-top: 1px solid var(--ed-rule);
  color: var(--ed-muted);
  font-size: 12px;
}

.ed-footer-meta a {
  color: var(--ed-muted);
}

/* ---------- drawer (mobile nav) ---------- */

.ed-header .asideMenuWrap,
body .asideMenuWrap {
  background: rgba(23, 20, 15, 0.42);
}

.asideMenu {
  background: var(--ed-paper-soft);
}

.asideMenu .drawer-header {
  border-color: var(--ed-rule);
}

.asideMenu .drawer-menu .header-link {
  display: grid;
  gap: 3px;
  padding: 13px 2px;
  color: var(--ed-ink);
  border-bottom: 1px solid var(--ed-rule);
  text-decoration: none;
}

.asideMenu .drawer-menu .header-link em {
  font-family: var(--ed-serif);
  font-size: 17px;
  font-style: normal;
  font-weight: 700;
}

.asideMenu .drawer-menu .header-link p {
  color: var(--ed-muted);
  font-size: 12px;
}

.drawer-search form {
  display: flex;
  gap: 8px;
  padding: 14px 2px;
  border-bottom: 1px solid var(--ed-rule);
}

.drawer-search input {
  min-height: 42px;
  flex: 1;
  padding: 0 12px;
  color: var(--ed-ink);
  border: 1px solid var(--ed-rule-strong);
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
}

.drawer-search button {
  min-height: 42px;
  padding: 0 16px;
  color: var(--ed-invert-fg);
  border: 1px solid var(--ed-invert-bg);
  border-radius: 4px;
  background: var(--ed-invert-bg);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- legacy article containers ---------- */

.ed-article .post-content {
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  font-size: inherit;
}

.ed-article .post-content header {
  order: 0;
  margin: 0;
}

.ed-article .post-content header h1 {
  margin: 14px 0 0;
  font-family: var(--ed-serif);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 700;
  line-height: 1.28;
}

.ed-article .post-content .article {
  margin: 34px 0 0;
  text-align: left;
  letter-spacing: 0;
}

.ed-article .post-content .article > :first-child {
  margin-top: 0;
}

/* Admin-configured HTML block (site_info.html_ad). Free-form markup, so only the
   container, spacing and inherited typography are controlled here. */
.ed-ad {
  position: relative;
  margin: 2.4em 0;
  padding: 20px 20px 16px;
  color: var(--ed-ink-soft);
  border: 1px solid var(--ed-rule);
  border-left: 3px solid var(--ed-rule-strong);
  border-radius: 4px;
  background: var(--ed-paper-soft);
  font-size: 14px;
  line-height: 1.85;
}

.ed-ad::before {
  content: "推广";
  position: absolute;
  top: -9px;
  left: 14px;
  padding: 1px 7px;
  color: var(--ed-muted);
  border: 1px solid var(--ed-rule);
  border-radius: 3px;
  background: var(--ed-paper);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.ed-ad > :first-child {
  margin-top: 0;
}

.ed-ad > :last-child {
  margin-bottom: 0;
}

.ed-ad p {
  margin: 0 0 6px;
}

.ed-ad strong {
  color: var(--ed-ink);
  font-weight: 700;
}

.ed-ad a {
  color: var(--ed-accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--ed-accent) 32%, transparent);
}

.ed-ad a:hover {
  border-bottom-color: var(--ed-accent);
}

.ed-ad img,
.ed-ad video,
.ed-ad iframe {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ---------- related + comments ---------- */

.ed-related-section {
  width: auto;
  margin: 48px 0 0;
}

.ed-comments .input:disabled {
  color: var(--ed-muted);
  background: var(--ed-paper-soft);
  cursor: not-allowed;
}

.ed-comments .comment .inputWrap {
  padding: 0;
  border: 0;
  background: transparent;
}

.ed-comments .commentList .say {
  margin: 8px 0 0;
  padding: 0;
  color: var(--ed-ink-soft);
  background: none;
  font-size: 14px;
  line-height: 1.8;
}

.ed-related-section .ed-kicker {
  margin-bottom: 14px;
}

.ed-comments .comment {
  border: 1px solid var(--ed-rule);
  border-radius: 4px;
  background: var(--ed-card);
}

.ed-comments .comment .p-15 {
  padding: 16px;
}

.ed-comments .input {
  width: 100%;
  min-height: 96px;
  padding: 14px 16px;
  color: var(--ed-ink);
  border: 1px solid var(--ed-rule-strong);
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  resize: vertical;
}

.ed-comments .submit {
  min-height: 40px;
  padding: 0 18px;
  color: var(--ed-invert-fg);
  border: 1px solid var(--ed-invert-bg);
  border-radius: 4px;
  background: var(--ed-invert-bg);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.ed-comments .commentList .item {
  padding: 16px 0;
  border-bottom: 1px solid var(--ed-rule);
}

.ed-comments .commentList .item:last-child {
  border-bottom: 0;
}

/* Dialogs owned by the legacy templates follow the theme too. */
:root[data-theme="dark"] dialog,
:root[data-theme="dark"] .page-share-dialog {
  color: var(--ed-ink);
  border-color: var(--ed-rule);
  background: var(--ed-card);
}

:root[data-theme="dark"] dialog::backdrop,
:root[data-theme="dark"] .page-share-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

:root[data-theme="dark"] .page-share-dialog input,
:root[data-theme="dark"] .page-share-dialog .btn {
  color: var(--ed-ink);
  border-color: var(--ed-rule-strong);
  background: var(--ed-paper-soft);
}

:root[data-theme="dark"] .page-share-placeholder,
:root[data-theme="dark"] .page-share-status,
:root[data-theme="dark"] .page-share-intro {
  color: var(--ed-muted);
}

/* Share dialog: same paper + ink language as the rest of the site. */
.page-share-dialog {
  color: var(--ed-ink);
  border: 1px solid var(--ed-rule);
  border-radius: 8px;
  background: var(--ed-card);
  box-shadow: 0 30px 90px -40px var(--ed-shadow-color);
}

.page-share-dialog::backdrop {
  background: rgba(20, 16, 12, 0.55);
}

.page-share-header,
.page-share-footer {
  background: var(--ed-card);
  border-color: var(--ed-rule);
}

.page-share-heading p {
  color: var(--ed-rust);
  font-family: var(--ed-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
}

.page-share-heading h2 {
  font-family: var(--ed-serif);
  font-size: 22px;
}

.page-share-close {
  width: 34px;
  height: 34px;
  color: var(--ed-ink-soft);
  border: 1px solid var(--ed-rule);
  border-radius: 6px;
  background: transparent;
}

.page-share-close:hover {
  color: var(--ed-rust);
  border-color: var(--ed-rust);
}

.page-share-intro,
.page-share-placeholder,
.page-share-status,
.page-share-link label {
  color: var(--ed-muted);
}

.page-share-preview {
  border: 1px solid var(--ed-rule);
  border-radius: 4px;
  background: var(--ed-paper-soft);
}

.page-share-link {
  border-top: 1px solid var(--ed-rule);
}

.page-share-link input {
  color: var(--ed-ink);
  border: 1px solid var(--ed-rule-strong);
  border-radius: 4px;
  background: var(--ed-paper-soft);
}

.page-share-dialog .btn {
  min-height: 44px;
  color: var(--ed-invert-fg);
  border: 1px solid var(--ed-invert-bg);
  border-radius: 4px;
  background: var(--ed-invert-bg);
  font-weight: 600;
}

.page-share-dialog .btn:hover {
  background: var(--ed-invert-bg);
  transform: none;
  opacity: 0.9;
}

.page-share-dialog .btn.secondary {
  color: var(--ed-ink);
  border-color: var(--ed-rule-strong);
  background: transparent;
}

.page-share-dialog .btn.secondary:hover {
  color: var(--ed-rust);
  border-color: var(--ed-rust);
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .ed-home-grid,
  .ed-page-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
  }

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

  .ed-rail-sticky {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ed-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .ed-article-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .ed-toc {
    position: static;
    order: -1;
    margin-bottom: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ed-rule);
  }

  .ed-toc nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    border-left: 0;
    padding-left: 0;
  }

  .ed-toc a.level-3 {
    padding-left: 0;
  }

  .ed-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .ed-hero-figure {
    order: -1;
  }

  .ed-about-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 1080px) {
  /* Keep the header to categories only; tools stay in the rail and the drawer. */
  .ed-nav a.ed-nav-tool,
  .ed-nav .ed-nav-split {
    display: none;
  }
}

@media (max-width: 980px) {
  .ed-search {
    display: none;
  }
}

@media (max-width: 780px) {
  .ed-nav {
    display: none;
  }

  .ed-menu-btn {
    display: inline-flex;
  }

  .ed-header-inner {
    gap: 14px;
    justify-content: space-between;
  }

  .ed-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px;
    padding: 34px 0 24px;
  }

  .ed-footer-grid > div:first-child {
    grid-column: 1 / -1;
  }

  body:has(.article-actions) .ed-footer-grid {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  .ed-header-inner {
    gap: 10px;
  }

  .ed-brand-mark {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .ed-brand-text strong {
    font-size: 15px;
  }

  .ed-brand-text em {
    display: none;
  }
}

@media (max-width: 680px) {
  .ed-shell,
  .ed-article-shell {
    width: calc(100% - 32px);
  }

  .ed-home {
    padding-top: 26px;
  }

  .ed-hero {
    padding-bottom: 28px;
  }

  .ed-hero-copy h1 {
    font-size: clamp(26px, 7.6vw, 34px);
  }

  .ed-home-grid,
  .ed-page-grid {
    padding-top: 30px;
    gap: 36px;
  }

  .ed-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 20px 0;
  }

  .ed-row-thumb {
    order: -1;
    max-width: 100%;
  }

  .ed-hero-figure figcaption {
    display: none;
  }

  /* Phones skip the sticky TOC; the progress line still shows reading position. */
  .ed-toc {
    display: none;
  }

  /* Phones read faster with shorter excerpts. */
  .ed-row p,
  .ed-tile p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .ed-tile {
    padding: 14px 0;
  }

  .ed-tiles {
    grid-template-columns: minmax(0, 1fr);
  }

  .ed-tile:last-child {
    border-bottom: 0;
  }

  .ed-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .ed-rail-sticky {
    grid-template-columns: minmax(0, 1fr);
  }

  .ed-promo {
    padding: 20px;
  }

  .ed-block-head h2 {
    font-size: 21px;
  }

  .ed-row h3,
  .ed-row h2 {
    font-size: 19px;
  }

  .ed-article-shell {
    margin-top: 22px;
  }

  .ed-article .article {
    font-size: 16.5px;
    line-height: 1.95;
  }

  .ed-article .article h2 {
    font-size: 22px;
  }

  .ed-related {
    grid-template-columns: minmax(0, 1fr);
  }

  .ed-pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .ed-pager-next {
    text-align: left;
  }

  .ed-pager-next span,
  .ed-pager-next strong {
    justify-self: start;
  }

  .ed-summary {
    margin-top: 22px;
    font-size: 16.5px;
    line-height: 1.9;
  }

  .ed-share {
    margin-left: 0;
  }

  .ed-about-id {
    gap: 16px;
  }

  .ed-about-id img {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 420px) {
  .ed-brand-text em {
    display: none;
  }

  .ed-row h3 {
    font-size: 18px;
  }

  .ed-block-head {
    flex-direction: column;
    gap: 6px;
  }
}

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

@media print {
  .ed-header,
  .ed-footer,
  .ed-toc,
  .ed-progress,
  .article-actions,
  .article-speech {
    display: none !important;
  }

  .ed-article-shell {
    display: block;
    width: 100%;
    margin: 0;
  }
}

/* Tools list: single column on phones (must come last). */
@media (max-width: 680px) {
  .ed-tools {
    grid-template-columns: minmax(0, 1fr);
  }
}
