/* Final layout overrides are loaded after the historical stylesheet. */
:root { --body-leading: 1.82; }
.home-editorial.home-tools {
  width: min(1280px, calc(100% - 3rem));
  grid-template-columns: minmax(270px, .76fr) minmax(360px, 1.24fr) minmax(340px, 1fr);
  grid-auto-rows: 1fr;
  align-items: stretch;
  margin: 3rem auto 5rem;
}
.home-editorial.home-tools > .home-sidebar,
.home-editorial.home-tools > .home-notes-column,
.home-editorial.home-tools > .home-media-column {
  height: 100% !important;
  min-height: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: clamp(.8rem, 1.5vw, 1.2rem);
}
.home-notes-column .latest-notes { min-height: 0; flex: 1 1 auto; }
.home-notes-column .latest-short-notes { flex: 0 0 auto; }
.home-notes-column .latest-notes__list { flex: none; }
.home-media-column .latest-albums { min-height: 0; flex: 1 1 auto; }
.home-media-column .latest-albums__grid { grid-template-columns: 1fr; grid-template-rows: none; }
.home-media-column .clock-card { min-height: 158px; flex: 0 0 auto; padding: .85rem; }
.home-media-column .clock-card .clock-card__film { min-height: 140px; padding: 1rem; }
.home-media-column .clock-card strong { font-size: clamp(2.65rem, 4vw, 4rem); }
.home-sidebar .calendar-card { min-height: 0; flex: 0 0 auto; padding: 1rem; }
.home-sidebar .calendar-card header { align-items: flex-start; gap: .5rem; }
.home-sidebar .calendar-card header > div:first-child { min-width: 0; display: block; }
.home-sidebar .calendar-jump { gap: .25rem; margin-top: .4rem; }
.home-sidebar .calendar-picker > button { min-width: 0; height: 2rem; padding: 0 .48rem; font-size: .72rem; }
.home-sidebar .calendar-arrows { padding-top: 1.45rem; }
.home-sidebar .calendar-arrows button { width: 2rem; height: 2rem; }
.home-sidebar .calendar-week { margin-top: .65rem; font-size: .66rem; }
.home-sidebar .calendar-day { min-height: 1.72rem; font-size: .72rem; }
.home-sidebar .calendar-day i { bottom: .08rem; }
.home-sidebar .recent-update { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; padding: 1.15rem; }
.home-sidebar .recent-update > .section-kicker { margin-bottom: .55rem; }
.home-sidebar .recent-update > a { min-height: 0; flex: 1; display: flex; flex-direction: column; gap: .45rem; padding: .15rem; border-radius: .75rem; transition: color .24s ease, background .24s ease, transform .24s ease; }
.home-sidebar .recent-update > a:hover,
.home-sidebar .recent-update > a:focus-visible { color: var(--blue-deep); background: rgba(131,172,199,.08); transform: translateY(-1px); }
.home-sidebar .recent-update a > span { color: var(--muted); font-size: .72rem; }
.home-sidebar .recent-update h2 { margin: 0; font: 600 clamp(1.2rem, 1.55vw, 1.5rem)/1.4 var(--serif); }
.home-sidebar .recent-update a > p { margin: .1rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.72; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.home-sidebar .recent-update b { display: inline-flex; align-items: center; gap: .3rem; margin-top: auto; padding-top: .4rem; color: var(--blue-deep); font-size: .76rem; }
.home-sidebar .recent-update b svg { width: .9rem; height: .9rem; }

.notes-page { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(1rem, 2.2vw, 2rem); align-items: start; }
.notes-page .long-notes-board { margin-top: 0; }
.short-note-timeline { --note-time-width: 3.8rem; --note-dot-width: 1.15rem; --note-gap: .35rem; --note-pad: .55rem; }
.short-note-timeline::before { left: calc(var(--note-pad) + var(--note-time-width) + var(--note-gap) + var(--note-dot-width) / 2); }
.short-note-item { grid-template-columns: var(--note-time-width) var(--note-dot-width) minmax(0, 1fr); gap: var(--note-gap); padding-inline: var(--note-pad); }
.short-note-item time { align-items: flex-start; }
.short-note-item__dot { width: .82rem; height: .82rem; justify-self: center; transition: background .24s ease, box-shadow .24s ease, transform .28s cubic-bezier(.2,.8,.2,1); }
.short-note-item:hover .short-note-item__dot { background: #5386a5; box-shadow: 0 0 0 5px rgba(93,145,176,.2); transform: scale(1.18); }
.short-note-item__content { padding-left: .15rem; font-size: .9rem; }
.short-note-item__content p { margin: .18rem 0; }
.short-note-tag { gap: .28rem; }
.short-note-tag--image { color: #4d7995; border-color: rgba(85,135,166,.2); background: rgba(216,234,244,.72); }
[data-theme="dark"] .short-note-tag--image { color: #acd6eb; border-color: rgba(127,190,223,.28); background: rgba(27,66,87,.72); }
.short-note-tag svg {
  width: .88rem;
  height: .88rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.development-log-pagination { grid-column: 1 / -1; margin-top: 1.4rem; }

.article-body,
.about-body,
.about-content-section,
.short-note-item__content { line-height: var(--body-leading); }
.article-body p,
.article-body li,
.article-body blockquote p,
.about-content-section p,
.short-note-item__content p { line-height: var(--body-leading); }
.article-reading-inner .article-body p { text-align: justify; text-justify: inter-ideograph; }

.article-hero--editorial { width: calc(100% - clamp(1rem, 5vw, 6rem)); max-width: none; }
.article-reading-layout { width: min(1380px, calc(100% - 2rem)); margin: -4.5rem auto 0; grid-template-columns: minmax(0, 1fr) minmax(290px, 330px); overflow: visible !important; }
.article-reading-layout .article-reading-cloth { margin: 0; border-radius: 1.9rem; box-shadow: 0 26px 70px rgba(43,61,71,.12), inset 0 1px 0 rgba(255,255,255,.94); }
.article-reading-inner { padding: clamp(1.4rem, 3vw, 2.6rem); }
.article-reading-inner .article-header { width: 100%; max-width: none; }
.article-reading-inner .article-header h1 { width: 100%; max-width: none; font-size: clamp(2rem, 3.2vw, 3.35rem); line-height: 1.18; text-wrap: pretty; }
.article-reading-inner .article-body { width: 100%; max-width: none; }
.article-inline-return {
  width: max-content;
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  margin-bottom: 1rem;
  padding: .62rem .85rem;
  color: var(--ink);
  background: rgba(247,246,242,.76);
}
.article-inline-return svg { width: 1rem; fill: none; stroke: currentColor; }
.article-detail { overflow: visible; }
.article-side-column { position: sticky !important; top: 6.5rem; align-self: start; height: max-content; margin-top: 5.2rem; }
.article-side-column--toc-only { margin-top: 5.2rem; }

@media (max-width: 1120px) {
  .home-editorial.home-tools { grid-template-columns: minmax(250px, .82fr) minmax(0, 1.35fr); grid-auto-rows: auto; }
  .home-editorial.home-tools > .home-media-column { grid-column: 1 / -1; height: auto !important; }
}

@media (min-width: 901px) and (max-width: 1120px) {
  .article-reading-layout { width: calc(100% - 1.5rem); display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 310px); align-items: start; }
  .article-reading-layout .article-reading-cloth { width: 100%; margin: 0; }
  .article-side-column { position: sticky !important; top: 6.5rem; display: grid; }
  .article-author-card { display: block; }
  .article-side-column .article-toc { position: relative; top: auto; width: 100%; height: auto; max-height: none; padding: 1.35rem; opacity: 1; transform: none; pointer-events: auto; }
  .article-toc-toggle { display: none; }
}

@media (max-width: 900px) {
  .notes-page { grid-template-columns: 1fr; }
  .notes-page .long-notes-board { margin-top: 0; }
  .article-reading-layout { width: 100%; margin-top: -2rem; display: block; }
  .article-reading-layout .article-reading-cloth { width: calc(100% - 1rem); margin: 0 auto; }
  .article-side-column,
  .article-side-column--toc-only { position: static !important; margin-top: 0; }
}

@media (max-width: 760px) {
  .home-editorial.home-tools { width: min(100% - 1rem, 560px); grid-template-columns: 1fr; margin: 1rem auto 3rem; }
  .home-editorial.home-tools > .home-sidebar,
  .home-editorial.home-tools > .home-notes-column,
  .home-editorial.home-tools > .home-media-column { height: auto !important; display: flex; }
  .home-sidebar .calendar-card { flex: none; }
  .short-note-timeline { --note-time-width: 2.9rem; --note-dot-width: .95rem; --note-gap: .28rem; --note-pad: .25rem; }
  .home-media-column .clock-card { min-height: 150px; }
  .article-hero--editorial { width: 100%; }
}

/* Mobile layout safety pass: keep every reading surface inside one shared frame. */
.article-detail {
  --article-frame-width: min(1380px, calc(100% - clamp(1rem, 5vw, 6rem)));
}
.article-detail .article-hero--editorial,
.article-detail .article-reading-layout {
  width: var(--article-frame-width);
  max-width: var(--article-frame-width);
}
.article-reading-layout > *,
.article-reading-cloth,
.article-reading-inner,
.article-header,
.article-body,
.article-side-column { min-width: 0; }
.article-header h1,
.article-body,
.article-body * { overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .article-detail { --article-frame-width: calc(100% - 1rem); }
  .article-detail .article-hero--editorial,
  .article-detail .article-reading-layout,
  .article-reading-layout .article-reading-cloth {
    width: var(--article-frame-width) !important;
    max-width: var(--article-frame-width) !important;
    margin-inline: auto !important;
  }
  .article-detail .article-reading-layout {
    margin-top: -1.5rem;
    overflow: visible !important;
  }
  .article-reading-inner { width: 100%; padding: 1.2rem; overflow: hidden; }
  .article-reading-inner .article-header h1 {
    max-width: 100%;
    font-size: clamp(1.65rem, 7.4vw, 2.2rem);
    line-height: 1.2;
    word-break: break-all;
    text-wrap: wrap;
  }
  .article-header__meta { max-width: 100%; flex-wrap: wrap; gap: .55rem .8rem; }
  .reading-size { max-width: 100%; flex-wrap: wrap; }
  .article-reading-inner .article-body img {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    transform: none;
  }
  .article-side-column,
  .article-side-column--toc-only {
    position: static !important;
    width: 0;
    height: 0;
    margin: 0;
  }
  .article-author-card { display: none; }
  .article-side-column .article-toc {
    position: fixed !important;
    z-index: 101;
    top: 0;
    right: 0;
    display: block;
    width: min(22rem, calc(100vw - 1rem));
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 5.25rem 1.15rem 1.5rem;
    overflow-y: auto;
    border-radius: 1.2rem 0 0 1.2rem;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(105%, 0, 0);
    transition: opacity .25s ease, visibility .25s ease, transform .38s cubic-bezier(.2,.8,.2,1);
    pointer-events: none;
  }
  .article-side-column .article-toc.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }
  .article-side-column .article-toc header button { display: grid; }
  .article-toc-toggle {
    position: fixed;
    z-index: 99;
    right: .75rem;
    bottom: 4.75rem;
    display: grid;
  }
}

@media (max-width: 760px) {
  .site-header,
  .site-header.is-scrolled {
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
  }
  .site-header .glass-nav,
  .site-header.is-scrolled .glass-nav {
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    overflow: hidden;
  }
  .site-header .glass-nav a,
  .site-header.is-scrolled .glass-nav a {
    width: 100%;
    min-width: 0 !important;
    padding-inline: .08rem;
    font-size: .72rem;
  }
  .site-header .header-search,
  .site-header.is-scrolled .header-search {
    position: absolute;
    z-index: 4;
    top: .3rem;
    right: .3rem;
    display: grid;
  }
  /* The globe remains first-class on phones; only its drawing detail is reduced in JS. */
  .footprints { width: calc(100% - 1rem); padding: .85rem; overflow: hidden; }
  .footprints__layout {
    width: 100%;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    gap: .85rem;
    min-height: 0;
    padding: .55rem;
  }
  .globe-shell {
    order: 1;
    display: block !important;
    width: 100%;
    min-width: 0;
    height: min(82vw, 360px);
    min-height: 290px;
    visibility: visible !important;
  }
  .globe-shell canvas,
  .globe-point-layer { display: block !important; visibility: visible !important; }
  .footprint-list { order: 2; width: 100%; min-width: 0; }
  .footprint-list__body { width: 100%; max-height: 290px; overflow: auto; }

  /* Notes use a single, bounded column on narrow screens. */
  .notes-page {
    width: calc(100% - 1rem);
    max-width: calc(100% - 1rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    padding: .65rem;
    overflow: hidden;
  }
  .short-notes-board,
  .long-notes-board { width: 100%; min-width: 0; padding: 1rem; overflow: hidden; }
  .short-note-periods { width: 100%; max-width: 100%; }
  .long-notes-board > .glass-filter {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0 1.25rem;
    overflow-x: auto;
  }
  .long-notes-board > .glass-filter a { flex: 0 0 auto; }
  .short-note-timeline {
    --note-time-width: 2.75rem;
    --note-dot-width: .9rem;
    --note-gap: .22rem;
    --note-pad: 0rem;
    width: 100%;
  }
  .short-note-item {
    width: 100%;
    min-width: 0;
    grid-template-columns: var(--note-time-width) var(--note-dot-width) minmax(0, 1fr);
    padding-block: .85rem;
    overflow: hidden;
  }
  .short-note-item time strong { font-size: .88rem; }
  .short-note-item__content { min-width: 0; padding-left: .05rem; font-size: .86rem; }
  .short-note-item__content p,
  .short-note-item__content a { max-width: 100%; overflow-wrap: anywhere; }
  .short-note-tags { max-width: 100%; }
  .notes-list,
  .note-row,
  .note-row__content { min-width: 0; max-width: 100%; }

  /* About content follows the markdown order in one clean mobile column. */
  .about-page { width: calc(100% - 1rem); max-width: calc(100% - 1rem); padding: 1rem; overflow: hidden; }
  .about-me-layout { width: 100%; display: flex; flex-direction: column; gap: 1rem; }
  .about-body { display: contents; }
  .about-avatar-card { order: 1; width: 100%; min-height: 0; padding: .35rem; }
  .about-content-section { order: 2; width: 100%; min-width: 0; grid-column: auto; padding: 1rem; }
  .about-content-section--blog { order: 3; }
  .about-me-layout > .about-portrait { order: 4; position: static; width: min(100%, 330px); margin: 0 auto; }
  .about-content-section--wide { order: 5; width: 100%; grid-column: auto; }
  .about-content-section p,
  .about-content-section li,
  .about-content-section a { max-width: 100%; overflow-wrap: anywhere; }
  .about-contact ul { width: 100%; display: flex; flex-wrap: wrap; overflow: visible; }
  .about-contact li { min-width: 0; }
}

/* Theme control and a complete blue-black reading palette. */
.header-search,
.theme-toggle {
  position: relative;
  width: 2.8rem;
  height: 2.8rem;
  flex: 0 0 2.8rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #f5f9fb;
  cursor: pointer;
  pointer-events: auto;
  transition: color .35s ease, background .35s ease, border-color .35s ease, transform .32s cubic-bezier(.2,.8,.2,1), box-shadow .35s ease;
}
.header-search:hover,
.theme-toggle:hover { color: var(--ink); background: rgba(255,255,255,.82); transform: translateY(-1px); }
.header-search:active,
.theme-toggle:active { transform: translateY(0) scale(.9); }
.theme-toggle { margin-left: .45rem; }
.theme-toggle svg { position: absolute; width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; transition: opacity .38s ease, transform .5s cubic-bezier(.2,.8,.2,1); }
.theme-toggle__sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle__moon { opacity: 0; transform: rotate(-50deg) scale(.45); }
[data-theme="dark"] .theme-toggle__sun { opacity: 0; transform: rotate(70deg) scale(.45); }
[data-theme="dark"] .theme-toggle__moon { opacity: 1; transform: rotate(0) scale(1); }
.site-header.is-scrolled .header-search,
.site-header.is-scrolled .theme-toggle {
  color: var(--ink);
  border-color: rgba(255,255,255,.76);
  background: linear-gradient(135deg, rgba(247,251,252,.82), rgba(210,228,239,.68));
  box-shadow: inset 0 1px 0 white, 0 10px 26px rgba(21,42,55,.14);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
}
.theme-is-switching *, .theme-is-switching *::before, .theme-is-switching *::after { transition-duration: .45s !important; }

.about-body > p { margin-block: .25rem; line-height: 1.45; }
.clock-card { transition: transform .42s cubic-bezier(.2,.8,.2,1), box-shadow .42s ease; }
.clock-card__film { transition: none; }
.clock-card:hover { transform: translateY(-4px); box-shadow: 0 26px 55px rgba(28,48,61,.16); }

.article-toc-backdrop { display: none; }

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #071521;
  --paper-bright: #0b1c2a;
  --ink: #e9f2f7;
  --muted: #9cb0bd;
  --blue: #7bc8f1;
  --blue-deep: #69bce9;
  --line: rgba(126,183,216,.2);
  --shadow-cloth: 0 24px 70px rgba(0,6,13,.38), inset 0 1px 0 rgba(177,222,246,.13);
}
[data-theme="dark"] body { color: var(--ink); background: radial-gradient(circle at 50% 0, #102b3f 0, #071723 32rem, #050f18 100%); }
[data-theme="dark"] body::before { opacity: .24; filter: invert(1); }
[data-theme="dark"] .content-cloth,
[data-theme="dark"] .page-content,
[data-theme="dark"] .short-notes-board,
[data-theme="dark"] .long-notes-board,
[data-theme="dark"] .article-reading-cloth,
[data-theme="dark"] .about-content-section,
[data-theme="dark"] .article-author-card,
[data-theme="dark"] .friend-card,
[data-theme="dark"] .album-card {
  color: var(--ink);
  border-color: rgba(117,185,222,.28);
  background: linear-gradient(145deg, rgba(13,34,50,.94), rgba(6,22,34,.96));
  box-shadow: var(--shadow-cloth);
}
[data-theme="dark"] .site-footer { color: #91a8b7; background: #040d15; border-color: rgba(113,174,208,.16); }
[data-theme="dark"] .glass-panel,
[data-theme="dark"] .glass-control,
[data-theme="dark"] .glass-nav,
[data-theme="dark"] .glass-filter { border-color: rgba(133,203,239,.35); background: linear-gradient(135deg, rgba(22,57,80,.68), rgba(7,25,39,.58)); box-shadow: inset 0 1px 0 rgba(193,231,250,.2), 0 14px 36px rgba(0,5,12,.34); }
[data-theme="dark"] .site-header.is-scrolled .glass-nav,
[data-theme="dark"] .site-header.is-scrolled .header-search,
[data-theme="dark"] .site-header.is-scrolled .theme-toggle { border-color: rgba(129,200,238,.38); background: rgba(8,29,45,.78); box-shadow: inset 0 1px 0 rgba(186,227,249,.18), 0 12px 30px rgba(0,5,12,.36); }
[data-theme="dark"] .site-header.is-scrolled .brand,
[data-theme="dark"] .site-header.is-scrolled .glass-nav a,
[data-theme="dark"] .site-header.is-scrolled .header-search { color: var(--ink); }
[data-theme="dark"] .glass-nav::before,
[data-theme="dark"] .glass-filter::before { border-color: rgba(124,207,250,.6); background: linear-gradient(145deg, rgba(90,174,220,.38), rgba(26,87,122,.42)); box-shadow: inset 0 1px 0 rgba(219,242,253,.35), 0 0 24px rgba(63,175,232,.32); }
[data-theme="dark"] .glass-nav a:hover,
[data-theme="dark"] .glass-nav a.is-active { color: #f5fbff; background: rgba(91,176,222,.18); }
[data-theme="dark"] .glass-nav a.is-active::before { background: #8bd6ff; box-shadow: 0 0 10px #60c6ff; }
[data-theme="dark"] .section-kicker,
[data-theme="dark"] a:hover,
[data-theme="dark"] .article-row__meta a,
[data-theme="dark"] .photo-index-heading p:first-child { color: var(--blue); }
[data-theme="dark"] p,
[data-theme="dark"] time,
[data-theme="dark"] .article-row__body > p,
[data-theme="dark"] .album-card__body p { color: var(--muted); }
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] strong,
[data-theme="dark"] .article-body { color: var(--ink); }
[data-theme="dark"] .article-row,
[data-theme="dark"] .short-note-preview,
[data-theme="dark"] .short-note-item,
[data-theme="dark"] .note-row { border-color: rgba(122,181,214,.18); }
[data-theme="dark"] .default-cover { background: linear-gradient(135deg, #173b53, #0a2133); }
[data-theme="dark"] .search-overlay__backdrop { background: rgba(2,9,15,.72); }
[data-theme="dark"] .search-dialog,
[data-theme="dark"] .calendar-popover { color: var(--ink); border-color: rgba(126,195,232,.3); background: rgba(7,24,37,.96); }
[data-theme="dark"] .search-field,
[data-theme="dark"] .search-result,
[data-theme="dark"] .calendar-picker__menu,
[data-theme="dark"] .reading-size { color: var(--ink); border-color: rgba(128,190,223,.22); background: rgba(11,35,52,.82); }
[data-theme="dark"] .search-field input { color: var(--ink); }
[data-theme="dark"] .calendar-day.has-content { color: #dff5ff; background: rgba(71,151,195,.24); }
[data-theme="dark"] .short-note-tag { border-color: rgba(123,191,226,.28); background: rgba(36,103,139,.18); }
[data-theme="dark"] .article-body blockquote { color: #b8d1df; border-color: #61b9e7; background: rgba(58,137,179,.12); }
[data-theme="dark"] .article-body code { color: #b9e7ff; background: rgba(71,150,193,.18); }
[data-theme="dark"] .article-adjacent a { border-color: rgba(124,189,224,.24); background: rgba(10,34,51,.72); }

@media (max-width: 760px) {
  .site-header,
  .site-header.is-scrolled { grid-template-columns: 2.45rem minmax(0, 1fr) 2.45rem !important; }
  .site-header .brand,
  .site-header.is-scrolled .brand { grid-column: 2; grid-row: 1; justify-self: center; max-width: calc(100vw - 8rem); }
  .site-header .header-search,
  .site-header.is-scrolled .header-search { position: static; grid-column: 1; grid-row: 1; width: 2.45rem; height: 2.45rem; }
  .site-header .theme-toggle,
  .site-header.is-scrolled .theme-toggle { position: static; grid-column: 3; grid-row: 1; width: 2.45rem; height: 2.45rem; margin: 0; }
  .site-header .glass-nav,
  .site-header.is-scrolled .glass-nav { grid-column: 1 / -1; grid-row: 2; }
  body:has(.gallery) .theme-toggle { display: none; }
}

@media (max-width: 900px) {
  .article-toc-backdrop {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: block;
    border: 0;
    opacity: 0;
    visibility: hidden;
    background: rgba(8,19,27,.35);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    transition: opacity .28s ease, visibility .28s ease;
  }
  .article-toc-backdrop.is-open { opacity: 1; visibility: visible; }
  .article-side-column .article-toc {
    top: auto !important;
    right: 1rem !important;
    bottom: 1rem;
    width: min(19rem, calc(100vw - 2rem)) !important;
    height: auto !important;
    max-height: min(70dvh, 34rem) !important;
    padding: 1rem !important;
    border-radius: 1.25rem !important;
    transform: translate3d(0, 1rem, 0) scale(.96) !important;
    transform-origin: right bottom;
  }
  .article-side-column .article-toc.is-open { transform: translate3d(0, 0, 0) scale(1) !important; }
  .article-side-column .article-toc header { position: sticky; top: 0; z-index: 2; padding-bottom: .7rem; background: inherit; }
  .article-side-column .article-toc header button { width: 2.35rem; height: 2.35rem; border-radius: 50%; }
  .article-side-column .article-toc nav { max-height: calc(70dvh - 5rem); overflow-y: auto; }
}
