:root {
  color-scheme: light dark;
  --bg: #f6f2eb;
  --bg-elevated: #fffdf8;
  --bg-muted: #ece6dc;
  --text: #26231f;
  --text-muted: #696158;
  --heading: #171513;
  --accent: #8d2f3f;
  --accent-strong: #6f1f30;
  --accent-soft: rgba(141, 47, 63, 0.11);
  --border: #d9d1c5;
  --shadow: 0 14px 40px rgba(54, 44, 34, 0.08);
  --header-bg: rgba(246, 242, 235, 0.91);
  --link: #7b2940;
  --focus: #bf5a6d;
  --selection: #ead0d5;
  --max-content: 78ch;
  --max-page: 1240px;
  --font-ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-en: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ja: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", "Noto Serif JP", serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171615;
    --bg-elevated: #201f1d;
    --bg-muted: #292724;
    --text: #e8e2d9;
    --text-muted: #b7aea3;
    --heading: #fffaf2;
    --accent: #d08091;
    --accent-strong: #e09aaa;
    --accent-soft: rgba(208, 128, 145, 0.14);
    --border: #3e3a35;
    --shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
    --header-bg: rgba(23, 22, 21, 0.91);
    --link: #e19aaa;
    --focus: #f3a6b7;
    --selection: #59323b;
  }
}

:root[data-theme="dark"] {
  --bg: #171615;
  --bg-elevated: #201f1d;
  --bg-muted: #292724;
  --text: #e8e2d9;
  --text-muted: #b7aea3;
  --heading: #fffaf2;
  --accent: #d08091;
  --accent-strong: #e09aaa;
  --accent-soft: rgba(208, 128, 145, 0.14);
  --border: #3e3a35;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
  --header-bg: rgba(23, 22, 21, 0.91);
  --link: #e19aaa;
  --focus: #f3a6b7;
  --selection: #59323b;
}

:root[data-theme="light"] {
  --bg: #f6f2eb;
  --bg-elevated: #fffdf8;
  --bg-muted: #ece6dc;
  --text: #26231f;
  --text-muted: #696158;
  --heading: #171513;
  --accent: #8d2f3f;
  --accent-strong: #6f1f30;
  --accent-soft: rgba(141, 47, 63, 0.11);
  --border: #d9d1c5;
  --shadow: 0 14px 40px rgba(54, 44, 34, 0.08);
  --header-bg: rgba(246, 242, 235, 0.91);
  --link: #7b2940;
  --focus: #bf5a6d;
  --selection: #ead0d5;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, var(--accent-soft), transparent 26rem),
    var(--bg);
  font-family: var(--font-en);
  font-size: clamp(1rem, 0.98rem + 0.12vw, 1.08rem);
  line-height: 1.8;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html[lang="ja"] body {
  font-family: var(--font-ja);
  line-height: 2;
  font-feature-settings: "palt" 0;
}

::selection {
  background: var(--selection);
}

a {
  color: var(--link);
  text-decoration-thickness: 0.075em;
  text-underline-offset: 0.18em;
}

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

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 0.2rem;
}

img,
svg {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  transform: translateY(-160%);
  color: var(--heading);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  transform: translateY(0);
}

.reading-progress {
  position: fixed;
  z-index: 999;
  inset: 0 auto auto 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  transition: width 80ms linear;
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(calc(100% - 2rem), var(--max-page));
  min-height: 4.5rem;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--heading);
  text-decoration: none;
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mark-symbol {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--bg-elevated);
  font-family: var(--font-en);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  border-radius: 50%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-ui);
  font-size: 0.88rem;
}

.header-link,
.icon-button {
  min-height: 2.35rem;
  padding: 0.42rem 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}

.header-link:hover,
.icon-button:hover {
  color: var(--heading);
  background: var(--accent-soft);
  border-color: var(--border);
}

.icon-button .theme-icon {
  font-size: 1rem;
  line-height: 1;
}

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, transparent 0 55%, var(--accent-soft) 55% 56%, transparent 56%),
    var(--bg-elevated);
}

.hero::after {
  content: "人物・写真・時間";
  position: absolute;
  right: clamp(1rem, 5vw, 5rem);
  bottom: 0.4rem;
  color: var(--accent-soft);
  font-family: var(--font-ja);
  font-size: clamp(2.2rem, 8vw, 7rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
}

html[lang="en"] .hero::after {
  content: "PORTRAIT · IMAGE · TIME";
  font-family: var(--font-ui);
  font-size: clamp(1.8rem, 6.5vw, 6rem);
  letter-spacing: 0.05em;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 2rem), var(--max-page));
  margin-inline: auto;
  padding: clamp(3.5rem, 8vw, 7.5rem) 0 clamp(3.5rem, 7vw, 6rem);
}

.eyebrow {
  margin: 0 0 1.15rem;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 18ch;
  margin: 0;
  color: var(--heading);
  font-size: clamp(2.25rem, 5.8vw, 5.4rem);
  line-height: 1.12;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

html[lang="ja"] .hero h1 {
  max-width: 15ch;
  font-size: clamp(2.05rem, 5.2vw, 4.7rem);
  line-height: 1.35;
  letter-spacing: 0.015em;
}

.hero-subtitle {
  max-width: 54rem;
  margin: 1.5rem 0 0;
  color: var(--text-muted);
  font-size: clamp(1.02rem, 1rem + 0.35vw, 1.28rem);
}

.page-grid {
  width: min(calc(100% - 2rem), var(--max-page));
  margin: 0 auto;
  padding: clamp(2.25rem, 5vw, 5rem) 0 5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem;
}

.article-column {
  min-width: 0;
  max-width: var(--max-content);
}

.article-intro {
  margin-bottom: 4rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.06em;
}

.article-intro p:first-child::first-letter {
  float: left;
  margin: 0.12em 0.14em 0 0;
  color: var(--accent);
  font-family: var(--font-en);
  font-size: 4.25em;
  font-weight: 650;
  line-height: 0.78;
}

html[lang="ja"] .article-intro p:first-child::first-letter {
  font-family: var(--font-ja);
  font-size: 3.6em;
  line-height: 0.9;
}

.article-column p {
  margin: 0 0 1.45em;
  hanging-punctuation: first allow-end last;
}

.article-section {
  margin: 0 0 clamp(4rem, 8vw, 7rem);
}

.article-section h2,
.references-section h2 {
  position: relative;
  margin: 0 0 1.6rem;
  padding: 1rem 0 0.9rem 1.1rem;
  color: var(--heading);
  border-top: 2px solid var(--heading);
  border-bottom: 1px solid var(--border);
  font-size: clamp(1.55rem, 1.35rem + 0.8vw, 2.15rem);
  line-height: 1.4;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.article-section h2::before,
.references-section h2::before {
  content: "";
  position: absolute;
  top: 0.95rem;
  bottom: 0.85rem;
  left: 0;
  width: 3px;
  background: var(--accent);
}

.heading-anchor {
  margin-left: 0.5rem;
  color: transparent;
  font-family: var(--font-ui);
  font-size: 0.7em;
  text-decoration: none;
}

h2:hover .heading-anchor,
.heading-anchor:focus-visible {
  color: var(--text-muted);
}

.citations {
  margin-left: 0.13em;
  font-family: var(--font-ui);
  font-size: 0.68em;
  font-style: normal;
  line-height: 1;
  white-space: nowrap;
  vertical-align: super;
}

.citation {
  margin-left: 0.08em;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.citation:hover {
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.mobile-toc {
  margin-bottom: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--bg-elevated);
}

.mobile-toc summary {
  padding: 0.85rem 1rem;
  color: var(--heading);
  font-family: var(--font-ui);
  font-weight: 700;
  cursor: pointer;
}

.mobile-toc ol {
  margin: 0;
  padding: 0 1.2rem 1rem 2.5rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.55;
}

.mobile-toc li + li {
  margin-top: 0.45rem;
}

.desktop-toc {
  display: none;
}

.references-section {
  margin-top: 2rem;
  padding-top: 1rem;
}

.reference-note {
  margin: -0.7rem 0 2rem;
  padding: 0.9rem 1rem;
  color: var(--text-muted);
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  line-height: 1.65;
}

.reference-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: ref;
  font-family: var(--font-ui);
  font-size: 0.84rem;
  line-height: 1.65;
}

.reference-list li {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.25rem 0.8rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 6rem;
}

.ref-number {
  color: var(--accent);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.ref-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ref-text a {
  font-weight: 600;
}

.ref-backs {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.35rem;
}

.ref-back {
  min-width: 1.65rem;
  padding: 0.04rem 0.35rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border-radius: 999px;
  font-size: 0.78rem;
  text-align: center;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.footer-inner {
  width: min(calc(100% - 2rem), var(--max-page));
  margin-inline: auto;
  padding: 2.4rem 0 3rem;
  display: grid;
  gap: 1rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.84rem;
  line-height: 1.65;
}

.footer-title {
  margin: 0;
  color: var(--heading);
  font-size: 1rem;
  font-weight: 750;
}

.footer-inner p {
  max-width: 72ch;
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 30;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(0.75rem);
  color: var(--heading);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

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

@media (min-width: 1000px) {
  .page-grid {
    grid-template-columns: 15.5rem minmax(0, var(--max-content));
    justify-content: center;
    align-items: start;
    gap: clamp(3rem, 5vw, 5rem);
  }

  .mobile-toc {
    display: none;
  }

  .desktop-toc {
    position: sticky;
    top: 6.2rem;
    display: block;
    max-height: calc(100vh - 7.2rem);
    overflow: auto;
    padding-right: 0.75rem;
    font-family: var(--font-ui);
    scrollbar-width: thin;
  }

  .toc-label {
    margin: 0 0 0.9rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .desktop-toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
    border-left: 1px solid var(--border);
  }

  .desktop-toc li {
    margin: 0;
  }

  .desktop-toc a {
    display: block;
    padding: 0.38rem 0.25rem 0.38rem 0.9rem;
    color: var(--text-muted);
    border-left: 2px solid transparent;
    font-size: 0.78rem;
    line-height: 1.42;
    text-decoration: none;
  }

  .desktop-toc a:hover,
  .desktop-toc a.is-active {
    color: var(--heading);
    border-left-color: var(--accent);
    background: linear-gradient(90deg, var(--accent-soft), transparent);
  }
}

@media (max-width: 640px) {
  .header-inner {
    min-height: 4rem;
  }

  .site-name {
    display: none;
  }

  .header-actions {
    font-size: 0.8rem;
  }

  .header-link,
  .icon-button {
    padding-inline: 0.58rem;
  }

  .theme-label {
    display: none;
  }

  .hero-inner {
    padding-top: 3rem;
  }

  .article-intro {
    font-size: 1em;
  }

  .article-section h2,
  .references-section h2 {
    padding-left: 0.85rem;
    font-size: 1.45rem;
  }

  .reference-list li {
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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

@media print {
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --bg: #fff;
    --bg-elevated: #fff;
    --text: #111;
    --text-muted: #444;
    --heading: #000;
    --accent: #555;
    --border: #bbb;
    --link: #111;
  }

  body {
    background: #fff;
    font-size: 10.5pt;
    line-height: 1.6;
  }

  .site-header,
  .reading-progress,
  .desktop-toc,
  .mobile-toc,
  .back-to-top,
  .heading-anchor {
    display: none !important;
  }

  .hero {
    border: 0;
    background: #fff;
  }

  .hero::after {
    display: none;
  }

  .hero-inner,
  .page-grid,
  .footer-inner {
    width: 100%;
  }

  .hero-inner {
    padding: 1rem 0 2rem;
  }

  .hero h1 {
    max-width: none;
    font-size: 26pt;
  }

  .page-grid {
    display: block;
    padding: 0;
  }

  .article-column {
    max-width: none;
  }

  .article-section {
    break-inside: auto;
    margin-bottom: 2.5rem;
  }

  .article-section h2 {
    break-after: avoid;
  }

  .reference-list {
    font-size: 8.5pt;
  }

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

  .ref-text a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    overflow-wrap: anywhere;
  }

  .ref-backs {
    display: none;
  }

  .site-footer {
    margin-top: 2rem;
  }
}