:root {
  color-scheme: light;
  --paper: #f2f4f8;
  --white: #fbfcff;
  --ink: #18263b;
  --quiet: #486075;
  --line: #cbd5e2;
  --blue: #264d78;
  --deep: #192e47;
  --lime: #e1edaa;
  --light-ink: #f1f6fb;
  --tone-a: #e4edf9;
  --tone-b: #e5eee8;
  --tone-c: #eae7f5;
  --serif: 'Songti SC', 'Noto Serif CJK SC', 'STSong', SimSun, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #101c2b;
  --white: #172638;
  --ink: #eef5fc;
  --quiet: #bac9dc;
  --line: #344961;
  --blue: #b4d5fc;
  --deep: #1a304c;
  --tone-a: #253d56;
  --tone-b: #254239;
  --tone-c: #3c3552;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1.5rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.75 var(--sans); }
img { display: block; max-width: 100%; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: .24em; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.wrap { width: min(76rem, calc(100% - 5rem)); margin-inline: auto; }
.skip { position: absolute; inset: .75rem auto auto .75rem; z-index: 3; padding: .5rem 1rem; background: var(--white); transform: translateY(-180%); }
.skip:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); }
.masthead { min-height: 5rem; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; width: fit-content; color: inherit; font-weight: 750; font-size: 1.13rem; line-height: 1.23; text-decoration: none; }
.brand small { display: block; margin-top: .22rem; font-size: .75rem; font-weight: 550; color: var(--quiet); }
.brand-mark { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: .23rem; width: 2.25rem; height: 2.25rem; padding: .48rem; border-radius: .66rem .66rem .66rem .2rem; background: #234166; transform: rotate(-7deg); }
.brand-mark i { display: block; width: 100%; height: 2px; background: #e1edaa; border-radius: 2px; }
.brand-mark i:nth-child(2) { width: 70%; }
.brand-mark i:nth-child(3) { width: 85%; }
.masthead nav { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.3rem); }
.masthead nav a { color: var(--quiet); font-size: .94rem; text-decoration: none; }
.masthead nav a:hover { color: var(--ink); text-decoration: underline; }
.theme-button { justify-self: end; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--ink); padding: .32rem .85rem; font-size: .88rem; }
.theme-button:hover { background: var(--white); }

.cover { display: grid; grid-template-columns: 47% 53%; min-height: 27rem; margin-top: 2.3rem; background: var(--deep); color: var(--light-ink); border-radius: 1.2rem 1.2rem 1.2rem .35rem; overflow: hidden; }
.cover-copy { padding: clamp(2rem, 5vw, 4.65rem); padding-right: clamp(1.8rem, 4vw, 3.5rem); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.cover-category { margin: 0 0 1.2rem; color: #c2d5ed; font-size: .93rem; }
.cover-category::before { content: ''; display: inline-block; vertical-align: middle; margin-right: .65rem; width: 1.4rem; height: 1px; background: #aac2e2; }
.cover h1 { margin: 0; font: 700 clamp(2.5rem, 4.1vw, 4.45rem)/1.22 var(--serif); letter-spacing: -.045em; }
.cover-intro { max-width: 25rem; margin: 1.2rem 0 1.65rem; color: #d6e1ee; }
.cover-link { border-radius: .44rem; background: var(--lime); color: #26332b; padding: .62rem 1.03rem; font-weight: 680; text-decoration: none; }
.cover-link:hover { background: #edf6c6; }
.cover-photo { position: relative; min-height: 20rem; background: #30445c; }
.cover-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 55% 58%; }

.library { margin-block: 3.1rem 4rem; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; }
.section-head h2 { margin: 0; font: 700 clamp(1.7rem, 3vw, 2.5rem)/1.28 var(--serif); }
.section-head p { margin: .45rem 0 0; color: var(--quiet); }
.search-area { display: grid; gap: .25rem; width: min(100%, 18rem); }
.search-area label { font-size: .87rem; font-weight: 650; }
.search-area input { width: 100%; border: 1px solid var(--line); border-radius: .55rem; padding: .52rem .75rem; color: var(--ink); background: var(--white); }
.search-area input::placeholder { color: var(--quiet); opacity: .88; }
.filter-bar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: 1.4rem 0 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .45rem; }
.filters button { border: 1px solid transparent; border-radius: 99px; color: var(--quiet); padding: .31rem .75rem; background: transparent; font-size: .9rem; }
.filters button:hover { border-color: var(--line); }
.filters button[aria-pressed='true'] { color: var(--ink); border-color: var(--line); background: var(--white); font-weight: 670; }
#result-count { margin: 0; color: var(--quiet); text-align: right; font-size: .87rem; white-space: nowrap; }
.note-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.note-card { display: flex; flex-direction: column; min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; }
.note-top { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1.15rem; background: var(--tone-a); }
.tone-1 .note-top { background: var(--tone-b); }
.tone-2 .note-top { background: var(--tone-c); }
.note-symbol { font-family: Georgia, var(--sans); font-size: 1.8rem; line-height: 1; color: var(--blue); }
.bookmark { flex-shrink: 0; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: .35rem; font-size: .88rem; padding: .2rem .59rem; }
.bookmark[aria-pressed='true'] { background: var(--lime); color: #26332b; border-color: #c8d592; }
.bookmark:hover { text-decoration: underline; }
.note-body { flex: 1; padding: 1rem 1.15rem .3rem; }
.note-topic { margin: 0 0 .25rem; font-size: .89rem; font-weight: 680; color: var(--blue); }
.note-body h3 { margin: .28rem 0 .55rem; font-size: 1.2rem; line-height: 1.47; }
.note-body h3 a { text-decoration: none; }
.note-body h3 a:hover { text-decoration: underline; }
.note-body p:last-child { color: var(--quiet); margin: 0; line-height: 1.66; }
.read-time { margin: .7rem 1.15rem 1rem; color: var(--quiet); font-size: .83rem; }
.empty { background: var(--white); border: 1px dashed var(--line); border-radius: .55rem; padding: 1.4rem; }
.empty p { margin: 0 0 .6rem; }
.empty button { color: var(--ink); border: 1px solid var(--line); border-radius: .4rem; background: var(--paper); padding: .3rem .75rem; }

.article-wrap { margin-block: 2.2rem 4rem; }
.back { display: inline-block; color: var(--blue); margin-bottom: 1.3rem; font-size: .93rem; }
.reader-layout { display: grid; grid-template-columns: minmax(0, 49rem) minmax(12rem, 1fr); align-items: start; gap: 1.5rem; }
.reader { background: var(--white); border: 1px solid var(--line); border-radius: 1rem; padding: clamp(1.3rem, 4vw, 3.4rem); }
.reader-header { border-bottom: 1px solid var(--line); padding-bottom: 1.5rem; }
.reader-header h1 { margin: .55rem 0 .8rem; font: 700 clamp(2rem, 4vw, 3.75rem)/1.28 var(--serif); letter-spacing: -.04em; }
.reader-header .note-topic span { font-weight: 450; margin-left: .6rem; color: var(--quiet); }
.standfirst { font-size: 1.12rem; color: var(--quiet); margin: 0 0 1rem; }
.reader section { margin-top: 1.7rem; }
.reader section h2, .takeaway h2 { margin: 0 0 .5rem; font-size: 1.32rem; }
.reader section p { line-height: 1.92; margin: 0; }
.takeaway { margin-top: 1.8rem; background: var(--tone-b); border-radius: .65rem; padding: 1rem 1.2rem; }
.takeaway p { margin: 0; }
.source-link { color: var(--blue); margin: 1.4rem 0; }
.related { border-top: 1px solid var(--line); margin-top: 1.8rem; padding-top: 1rem; display: grid; gap: .2rem; }
.related span { color: var(--quiet); font-size: .9rem; }
.related a { font-weight: 680; }
.contents { position: sticky; top: 1.5rem; background: var(--tone-a); border-radius: .8rem; padding: 1rem 1.2rem; }
.contents p { margin: 0 0 .5rem; font-weight: 700; }
.contents nav { display: grid; gap: .38rem; }
.contents a { color: var(--blue); font-size: .96rem; }

footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; gap: 1.5rem; align-items: flex-start; justify-content: space-between; padding-block: 1.85rem 2.4rem; }
.footer-inner p { margin: .65rem 0 0; color: var(--quiet); }
.footer-inner > a { color: var(--quiet); white-space: nowrap; }

@media (max-width: 56rem) {
  .wrap { width: calc(100% - 2.5rem); }
  .cover { min-height: 23rem; }
  .cover-copy { padding: 2rem; }
  .cover h1 { font-size: clamp(2.35rem, 4.8vw, 3.3rem); }
  .note-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reader-layout { grid-template-columns: minmax(0, 1fr); }
  .contents { position: static; order: -1; }
}

@media (max-width: 39rem) {
  .wrap { width: calc(100% - 1.75rem); }
  .masthead { grid-template-columns: 1fr auto; min-height: 0; padding-block: .8rem; gap: .65rem; }
  .masthead nav { grid-column: 1 / -1; grid-row: 2; }
  .theme-button { grid-column: 2; grid-row: 1; }
  .cover { grid-template-columns: 1fr; margin-top: 1rem; }
  .cover-copy { padding: 1.55rem; }
  .cover-photo { min-height: 13rem; grid-row: 1; }
  .cover h1 { font-size: clamp(2.3rem, 9.5vw, 3.35rem); }
  .cover-category { margin-bottom: .65rem; }
  .cover-intro { margin-block: .95rem 1.15rem; }
  .library { margin-block: 2rem 2.75rem; }
  .section-head { display: grid; gap: 1rem; }
  .search-area { width: 100%; }
  .filter-bar { align-items: start; flex-direction: column; }
  .note-grid { grid-template-columns: minmax(0, 1fr); }
  .article-wrap { margin-top: 1.2rem; }
  .footer-inner { flex-wrap: wrap; }
}
