:root {
  color-scheme: light;
  --ink: #251914;
  --paper: #f7f1e8;
  --red: #a63530;
  --gold: #e2ab62;
  --rule: #dcc9b4;
  --sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif CJK JP", serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 1rem/1.65 var(--sans); }
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: .22em; }
:focus-visible { outline: 3px solid #ca7b32; outline-offset: 4px; }
.shell { width: min(100% - 3rem, 72rem); margin-inline: auto; }
.site-bar { position: relative; z-index: 1; color: #fff4e9; background: #211313; border-bottom: 1px solid #fff2df26; }
.nav { display: flex; min-height: 65px; justify-content: space-between; align-items: center; gap: 1rem; }
.wordmark { display: flex; align-items: center; gap: .65rem; font-family: var(--serif); font-weight: 800; white-space: nowrap; }
.crest { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 5px; background: #a53934; color: #fff; }
.nav nav { display: flex; gap: 1.4rem; }
.nav a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.nav nav a { font-size: .875rem; color: #ebd7c9; }
.hero { min-height: 535px; display: grid; align-items: center; isolation: isolate; position: relative; overflow: clip; color: #fff6eb; background: radial-gradient(ellipse at 77% 39%, #482621 0%, #261715 50%, #211313 77%); }
.hero-lineage {
  position: absolute; right: max(4%, calc((100% - 72rem) / 2)); top: 50%; translate: 0 -50%;
  width: min(36vw, 27rem); text-align: center; color: #efbc8a; pointer-events: none;
}
.hero-seal {
  display: grid; place-items: center; width: min(62%, 15rem); aspect-ratio: 1; margin: auto;
  border: 1px solid #c37f59; outline: 1px solid #c37f5966; outline-offset: 9px; border-radius: 50%;
  background: radial-gradient(circle, #7e3831 0%, #3f211e 71%, #321c18 100%);
  font: 800 clamp(4rem, 11vw, 9rem)/1 var(--serif);
  animation: hero-entry .8s .16s both;
}
.hero-stem { display: block; margin: 10px auto 0; height: 38px; width: 1px; background: #c37f59; transform-origin: top; animation: line-grow .34s .58s both; }
.hero-branches { display: grid; grid-template-columns: repeat(3,1fr); }
.hero-branches span { border-top: 1px solid #c37f5988; padding: .65rem .2rem 0; font-size: .875rem; letter-spacing: .12em; animation: hero-entry .45s .8s both; }
.hero-branches span:nth-child(2) { animation-delay: .94s; }
.hero-branches span:nth-child(3) { animation-delay: 1.08s; }
.hero-inner { padding-block: 4rem 4.5rem; animation: hero-entry .85s cubic-bezier(.16,1,.3,1) both; }
.hero-origin, .section-kicker { color: var(--red); font-size: .875rem; font-weight: 750; letter-spacing: .12em; margin: 0 0 .8rem; }
.hero-origin { display: flex; align-items: center; gap: .65rem; color: #f0bc7c; }
.hero-origin span { width: 27px; height: 1px; background: currentColor; }
.hero h1 { margin: 0; font: 850 clamp(3.2rem, 7.8vw, 7rem)/1.08 var(--serif); letter-spacing: -.065em; }
.hero h1 em { font-style: normal; color: #ffd4a0; }
.hero-description { color: #f0ded0; margin: 1.3rem 0 1.6rem; font-size: 1.0625rem; }
.primary { display: inline-flex; align-items: center; min-height: 50px; padding: .72rem 1.3rem; background: #a3322d; color: #fff; border-radius: 5px; text-decoration: none; font-weight: 750; transition: background .2s, translate .2s; }
.primary:hover { background: #b93d36; translate: 0 -2px; }
.atlas { padding: clamp(3rem, 7vw, 6rem) 0 4.5rem; }
.atlas-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.7rem; }
.atlas-heading h2, .sources h2 { font: 800 clamp(2.5rem,5.5vw,4.6rem)/1.06 var(--serif); letter-spacing: -.08em; margin: 0; }
.atlas-heading > p { margin: 0; color: #6d5446; }
.controls { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .8rem 1rem; padding-top: 1.15rem; border-top: 1px solid var(--rule); }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.filters button, .search { border: 1px solid #d2bfab; background: #fffaf3; border-radius: 6px; color: #573a30; min-height: 46px; }
.filters button { padding: .45rem .8rem; transition: color .2s, background .2s; }
.filters button[aria-pressed="true"] { background: #3b2420; border-color: #3b2420; color: #fff8ed; }
.search { display: flex; min-width: 0; align-items: center; gap: .6rem; padding-inline: .85rem; }
.search span { flex: 0 0 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; }
.search span::after { content: ""; position: absolute; width: 6px; height: 1.5px; background: currentColor; rotate: 45deg; right: -4px; bottom: -2px; }
.search input { border: 0; color: var(--ink); background: transparent; width: min(12rem, 53vw); min-height: 44px; }
.results { margin: .65rem 0 1rem; color: #705a4d; font-size: .875rem; }
.chart { border: 1px solid #dfcdbc; background: #f4e9d9; border-radius: 12px; padding: clamp(1rem, 4.5vw, 2.8rem); }
.origin-node { max-width: 280px; margin-inline: auto; position: relative; }
.origin-node::after { content: ""; display: block; position: absolute; width: 1px; height: 27px; left: 50%; top: 100%; background: #ae7a5c; transform-origin: top; }
.branch-grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 1.1rem; position: relative; padding-top: 27px; }
.branch-grid.single { grid-template-columns: 1fr; }
.branch-grid::before { content: ""; position: absolute; top: 26px; left: 15%; right: 15%; height: 1px; background: #ae7a5c; transform-origin: center; }
.branch-grid.single::before, .chart.root-only .origin-node::after { display: none; }
.branch { border: 1px solid #dcc7b2; border-top-color: #ae7a5c; border-radius: 0 0 8px 8px; min-width: 0; padding: .95rem; background: #fff8ee80; }
.branch h3 { display: flex; align-items: center; gap: .5rem; font-size: .95rem; margin: 0 0 .9rem; }
.branch h3 span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.history-branch h3 span { background: #8c612e; }
.chart ul { list-style: none; padding: 0; margin: 0; }
.direct-list { display: grid; gap: .7rem; grid-template-columns: repeat(2,minmax(0,1fr)); }
.chart .offspring { margin: .5rem 0 0 .47rem; padding-left: .75rem; border-left: 1px solid #bf9475; display: grid; gap: .5rem; }
.offspring > li { position: relative; }
.offspring > li::before { content: ""; position: absolute; top: 23px; right: 100%; width: .75rem; height: 1px; background: #bf9475; }
.shop-card { width: 100%; display: grid; gap: .16rem; padding: .64rem .75rem; text-align: left; border: 1px solid #dcc6b5; border-left: 3px solid #b65145; border-radius: 6px; background: #fffcf7; color: var(--ink); min-height: 82px; transition: translate .24s, background .24s, border-color .24s; }
.shop-card:hover { translate: 0 -2px; border-color: #a45945; background: #fff; }
.shop-card[data-kind="root"] { min-height: 107px; background: #712c27; border-color: #a75c43; color: #fff5e9; }
.shop-card[data-kind="history"] { border-left-color: #947042; }
.shop-card[data-kind="shop"] { border-left-color: #bd9579; }
.shop-top { display: flex; justify-content: space-between; gap: .3rem; align-items: center; }
.shop-label, .shop-year { font-size: .8rem; color: #834b3b; }
.shop-year { font-variant-numeric: tabular-nums; }
[data-node].is-match > .lineage-node .shop-card { outline: 2px solid #a64a39; outline-offset: 2px; }
.shop-card strong { font: 800 1.2rem/1.3 var(--serif); overflow-wrap: anywhere; }
.shop-card[data-kind="root"] strong { font-size: 1.8rem; }
.shop-place { font-size: .875rem; color: #624a3b; }
.shop-card[data-kind="root"] :is(.shop-label,.shop-year,.shop-place) { color: #f5d8c0; }
.empty { margin: 0; padding: 1rem; }
.chart.is-visible .origin-node::after { animation: line-grow .35s .15s both; }
.chart.is-visible .branch-grid::before { animation: branch-grow .45s .45s both; }
.chart.is-visible .branch { animation: hero-entry .5s .36s both; }
.chart.is-visible .branch .lineage-node { animation: hero-entry .38s var(--arrival, .42s) both; }
.chart.changed .branch { animation: hero-entry .3s both; }
.sources { background: #281a17; color: #faebdf; padding: 4rem 0; }
.sources .section-kicker { color: #e6a570; }
.sources h2 { font-size: clamp(2rem,4vw,3.2rem); }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem 2.5rem; }
.sources p:not(.section-kicker) { color: #e6cfc0; }
.sources ul { margin: 0; padding: 0; list-style: none; }
.sources li { padding: .68rem 0; border-bottom: 1px solid #ffe7cf32; }
.sources li a { display: inline-block; padding: .4rem 0; }
.shop-dialog { width: min(100% - 1.5rem, 34rem); max-height: 88dvh; padding: 0; border: 1px solid #d4bba4; border-radius: 12px; background: #fff9f0; color: var(--ink); }
.shop-dialog[open] { animation: dialog-in .24s cubic-bezier(.16,1,.3,1) both; }
.shop-dialog::backdrop { background: #1f1111aa; }
.dialog-inner { padding: clamp(1rem, 5vw, 2rem); }
.dialog-bar { display: flex; align-items: center; justify-content: space-between; }
.dialog-bar p { margin: 0; }
.close { min-width: 44px; min-height: 44px; font-size: 1.4rem; border: 1px solid var(--rule); border-radius: 6px; color: var(--ink); background: transparent; }
.shop-dialog h2 { font: 850 clamp(1.75rem,6vw,2.7rem)/1.13 var(--serif); margin: .55rem 0 0; overflow-wrap: anywhere; }
#detail-place { margin: .45rem 0; color: #654b3b; }
.trail { border-block: 1px solid var(--rule); margin: 1.25rem 0; padding: .75rem 0; }
.trail h3 { margin: 0 0 .5rem; font-size: .9375rem; }
.trail ol { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; list-style: none; padding: 0; margin: 0; }
.trail li { display: flex; align-items: center; gap: .35rem; }
.trail li + li::before { content: ""; width: .7rem; height: 1px; background: #bc8c6a; }
.trail button { min-height: 44px; background: #f4e3d4; border: 1px solid #dbc1aa; color: #533125; border-radius: 4px; font-size: .875rem; padding: .3rem .5rem; }
.trail [aria-current] { font-weight: 750; }
#detail-source { display: inline-flex; align-items: center; min-height: 44px; color: #7d3a2e; }
@keyframes hero-entry { from { opacity: 0; transform: translateY(13px); } to { opacity: 1; transform: translateY(0); } }
@keyframes line-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes branch-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) {
  .shell { width: calc(100% - 2rem); }
  .nav { min-height: 60px; }
  .nav nav { gap: .8rem; }
  .hero { min-height: 0; align-items: start; }
  .hero-lineage { position: relative; top: auto; right: auto; translate: none; grid-row: 2; margin: 0 auto 2.5rem; width: min(64%, 18rem); }
  .hero-seal { width: 40%; font-size: clamp(2.6rem, 9vw, 4rem); outline-offset: 5px; }
  .hero-stem { height: 21px; margin-top: 6px; }
  .hero-inner { padding-block: 2.8rem 2rem; }
  .hero h1 { font-size: clamp(2.7rem, 9.6vw, 4.6rem); }
  .hero-description { font-size: 1rem; margin-top: .85rem; }
  .atlas-heading { display: block; }
  .atlas-heading > p { margin-top: .7rem; }
  .wide-only { display: none; }
  .search, .search input { width: 100%; }
  .branch-grid, .source-grid { grid-template-columns: 1fr; }
  .branch-grid::before { display: none; }
}
@media (max-width: 460px) {
  .direct-list { grid-template-columns: 1fr; }
  .chart { padding: .7rem; }
  .branch { padding: .75rem; }
  .filters { gap: .35rem; }
  .filters button { padding-inline: .6rem; font-size: .875rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
