:root {
  --paper: #f8f7f3;
  --ink: #183b38;
  --muted: #6b736d;
  --line: #d8ddd4;
  --green: #1a574c;
  --accent: #d9eaa9;
  --serif: Georgia, 'Times New Roman', serif;
  /* Shared fluid gutter so every full-width band lines up at any viewport. */
  --gutter: clamp(20px, 5vw, 48px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Guard against any single long token forcing a horizontal scrollbar. */
  overflow-wrap: break-word;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
a, button, input { touch-action: manipulation; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid #a56b27;
  outline-offset: 5px;
}

button { cursor: pointer; }
img { display: block; max-width: 100%; }

.wrap {
  max-width: 1280px;
  margin: auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  padding: 12px;
  background: white;
  z-index: 99;
}
.skip:focus { top: 10px; }

/* ---------- Header ---------- */
.topline {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  border-bottom: 1px solid var(--line);
  padding: 13px 0;
  font-size: clamp(8px, 2.3vw, 10px);
  letter-spacing: 1.4px;
}
.topline span { min-width: 0; }
.topline span:last-child { letter-spacing: 1px; }

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: clamp(18px, 4vw, 28px) 0 clamp(16px, 3.5vw, 24px);
}

.wordmark {
  font: clamp(34px, 9vw, 54px) / 1 var(--serif);
  letter-spacing: -3px;
}
.wordmark span { color: #4d7265; }

.brand-tag {
  font-size: clamp(9px, 2.6vw, 11px);
  color: var(--muted);
  letter-spacing: 1px;
  margin: 9px 0 0;
}

.mast-right {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  font-size: 12px;
}

.search-link {
  display: flex;
  gap: 9px;
  align-items: center;
  /* Comfortable tap target without altering surrounding rhythm. */
  padding: 6px 0;
  min-height: 44px;
}
.search-link svg { width: 18px; height: 18px; flex: none; }

/* ---------- Nav ---------- */
.nav {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: clamp(20px, 3.4vw, 36px);
  min-height: 55px;
  font-size: 12px;
  font-weight: 600;
  /* Internal nav scrolls horizontally when it cannot fit, with a cue below. */
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.nav a {
  padding: 17px 0;
  position: relative;
  white-space: nowrap;
  scroll-snap-align: start;
}
.nav a.active:after {
  position: absolute;
  content: '';
  height: 3px;
  background: var(--green);
  bottom: -1px;
  left: 0;
  right: 0;
}
.nav-note {
  margin-left: auto;
  padding-left: 16px;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 1px;
  white-space: nowrap;
}

/* ---------- Intro ---------- */
.intro {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  padding: clamp(22px, 4vw, 32px) 0 clamp(20px, 3.5vw, 28px);
  gap: 6px 20px;
}
.intro h1 {
  font-size: clamp(14px, 3.2vw, 16px);
  font-weight: 500;
  margin: 0;
  letter-spacing: 1px;
}
.intro p {
  font-size: 11px;
  margin: 0;
  color: var(--muted);
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr 1.04fr;
  background: #e9eee5;
  border-radius: 2px;
  overflow: hidden;
}
.hero-copy {
  min-width: 0;
  padding: clamp(28px, 4vw, 47px) clamp(25px, 3.6vw, 42px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 700;
}
.eyebrow:before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}
.hero h2 {
  font-size: clamp(24px, 3.4vw, 39px);
  line-height: 1.5;
  letter-spacing: -0.5px;
  font-weight: 600;
  margin: clamp(16px, 2.4vw, 24px) 0 16px;
  text-wrap: balance;
}
.hero-phrase { display: inline-block; max-width: 100%; }
/* Root may flag an extra-long hero headline with this class. */
.hero h2.hero-heading-long { font-size: clamp(22px, 3vw, 34px); }
.hero p {
  font-size: 14px;
  line-height: 2.1;
  color: #4f6457;
  max-width: 42ch;
  margin: 0 0 clamp(20px, 3vw, 28px);
}
.readlink {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 9px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 38px;
  min-height: 44px;
}
.hero-visual {
  display: flex;
  align-items: center;
  position: relative;
  background: #dbe3d5;
  min-height: 100%;
}
.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.hero-caption {
  position: absolute;
  bottom: 19px;
  left: 23px;
  font: 10px var(--serif);
  letter-spacing: 2px;
}

/* ---------- Shared meta ---------- */
.meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  letter-spacing: .5px;
}

/* ---------- Section head ---------- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  margin: clamp(38px, 6vw, 49px) 0 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 17px;
  gap: 8px 20px;
}
.section-head h2 {
  font: clamp(22px, 4vw, 28px) var(--serif);
  margin: 0;
  min-width: 0;
}
.section-head h2 span {
  font: 11px sans-serif;
  letter-spacing: 1px;
  margin-left: 16px;
  color: var(--muted);
}
.section-head > a { font-size: 11px; white-space: nowrap; }

/* ---------- Article cards ---------- */
.cards {
  display: grid;
  /* Content-aware columns: 3-up on desktop, 2-up mid, 1-up on small phones. */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(26px, 3vw, 32px) clamp(16px, 2vw, 24px);
}
.card { min-width: 0; }
.card .art {
  display: block;
  overflow: hidden;
  /* Match the source artwork; labels and illustration edges stay visible. */
  aspect-ratio: 4 / 3;
  background: #e1e7df;
  border-radius: 2px;
}
.card .art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .35s;
}
.card:hover .art img { opacity: .9; }
.card .eyebrow { margin: 17px 0 10px; font-size: 9px; }
.card h3 {
  font-size: 16px;
  line-height: 1.7;
  margin: 0 0 9px;
  letter-spacing: .2px;
}
.card p {
  font-size: 14px;
  line-height: 1.85;
  color: var(--muted);
  margin: 0 0 16px;
}
.card .meta { margin-bottom: 3px; font-size: 10px; }

/* ---------- Topics ---------- */
.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 12px;
}
.topic {
  min-width: 0;
  padding: clamp(18px, 2.2vw, 24px);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: background .2s;
}
.topic:hover { background: #e8eee0; }
.topic small {
  font-size: 9px;
  letter-spacing: 1.8px;
  color: var(--muted);
}
.topic h3 { font-size: clamp(16px, 1.6vw, 18px); margin: 14px 0 10px; font-weight: 500; }
.topic p { font-size: 11px; line-height: 1.9; color: var(--muted); margin: 0; }
.topic .arrow { display: block; text-align: right; margin-top: 17px; }

/* ---------- Manifesto ---------- */
.manifesto {
  margin: clamp(40px, 6vw, 55px) 0 clamp(44px, 7vw, 64px);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: clamp(28px, 4vw, 40px) 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  align-items: center;
  gap: clamp(22px, 3vw, 40px);
}
.manifesto h2 {
  font-size: clamp(22px, 2.4vw, 25px);
  font-weight: 500;
  line-height: 1.7;
  margin: 13px 0 0;
}
.manifesto p { font-size: 12px; line-height: 2.2; color: var(--muted); margin: 0 0 18px; }
.manifesto a { font-size: 11px; text-decoration: underline; text-underline-offset: 5px; }

/* ---------- Footer ---------- */
footer {
  background: var(--ink);
  color: #f1f2e9;
  padding: 45px 0 20px;
}
.foot-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px 35px;
}
.foot-brand { font: clamp(30px, 5vw, 36px) var(--serif); letter-spacing: -1px; }
.foot-grid p { font-size: 11px; color: #b7c7bd; line-height: 1.9; }
.foot-links {
  display: flex;
  gap: 18px 30px;
  flex-wrap: wrap;
  font-size: 11px;
  align-items: start;
  padding-top: 7px;
}
.foot-bottom {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid #4a655f;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 9px;
  color: #b7c7bd;
  letter-spacing: 1px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 10px;
  color: var(--muted);
  padding: 25px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.breadcrumb a { white-space: nowrap; }
/* The current page (long Japanese title) may wrap but must never be clipped. */
.breadcrumb > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* ---------- Page heading ---------- */
.page-heading { padding: 18px 0 35px; }
.page-heading h1 {
  font-size: clamp(27px, 4.5vw, 34px);
  font-weight: 500;
  line-height: 1.4;
  margin: 16px 0;
}
.page-heading p {
  font-size: 13px;
  line-height: 2;
  color: var(--muted);
  max-width: 620px;
}

.listing { padding-bottom: 64px; }

/* ---------- Article header ---------- */
.article-header {
  max-width: 850px;
  margin: auto;
  text-align: center;
  padding: 24px 0 30px;
}
.article-header .eyebrow,
.article-header .meta { justify-content: center; }
.article-type {
  font-size: 10px;
  letter-spacing: 1.6px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--green);
  margin: 14px 0 0;
}
.article-header h1 {
  font-size: clamp(25px, 3.6vw, 38px);
  line-height: 1.55;
  font-weight: 600;
  margin: 20px 0;
}
.article-header p {
  font-size: 15px;
  line-height: 2;
  color: var(--muted);
  max-width: 650px;
  margin: 0 auto 22px;
}
.article-header .reading-time-note {
  font-size: 11px;
  line-height: 1.8;
  color: var(--muted);
  margin: 14px auto 0;
}
.article-header .article-type { font-size: 12px; color: var(--green); margin-bottom: 12px; }

/* ---------- Article cover ---------- */
.article-cover {
  max-width: 850px;
  margin: 0 auto 36px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 2px;
}
.article-cover img { width: 100%; height: 100%; object-fit: contain; }

/* ---------- Article layout ---------- */
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 680px);
  justify-content: center;
  gap: clamp(28px, 4vw, 50px);
}
.toc {
  align-self: start;
  position: sticky;
  top: 24px;
  min-width: 0;
  padding-top: 14px;
  font-size: 11px;
  line-height: 1.8;
}
.toc strong { letter-spacing: 2px; font-size: 10px; }
.toc ol { padding-left: 18px; color: var(--muted); }
.toc li { margin: 12px 0; }
.toc a { overflow-wrap: anywhere; }

/* ---------- Prose ---------- */
.prose {
  min-width: 0;
  font-size: 16px;
  line-height: 2;
  overflow-wrap: anywhere;
}
.prose h2 {
  font-size: clamp(20px, 2.2vw, 22px);
  line-height: 1.6;
  font-weight: 600;
  margin: 38px 0 16px;
  scroll-margin-top: 24px;
}
.prose p { margin: 0 0 22px; }

.takeaway {
  background: #e9eee2;
  border-left: 3px solid var(--green);
  padding: clamp(20px, 2.4vw, 24px) clamp(20px, 2.8vw, 28px);
  border-radius: 0 2px 2px 0;
}
.takeaway small { font-size: 10px; letter-spacing: 1.6px; font-weight: 700; }
.takeaway p { margin: 10px 0 0; }

/* ---------- Article checklist ---------- */
.article-checklist {
  background: #eef2e8;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: clamp(22px, 2.6vw, 28px) clamp(20px, 2.8vw, 30px);
  margin: 32px 0;
}
.article-checklist h2 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.6;
  margin: 0 0 16px;
}
.article-checklist ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.9;
}
.article-checklist li {
  position: relative;
  padding-left: 30px;
  margin: 0 0 12px;
}
.article-checklist li:last-child { margin-bottom: 0; }
.article-checklist li:before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 16px;
  height: 9px;
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: rotate(-45deg);
}

/* ---------- Sources ---------- */
.sources {
  border-top: 1px solid var(--line);
  margin-top: 36px;
  padding: 20px 0;
}
.sources h2 { font-size: 16px; margin: 0 0 15px; }
.sources ul { padding-left: 20px; font-size: 12px; line-height: 1.9; }
.sources a,
.prose a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Update note & editor note ---------- */
.update-note {
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink);
  background: #f1f0e8;
  border-left: 3px solid var(--muted);
  padding: 16px 20px;
  margin: 28px 0;
  border-radius: 0 2px 2px 0;
}
.update-note strong { display: inline-block; margin-right: 6px; }

.editor-note {
  font-size: 11px;
  line-height: 1.9;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 2px;
}

/* ---------- Share ---------- */
.share {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
  margin: 25px 0 40px;
}
.share button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 11px 16px;
  font-size: 11px;
  border-radius: 2px;
  min-height: 44px;
}
.share span { font-size: 11px; color: var(--muted); }

/* ---------- Text pages ---------- */
.text-page { max-width: 740px; margin: 0 auto 70px; }

/* ---------- Search ---------- */
.search-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 680px;
  margin-bottom: 25px;
}
.search-form input {
  min-width: 0;
  flex: 1 1 200px;
  border: 1px solid var(--line);
  background: white;
  padding: 15px;
  font-size: 14px;
  color: var(--ink);
  border-radius: 2px;
}
.search-form button {
  border: 0;
  background: var(--green);
  color: white;
  padding: 14px 25px;
  border-radius: 2px;
}
.result-count { font-size: 12px; color: var(--muted); margin: 0 0 25px; }

[hidden] { display: none !important; }
.empty { padding: 30px 0; line-height: 2; color: var(--muted); }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: clamp(60px, 10vw, 90px) 0; }
.notfound h1 { font: clamp(72px, 16vw, 100px) var(--serif); margin: 0; }
.notfound p { font-size: 14px; }
.notfound a {
  display: inline-block;
  margin-top: 15px;
  border-bottom: 1px solid;
  padding-bottom: 8px;
  font-size: 13px;
}

/* ========== Breakpoints (content-aware, fluid sizing fills the gaps) ========== */

@media (min-width: 1400px) {
  .wrap { max-width: 1400px; padding: 0 70px; }
}

/* Stack the two-column hero before it gets cramped. */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }
  .hero-caption { font-size: 8px; }
}

/* Collapse the article TOC above the body before the sidebar squeezes text. */
@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 680px;
    margin: auto;
  }
  .toc {
    position: static;
    top: auto;
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 20px;
  }
  .toc ol { margin-bottom: 0; }
}

/* Hide the secondary masthead link only once space is genuinely tight;
   the search link and wordmark always remain. */
@media (max-width: 560px) {
  .mast-right > a:first-child { display: none; }
  .nav-note { display: none; }
  .intro h1 { letter-spacing: 0; }
  .article-header { text-align: left; }
  .article-header .eyebrow,
  .article-header .meta { justify-content: flex-start; }
  .article-header h1 { line-height: 1.5; }
  .foot-links a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Every category stays visible on the narrowest phones, without a hidden
   horizontally scrolling menu. The cells can also grow with enlarged text. */
@media (max-width: 380px) {
  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 8px;
    overflow: visible;
  }
  .nav a {
    min-width: 0;
    min-height: 44px;
    padding: 12px 0;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *:before, *:after { transition: none !important; }
}
