:root {
  --history-navy: #09233f;
  --history-blue: #315f7d;
  --history-teal: #26736f;
  --history-gold: #9b7437;
  --history-rust: #9d5145;
  --history-paper: #f6f4ee;
  --history-surface: #ffffff;
  --history-ink: #172a3d;
  --history-muted: #5f6f80;
  --history-line: #d7dee3;
  --history-pale-blue: #edf3f6;
  --history-pale-gold: #f1eadc;
  --history-pale-teal: #e9f2ef;
}

.excel-history-page .content-context {
  margin-top: 79px;
}

.excel-history-page .content-context-inner {
  min-height: 54px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.excel-history-page .content-context ol {
  min-width: 0;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.excel-history-page .content-context li {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.excel-history-page .content-context li:not(:last-child)::after {
  color: #98a4af;
  content: "/";
}

.excel-history-page .content-context a {
  color: var(--history-muted);
  text-decoration: none;
}

.excel-history-page .content-context a:hover,
.excel-history-page .content-context a:focus-visible,
.excel-history-page .content-context-all {
  color: var(--history-navy);
}

.excel-history-page .content-context-all {
  flex: 0 0 auto;
  font-weight: 700;
}

.excel-history-shell {
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
}

.excel-history-article-width {
  width: min(760px, calc(100% - 48px));
  margin: 0 auto;
}

.excel-history-kicker {
  margin: 0 0 .75rem;
  color: var(--history-gold);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: .06em;
}

.excel-history-hero {
  padding: 5.2rem 0 5.5rem;
  border-bottom: 1px solid var(--history-line);
  background:
    linear-gradient(90deg, rgba(9, 35, 63, .025) 1px, transparent 1px) 0 0 / 96px 96px,
    var(--history-paper);
}

.excel-history-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .72fr);
  gap: clamp(2.8rem, 6vw, 5.7rem);
  align-items: center;
}

.excel-history-hero-copy h1 {
  max-width: 760px;
  margin: 1.1rem 0 0;
  color: var(--history-navy);
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(2.35rem, 4.15vw, 3.55rem);
  font-weight: 600;
  line-height: 1.38;
  letter-spacing: -.045em;
}

.excel-history-hero-copy h1 span {
  display: block;
  word-break: keep-all;
  overflow-wrap: normal;
}

.excel-history-hero-copy h1 span:last-child {
  margin-top: .45em;
  font-size: .56em;
  line-height: 1.65;
  letter-spacing: -.025em;
}

.excel-history-lead {
  max-width: 700px;
  margin: 1.7rem 0 0;
  color: var(--history-muted);
  font-size: 1rem;
  line-height: 2;
}

.excel-history-primary {
  display: inline-flex;
  gap: .75rem;
  align-items: center;
  margin-top: 2rem;
  padding-bottom: .32rem;
  border-bottom: 1px solid var(--history-navy);
  color: var(--history-navy);
  font-size: .88rem;
  font-weight: 700;
  text-decoration: none;
}

.excel-history-hero-ledger {
  position: relative;
  padding: 1.4rem;
  border: 1px solid #cbd4dc;
  background: var(--history-surface);
  box-shadow: 18px 18px 0 var(--history-pale-gold);
}

.excel-history-ledger-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding-bottom: .8rem;
  border-bottom: 3px solid var(--history-navy);
}

.excel-history-ledger-head span {
  color: var(--history-muted);
  font: 600 .68rem/1.4 Montserrat, 'Noto Sans JP', sans-serif;
}

.excel-history-ledger-head strong {
  color: var(--history-navy);
  font-size: .82rem;
}

.excel-history-ledger-row {
  display: grid;
  grid-template-columns: 4rem 1fr 1fr;
  gap: .5rem;
  align-items: center;
  margin-top: 1rem;
  padding: .85rem;
  background: var(--history-pale-blue);
}

.excel-history-ledger-row span {
  color: var(--history-muted);
  font-size: .72rem;
  font-weight: 700;
}

.excel-history-ledger-row del,
.excel-history-ledger-row ins {
  font-size: .82rem;
  font-weight: 700;
  text-decoration-thickness: 1px;
}

.excel-history-ledger-row del {
  color: #7a8189;
}

.excel-history-ledger-row ins {
  color: var(--history-teal);
  text-decoration: none;
}

.excel-history-hero-ledger ol {
  position: relative;
  display: grid;
  gap: 0;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}

.excel-history-hero-ledger ol::before {
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 2.15rem;
  width: 1px;
  background: #c6d0d8;
  content: '';
}

.excel-history-hero-ledger li {
  position: relative;
  display: grid;
  grid-template-columns: 4.3rem 1fr;
  gap: .75rem;
  padding: .75rem 0;
}

.excel-history-hero-ledger time {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 2.2rem;
  place-items: center;
  border: 1px solid #b8c7d3;
  border-radius: 99px;
  color: var(--history-blue);
  background: #fff;
  font: 600 .63rem/1 Montserrat, sans-serif;
}

.excel-history-hero-ledger li.is-missing time {
  border-color: #ca9f96;
  color: var(--history-rust);
  background: #fff8f6;
}

.excel-history-hero-ledger li strong,
.excel-history-hero-ledger li span {
  display: block;
}

.excel-history-hero-ledger li strong {
  color: var(--history-navy);
  font-size: .78rem;
  line-height: 1.5;
}

.excel-history-hero-ledger li span {
  margin-top: .2rem;
  color: var(--history-muted);
  font-size: .68rem;
  line-height: 1.5;
}

.excel-history-hero-ledger li.is-missing strong {
  color: var(--history-rust);
}

.excel-history-section {
  padding: 5.5rem 0;
  scroll-margin-top: 100px;
}

.excel-history-section h2 {
  margin: 0;
  color: var(--history-navy);
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(1.85rem, 4vw, 2.7rem);
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: -.03em;
  text-wrap: pretty;
}

.excel-history-section p {
  color: var(--history-muted);
  line-height: 2;
}

.excel-history-answer {
  background: var(--history-surface);
}

.excel-history-answer-lead {
  margin: 1.5rem 0 0;
  color: var(--history-ink) !important;
  font-size: 1.05rem;
}

.excel-history-layer-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.excel-history-layer-list > li {
  position: relative;
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: .85rem;
  padding: 1.45rem;
  border: 1px solid var(--history-line);
  background: var(--history-surface);
}

.excel-history-layer-list > li::after {
  position: absolute;
  right: -.75rem;
  bottom: -.75rem;
  left: .75rem;
  z-index: -1;
  height: .75rem;
  content: '';
}

.excel-history-layer-list > li[data-history-layer="cell"]::after { background: var(--history-pale-blue); }
.excel-history-layer-list > li[data-history-layer="file"]::after { background: var(--history-pale-gold); }
.excel-history-layer-list > li[data-history-layer="record"]::after { background: var(--history-pale-teal); }

.excel-history-layer-list > li > span {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--history-navy);
  font: 600 .68rem/1 Montserrat, sans-serif;
}

.excel-history-layer-list p,
.excel-history-layer-list h3,
.excel-history-layer-list strong,
.excel-history-layer-list small {
  display: block;
  margin: 0;
}

.excel-history-layer-list p {
  color: var(--history-gold);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.55;
}

.excel-history-layer-list h3 {
  margin-top: .35rem;
  color: var(--history-navy);
  font-size: 1.15rem;
  line-height: 1.5;
}

.excel-history-layer-list strong {
  margin-top: .7rem;
  color: var(--history-ink);
  font-size: .84rem;
  line-height: 1.7;
}

.excel-history-layer-list small {
  margin-top: .55rem;
  color: var(--history-muted);
  font-size: .75rem;
  line-height: 1.75;
}

.excel-history-comparison-section,
.excel-history-version-section,
.excel-history-decision-section {
  border-top: 1px solid var(--history-line);
  border-bottom: 1px solid var(--history-line);
  background: var(--history-paper);
}

.excel-history-section-heading {
  max-width: 780px;
}

.excel-history-section-heading > p:last-child {
  margin: 1.15rem 0 0;
}

.excel-history-question-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.2rem;
}

.excel-history-question-grid article {
  padding: 1.6rem;
  border-top: 4px solid var(--history-blue);
  background: var(--history-surface);
  box-shadow: 0 12px 30px rgba(9, 35, 63, .06);
}

.excel-history-question-grid article:nth-child(2) { border-color: var(--history-gold); }
.excel-history-question-grid article:nth-child(3) { border-color: var(--history-teal); }

.excel-history-question-grid article > p {
  margin: 0;
  color: var(--history-gold);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.4;
}

.excel-history-question-grid h3 {
  min-height: 4.9rem;
  margin: .55rem 0 0;
  color: var(--history-navy);
  font-size: 1.04rem;
  line-height: 1.7;
}

.excel-history-question-grid dl {
  margin: 1.1rem 0 0;
}

.excel-history-question-grid dl > div {
  padding: .85rem 0;
  border-top: 1px solid var(--history-line);
}

.excel-history-question-grid dt {
  color: var(--history-gold);
  font-size: .68rem;
  font-weight: 700;
}

.excel-history-question-grid dd {
  margin: .35rem 0 0;
  color: var(--history-ink);
  font-size: .8rem;
  line-height: 1.75;
}

.excel-history-howto-section,
.excel-history-example-section,
.excel-history-next-section,
.excel-history-sources-section {
  background: var(--history-surface);
}

.excel-history-howto-section > div > p:not(.excel-history-kicker),
.excel-history-version-grid > div > p:not(.excel-history-kicker),
.excel-history-next-section > div > p:not(.excel-history-kicker) {
  margin: 1.45rem 0 0;
}

.excel-history-steps {
  display: grid;
  gap: 0;
  margin: 2rem 0 0;
  padding: 0;
  border-top: 1px solid var(--history-line);
  list-style: none;
}

.excel-history-steps li {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 1rem;
  padding: 1.45rem 0;
  border-bottom: 1px solid var(--history-line);
}

.excel-history-steps li > span {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--history-blue);
  font: 600 .72rem/1 Montserrat, sans-serif;
}

.excel-history-steps strong {
  color: var(--history-navy);
  line-height: 1.7;
}

.excel-history-steps p {
  margin: .4rem 0 0;
  font-size: .9rem;
}

.excel-history-limit-box {
  margin-top: 2.2rem;
  padding: 1.6rem;
  border-left: 4px solid var(--history-rust);
  background: #fbf4f1;
}

.excel-history-limit-box h3 {
  margin: 0;
  color: #7e3f37;
  font-size: 1rem;
  line-height: 1.6;
}

.excel-history-limit-box ul {
  display: grid;
  gap: .6rem;
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  color: var(--history-muted);
  font-size: .85rem;
  line-height: 1.8;
}

.excel-history-version-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, .68fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}

.excel-history-contrast {
  margin: 0;
  border: 1px solid var(--history-line);
  background: var(--history-surface);
}

.excel-history-contrast > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding: 1.4rem;
}

.excel-history-contrast > div + div {
  border-top: 1px solid var(--history-line);
}

.excel-history-contrast dt {
  color: var(--history-gold);
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.6;
}

.excel-history-contrast strong,
.excel-history-contrast span {
  display: block;
}

.excel-history-contrast strong {
  color: var(--history-navy);
  font-size: .92rem;
  line-height: 1.6;
}

.excel-history-contrast span {
  margin-top: .45rem;
  color: var(--history-muted);
  font-size: .78rem;
  line-height: 1.75;
}

.excel-history-example-card {
  margin-top: 2rem;
  border: 1px solid var(--history-line);
  background: var(--history-surface);
  box-shadow: 0 16px 40px rgba(9, 35, 63, .07);
}

.excel-history-example-row {
  display: grid;
  grid-template-columns: 6rem 1fr 4rem 1.4fr;
  gap: .8rem;
  align-items: center;
  padding: 1.15rem 1.4rem;
  color: #fff;
  background: var(--history-navy);
}

.excel-history-example-row span {
  color: #d8c89d;
  font-size: .72rem;
  font-weight: 700;
}

.excel-history-example-row strong {
  font-size: .88rem;
}

.excel-history-example-row del {
  color: #c3ccd4;
  text-decoration-thickness: 1px;
}

.excel-history-example-card ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.excel-history-example-card li {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.2rem;
  padding: 1.35rem 1.4rem;
  border-top: 1px solid var(--history-line);
}

.excel-history-example-card li span {
  color: var(--history-gold);
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.7;
}

.excel-history-example-card li p {
  margin: 0;
  color: var(--history-ink);
  font-size: .88rem;
  line-height: 1.85;
}

.excel-history-example-conclusion {
  max-width: 800px;
  margin: 1.5rem 0 0;
  color: var(--history-ink) !important;
}

.excel-history-route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2.2rem;
}

.excel-history-route-grid article {
  padding: 1.5rem;
  border: 1px solid var(--history-line);
  background: var(--history-surface);
}

.excel-history-route-grid article::before {
  display: block;
  width: 3rem;
  height: 4px;
  margin-bottom: 1rem;
  background: var(--history-blue);
  content: '';
}

.excel-history-route-grid article[data-route="records"]::before { background: var(--history-gold); }
.excel-history-route-grid article[data-route="workflow"]::before { background: var(--history-teal); }

.excel-history-route-grid article > p {
  margin: 0;
  color: var(--history-gold);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.5;
}

.excel-history-route-grid h3 {
  margin: .45rem 0 0;
  color: var(--history-navy);
  font-size: 1.08rem;
  line-height: 1.65;
}

.excel-history-route-grid ul {
  display: grid;
  gap: .6rem;
  margin: 1.2rem 0 0;
  padding-left: 1.15rem;
  color: var(--history-muted);
  font-size: .82rem;
  line-height: 1.75;
}

.excel-history-output-note {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-left: 4px solid var(--history-teal);
  background: var(--history-pale-teal);
}

.excel-history-output-note strong {
  color: var(--history-navy);
  line-height: 1.7;
}

.excel-history-output-note p {
  margin: 0;
}

.excel-history-requirement-line {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid #c7b78d;
  background: #fffaf0;
}

.excel-history-requirement-line span {
  display: inline-block;
  padding: .25rem .55rem;
  color: #fff;
  background: var(--history-gold);
  font-size: .68rem;
  font-weight: 700;
}

.excel-history-requirement-line p {
  margin: .9rem 0 0;
  color: var(--history-ink);
}

.excel-history-requirement-line strong {
  color: var(--history-navy);
}

.excel-history-next-list {
  display: grid;
  gap: .65rem;
  margin: 1.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--history-muted);
  line-height: 1.85;
}

.excel-history-sources-section {
  padding-top: 2.5rem;
  border-top: 1px solid var(--history-line);
}

.excel-history-sources-section h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.excel-history-sources-section ul {
  display: grid;
  gap: 0;
  margin: 1.6rem 0 0;
  padding: 0;
  border-top: 1px solid var(--history-line);
  list-style: none;
}

.excel-history-sources-section li {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  gap: 1.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--history-line);
}

.excel-history-sources-section a {
  color: var(--history-navy);
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.75;
  text-underline-offset: .18em;
}

.excel-history-sources-section li span {
  color: var(--history-muted);
  font-size: .76rem;
  line-height: 1.75;
}

.excel-history-source-note {
  margin: 1.2rem 0 0;
  font-size: .76rem;
}

.excel-history-page .content-back a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .15rem .8rem;
  width: min(1080px, calc(100% - 48px));
  margin: 0 auto;
  padding: 2rem 0;
  color: var(--history-navy);
  text-decoration: none;
}

.excel-history-page .content-back a > span {
  grid-row: 1 / 3;
  align-self: center;
}

.excel-history-page .content-back a > strong,
.excel-history-page .content-back a > small {
  display: block;
}

.excel-history-page .content-back a > small {
  color: var(--history-muted);
}

@media (max-width: 900px) {
  .excel-history-hero-grid,
  .excel-history-version-grid {
    grid-template-columns: 1fr;
  }

  .excel-history-hero-ledger {
    max-width: 560px;
  }

  .excel-history-layer-list,
  .excel-history-question-grid,
  .excel-history-route-grid {
    grid-template-columns: 1fr;
  }

  .excel-history-question-grid h3 {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .excel-history-page .content-context {
    margin-top: 68px;
  }

  .excel-history-page .content-context ol {
    overflow: hidden;
    white-space: nowrap;
  }

  .excel-history-page .content-context li:last-child,
  .excel-history-page .content-context-all {
    display: none;
  }

  .excel-history-page .content-context li:nth-last-child(2)::after {
    display: none;
  }

  .excel-history-shell,
  .excel-history-article-width,
  .excel-history-page .content-back a {
    width: min(100% - 32px, 760px);
  }

  .excel-history-hero {
    padding: 3.4rem 0 4rem;
  }

  .excel-history-hero-grid {
    gap: 2.5rem;
  }

  .excel-history-hero-copy h1 {
    font-size: clamp(2rem, 10.2vw, 2.65rem);
    line-height: 1.43;
  }

  .excel-history-hero-copy h1 span:last-child {
    font-size: .64em;
    line-height: 1.7;
  }

  .excel-history-lead {
    margin-top: 1.4rem;
    font-size: .92rem;
    line-height: 1.9;
  }

  .excel-history-hero-ledger {
    padding: 1rem;
    box-shadow: 9px 9px 0 var(--history-pale-gold);
  }

  .excel-history-ledger-head {
    align-items: flex-start;
    flex-direction: column;
    gap: .3rem;
  }

  .excel-history-ledger-row {
    grid-template-columns: 3.3rem 1fr 1fr;
    padding: .7rem;
  }

  .excel-history-section {
    padding: 4rem 0;
    scroll-margin-top: 88px;
  }

  .excel-history-section h2 {
    font-size: 1.75rem;
  }

  .excel-history-layer-list {
    margin-top: 2rem;
  }

  .excel-history-layer-list > li {
    grid-template-columns: 2.3rem minmax(0, 1fr);
    padding: 1.25rem 1rem;
  }

  .excel-history-question-grid article,
  .excel-history-route-grid article {
    padding: 1.3rem;
  }

  .excel-history-steps li {
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: .75rem;
  }

  .excel-history-limit-box {
    padding: 1.3rem;
  }

  .excel-history-contrast > div,
  .excel-history-example-card li,
  .excel-history-output-note,
  .excel-history-sources-section li {
    grid-template-columns: 1fr;
    gap: .55rem;
  }

  .excel-history-example-row {
    grid-template-columns: 5rem 1fr;
    gap: .45rem .8rem;
  }

  .excel-history-example-card li {
    padding: 1.2rem 1rem;
  }

  .excel-history-output-note {
    padding: 1.25rem;
  }

  .excel-history-requirement-line {
    padding: 1.25rem;
  }

  .excel-history-page .content-back a {
    padding: 1.6rem 0;
  }
}

@media print {
  .excel-history-page .site-header,
  .excel-history-page .content-context,
  .excel-history-page .content-back,
  .excel-history-page .site-footer,
  .excel-history-primary {
    display: none;
  }

  .excel-history-page .excel-history-hero {
    padding-top: 1rem;
  }

  .excel-history-page .excel-history-section {
    padding: 2rem 0;
  }

  .excel-history-page a {
    color: #000;
  }
}
