/*
 * Theme: Super+ (Notion-faithful open layout with modern design-engineering polish)
 * Modern Web Guidance: color-scheme follows <meta name="color-scheme"> and light-dark().
 */

@view-transition {
  navigation: auto;
}

:root {
  color-scheme: light dark;

  /* Core Surfaces */
  --bg: light-dark(#FFFFFF, #191919);
  --bg-elevated: light-dark(#F7F6F3, #232322);
  --bg-subtle: light-dark(#F1F0EC, #2A2A28);
  --bg-hover: light-dark(rgba(55, 53, 47, 0.055), rgba(255, 255, 255, 0.065));
  --bg-active: light-dark(rgba(55, 53, 47, 0.095), rgba(255, 255, 255, 0.105));
  --bg-code: light-dark(#F7F6F3, #20201F);
  --bg-inline-code: light-dark(rgba(135, 131, 120, 0.15), rgba(135, 131, 120, 0.24));

  /* Typography Ink */
  --text: light-dark(#37352F, #EFEEEC);
  --text-strong: light-dark(#191918, #FFFFFF);
  --text-muted: light-dark(#6C6A65, #A3A09A);
  --text-faint: light-dark(#9B9891, #6E6C67);

  /* Accents & Interactive */
  --accent: light-dark(#2383E2, #529CCA);
  --accent-soft: light-dark(rgba(35, 131, 226, 0.1), rgba(82, 156, 202, 0.16));
  --inline-code-color: light-dark(#EB5757, #FF7B72);

  /* Hairlines & Subtle Elevation */
  --border: light-dark(rgba(28, 19, 1, 0.09), rgba(255, 255, 235, 0.09));
  --border-strong: light-dark(rgba(28, 19, 1, 0.18), rgba(255, 255, 235, 0.18));
  --card-highlight: light-dark(rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.035));
  --shadow-card: light-dark(
    0 1px 2px rgba(28, 19, 1, 0.04),
    0 1px 3px rgba(0, 0, 0, 0.25)
  );
  --shadow-dialog: light-dark(
    0 24px 64px rgba(15, 15, 15, 0.18),
    0 28px 72px rgba(0, 0, 0, 0.58)
  );

  /* Primary CTA Pill */
  --cta-bg: light-dark(#191918, #EFEEEC);
  --cta-text: light-dark(#FFFFFF, #191919);
  --cta-bg-hover: light-dark(#333330, #FFFFFF);

  /* Notion Semantic Palette */
  --nc-gray: light-dark(#787774, #9B9B9B);
  --nc-brown: light-dark(#9F6B53, #BA856F);
  --nc-orange: light-dark(#D9730D, #FFA344);
  --nc-yellow: light-dark(#CB912F, #E8B931);
  --nc-green: light-dark(#448361, #50946E);
  --nc-blue: light-dark(#2F7BC4, #4C93E0);
  --nc-purple: light-dark(#9065B0, #A277E0);
  --nc-pink: light-dark(#C14C8A, #E255A1);
  --nc-red: light-dark(#CF5148, #EB645B);

  --nc-gray-bg: light-dark(#F1F1EF, #262625);
  --nc-brown-bg: light-dark(#F4EEEE, #2F2723);
  --nc-orange-bg: light-dark(#FBECDD, #392B1E);
  --nc-yellow-bg: light-dark(#FBF3DB, #38331E);
  --nc-green-bg: light-dark(#EDF3EC, #213029);
  --nc-blue-bg: light-dark(#E7F3F8, #1D2D37);
  --nc-purple-bg: light-dark(#F4F0F7, #2B2435);
  --nc-pink-bg: light-dark(#F9EEF3, #35232D);
  --nc-red-bg: light-dark(#FDEBEC, #382424);

  /* Typography & Motion */
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --header-h: 56px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
}

::selection {
  background: var(--accent-soft);
  color: var(--text-strong);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--bg-elevated);
  color: var(--text-strong);
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: 12px;
}

/* Sticky Top Bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1520px;
  height: 100%;
  margin: 0 auto;
  padding: 0 clamp(16px, 4.5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong);
  text-decoration: none;
  font-weight: 660;
  font-size: 0.94rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  padding: 6px 9px;
  margin-left: -9px;
  border-radius: 8px;
  transition: background 150ms var(--ease-out);
}

.brand:hover {
  background: var(--bg-hover);
}

.brand-bolt {
  font-size: 1rem;
  line-height: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  height: 33px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.835rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--cta-text);
  background: var(--cta-bg);
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms var(--ease-out), transform 140ms var(--ease-out);
}

.header-cta:hover {
  background: var(--cta-bg-hover);
}

.header-cta:active {
  transform: scale(0.97);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 33px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.835rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--card-highlight);
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 140ms var(--ease-out);
}

.icon-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  color: var(--text-strong);
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn:focus:not(:focus-visible),
.header-cta:focus:not(:focus-visible) {
  outline: none;
}

.icon-btn:focus-visible,
.header-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle {
  width: 33px;
  padding: 0;
}

.kbd-hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-faint);
}

/* Theme toggle icon branching purely in CSS (works without JS) */
.theme-toggle .theme-opt-light { display: none; }
.theme-toggle .theme-opt-dark { display: inline-flex; }

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle .theme-opt-dark {
    display: none;
  }
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-toggle .theme-opt-light {
    display: inline-flex;
  }
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .theme-opt-dark {
  display: none;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-toggle .theme-opt-light {
  display: inline-flex;
}

/* Cover Image with Smooth Bottom Scrim */
.page-cover {
  position: relative;
  width: 100%;
  height: clamp(180px, 26vh, 265px);
  overflow: hidden;
  background: var(--bg-subtle);
}

.page-cover-home {
  height: clamp(200px, 30vh, 280px);
}

.page-cover::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 64px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

.page-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Page Shell & Optional Sticky Desktop TOC Rail */
.page-shell {
  width: 100%;
  margin: 0 auto;
  padding: 28px clamp(16px, 4.5vw, 64px) 88px;
  flex: 1 0 auto;
}

.page-narrow {
  max-width: 860px;
}

.page-wide {
  max-width: 1520px;
}

.page-narrow.has-toc-rail {
  max-width: 1200px;
  display: grid;
  grid-template-columns: minmax(0, 820px) 240px;
  justify-content: space-between;
  gap: 56px;
  align-items: start;
}

.page-wide.has-toc-rail {
  max-width: 1520px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 48px;
  align-items: start;
}

.page-main-col {
  min-width: 0;
}

.page-shell.has-cover.has-icon:not(:has(.breadcrumbs)) {
  padding-top: 0;
}

/* Sticky Right TOC Rail (Desktop >= 1120px) */
.article-toc-rail {
  position: sticky;
  top: calc(var(--header-h) + 28px);
  max-height: calc(100dvh - var(--header-h) - 56px);
  overflow-y: auto;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.rail-toc-label {
  font-size: 0.72rem;
  font-weight: 660;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.rail-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rail-toc-item a {
  display: block;
  font-size: 0.815rem;
  line-height: 1.42;
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 0 2px 10px;
  margin-left: -17px;
  border-left: 2px solid transparent;
  transition: color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}

.rail-toc-item a:hover {
  color: var(--text-strong);
}

.rail-toc-item a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 560;
}

.rail-depth-1 a { padding-left: 20px; }
.rail-depth-2 a { padding-left: 30px; }

/* Hide duplicate inline Notion TOC on wide viewports when the sticky rail is visible */
@media (min-width: 1120px) {
  .has-toc-rail .notion-toc {
    display: none;
  }
}

@media (max-width: 1119px) {
  .page-narrow.has-toc-rail,
  .page-wide.has-toc-rail {
    display: block;
    max-width: 860px;
  }
  .page-wide.has-toc-rail {
    max-width: 1520px;
  }
  .article-toc-rail {
    display: none;
  }
}

/* Breadcrumbs */
.breadcrumbs {
  margin-bottom: 16px;
  padding-top: 2px;
}

.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.83rem;
  color: var(--text-muted);
}

.breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.breadcrumbs li + li::before {
  content: "›";
  color: var(--text-faint);
  font-size: 0.95rem;
}

.breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 5px;
  padding: 2px 6px;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}

.breadcrumbs a:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
}

.breadcrumbs li[aria-current="page"] span {
  padding: 2px 6px;
  color: var(--text-strong);
  font-weight: 520;
}

/* Page Header & Metadata */
.page-header {
  margin-bottom: 28px;
}

.page-home .page-header {
  margin-bottom: 22px;
}

.page-icon {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.page-shell.has-cover:not(:has(.breadcrumbs)) .page-icon {
  width: 74px;
  height: 74px;
  margin-top: -38px;
  margin-bottom: 10px;
  position: relative;
  z-index: 2;
}

.page-icon-emoji {
  font-size: 3.1rem;
  line-height: 1;
}

.page-shell.has-cover:not(:has(.breadcrumbs)) .page-icon-emoji {
  font-size: 3.7rem;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25));
}

.page-icon img,
.page-icon-svg svg {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  object-fit: cover;
}

.page-link-icon-svg svg {
  width: 18px;
  height: 18px;
  display: block;
}

.page-shell.has-cover:not(:has(.breadcrumbs)) .page-icon img {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.page-title {
  margin: 0;
  font-size: clamp(1.95rem, 3.4vw, 2.65rem);
  line-height: 1.15;
  font-weight: 760;
  letter-spacing: -0.032em;
  color: var(--text-strong);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.83rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.meta-dot {
  color: var(--text-faint);
}

/* Database Row Properties Card */
.page-properties {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--card-highlight);
  display: grid;
  gap: 8px;
  font-size: 0.88rem;
}

.page-prop-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 1fr;
  align-items: baseline;
  gap: 12px;
}

.page-prop-row dt {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 540;
}

.page-prop-row dd {
  margin: 0;
}

/* Editorial Body Typography */
.page-body {
  font-size: 1rem;
  line-height: 1.62;
}

.page-body a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 140ms var(--ease-out), color 140ms var(--ease-out);
}

.page-body a:hover {
  text-decoration-color: var(--accent);
  color: var(--text-strong);
}

.notion-p {
  margin: 0 0 0.5em;
  text-wrap: pretty;
}

.notion-p:has(> .external-mention:only-child),
.notion-p:has(> a:only-child) {
  margin-bottom: 2px;
}

.notion-blank {
  height: 0.4em;
}

.notion-indent {
  padding-left: 1.4rem;
}

.notion-h {
  position: relative;
  margin: 1.35em 0 0.4em;
  font-weight: 690;
  line-height: 1.26;
  letter-spacing: -0.022em;
  color: var(--text-strong);
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.notion-h1 { font-size: 1.58rem; }
.notion-h2 { font-size: 1.3rem; }
.notion-h3 { font-size: 1.1rem; }
.notion-h4 { font-size: 0.98rem; color: var(--text-muted); }

.heading-anchor {
  margin-left: 0.35rem;
  opacity: 0;
  font-size: 0.8em;
  color: var(--text-faint);
  text-decoration: none !important;
  font-weight: 400;
  transition: opacity 140ms var(--ease-out), color 140ms var(--ease-out);
}

.notion-h:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 0.65;
}

.heading-anchor:hover {
  opacity: 1 !important;
  color: var(--accent);
}

.notion-list {
  margin: 0.25em 0 0.75em;
  padding-left: 1.5rem;
}

.notion-list li {
  margin: 0.16em 0;
  text-wrap: pretty;
}

.notion-list li::marker {
  color: var(--text-faint);
}

.notion-list .notion-list {
  margin: 0.14em 0;
}

.notion-todo-list {
  list-style: none;
  margin: 0.25em 0 0.75em;
  padding: 0;
}

.todo-item {
  margin: 0.16em 0;
}

.todo-item label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.todo-item input[type="checkbox"] {
  margin-top: 5px;
  accent-color: var(--accent);
}

.todo-done > label > span {
  text-decoration: line-through;
  color: var(--text-muted);
}

.notion-quote {
  margin: 1.05rem 0;
  padding: 0.22rem 0 0.22rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--text);
}

.notion-quote > :first-child,
.notion-toggle-body > :first-child,
.callout-body > :first-child {
  margin-top: 0;
}

.notion-quote > :last-child,
.notion-toggle-body > :last-child,
.callout-body > :last-child {
  margin-bottom: 0;
}

/* Callouts & Hero Bio Card */
.notion-callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  margin: 1.1rem 0 1.45rem;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--card-highlight), var(--shadow-card);
}

.page-home .notion-callout {
  padding: 26px 28px 24px;
  margin: 0 0 28px;
  background: var(--bg-elevated);
}

.page-home .notion-callout > .callout-body > .notion-p {
  font-size: 1.03rem;
  line-height: 1.66;
  margin-bottom: 0.65em;
}

.page-home .notion-callout .notion-columns {
  margin: 22px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  gap: 28px;
}

.page-home .notion-callout .notion-h {
  margin: 0 0 0.45rem;
  font-size: 0.96rem;
  font-weight: 660;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

.page-home .notion-callout .notion-divider {
  display: none;
}

.page-home .notion-callout .notion-column .notion-p {
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 0.22rem;
  color: var(--text-muted);
}

.page-home .notion-callout .notion-column .notion-p:last-child {
  margin-bottom: 0;
}

.callout-icon {
  font-size: 1.3rem;
  line-height: 1.35;
  flex-shrink: 0;
}

.callout-icon-img {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  flex-shrink: 0;
}

.callout-body {
  min-width: 0;
  flex: 1;
}

/* External Brand Mentions */
.external-mention {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 8px;
  margin: 0 -8px;
  border-radius: 7px;
  text-decoration: none !important;
  color: var(--text);
  font-size: 0.91rem;
  line-height: 1.38;
  transition: background 140ms var(--ease-out);
  max-width: calc(100% + 16px);
}

.external-mention:hover {
  background: var(--bg-hover);
}

.ext-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.ext-provider {
  color: var(--text-muted);
  font-weight: 450;
}

.ext-title {
  color: var(--text-strong);
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toggles / Expandable Dropdowns */
.notion-toggle {
  margin: 0.75rem 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: inset 0 1px 0 var(--card-highlight);
  overflow: hidden;
  transition: border-color 150ms var(--ease-out);
}

.notion-toggle:hover {
  border-color: var(--border-strong);
}

.notion-toggle > summary {
  cursor: pointer;
  padding: 10px 14px;
  margin: 0;
  font-weight: 580;
  color: var(--text-strong);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
  transition: background 140ms var(--ease-out);
}

.notion-toggle > summary::-webkit-details-marker {
  display: none;
}

.notion-toggle > summary::after {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%238c8a84' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 180ms var(--ease-out), border-color 140ms var(--ease-out), background-color 140ms var(--ease-out);
}

.notion-toggle[open] > summary {
  border-bottom: 1px solid var(--border);
}

.notion-toggle[open] > summary::after {
  transform: rotate(180deg);
  border-color: var(--border-strong);
}

.notion-toggle > summary:hover {
  background: var(--bg-hover);
}

.notion-toggle > summary .notion-h {
  margin: 0;
}

.notion-toggle-body {
  padding: 12px 16px 14px;
}

.notion-toggle .notion-toggle {
  background: var(--bg);
}

.notion-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.6rem 0;
}

/* Inline Table of Contents (shown on narrow screens / pages without rail) */
.notion-toc {
  margin: 1rem 0 1.6rem;
  padding: 15px 18px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--card-highlight);
  font-size: 0.88rem;
}

.toc-label {
  font-size: 0.72rem;
  font-weight: 660;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.notion-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-item {
  margin: 3px 0;
}

.toc-depth-1 { padding-left: 1rem; }
.toc-depth-2 { padding-left: 2rem; }
.toc-depth-3 { padding-left: 3rem; }

.notion-toc a {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-block;
  padding: 1px 0;
}

.notion-toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Code Blocks */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.845em;
  padding: 0.16em 0.42em;
  border-radius: 5px;
  background: var(--bg-inline-code);
  color: var(--inline-code-color);
  overflow-wrap: break-word;
}

.notion-code-block {
  margin: 1.3rem 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-code);
  overflow: hidden;
  box-shadow: inset 0 1px 0 var(--card-highlight), var(--shadow-card);
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-subtle) 55%, transparent);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-lang {
  font-family: var(--font-mono);
  text-transform: lowercase;
  font-weight: 520;
}

.code-copy-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 2px 9px;
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out), border-color 140ms var(--ease-out), transform 120ms var(--ease-out);
}

.code-copy-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-strong);
}

.code-copy-btn:active {
  transform: scale(0.95);
}

.code-body pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.855rem;
  line-height: 1.62;
  tab-size: 4;
  background: transparent !important;
}

.shiki span {
  color: light-dark(var(--shiki-light), var(--shiki-dark));
}

.notion-equation {
  margin: 1.25rem 0;
  overflow-x: auto;
  text-align: center;
}

/* Home 4-Column Open Notion Directory & Multi-Column Grid */
.notion-columns {
  display: grid;
  grid-template-columns: var(--cols-template, repeat(auto-fit, minmax(220px, 1fr)));
  gap: 24px;
  margin: 1rem 0;
  align-items: start;
}

.page-home .page-body > .notion-columns {
  gap: 28px 34px;
  margin-top: 8px;
  align-items: start;
}

.page-home .page-body > .notion-columns .notion-h {
  margin: 0 0 0.55rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.page-home .page-body > .notion-columns .notion-divider {
  margin: 0 0 0.7rem;
  border-top: 1px solid var(--border);
}

.notion-column {
  min-width: 0;
}

.notion-column > :first-child {
  margin-top: 0;
}

@media (max-width: 1020px) {
  .notion-cols-4,
  .notion-cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .notion-columns,
  .notion-cols-4,
  .notion-cols-3,
  .notion-cols-2 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Images & Captions */
.notion-image {
  margin: 1.45rem 0;
}

.notion-image img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.notion-caption {
  margin-top: 7px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* Click-to-Load Video Facade */
.notion-video {
  margin: 1.45rem 0;
}

.video-facade {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.video-play-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 30px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text-strong);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out);
}

.video-play-btn:hover {
  transform: scale(1.03);
  border-color: var(--accent);
}

.video-play-icon { font-size: 1.5rem; color: var(--accent); }
.video-play-text { font-weight: 620; font-size: 0.94rem; }
.video-play-host { font-size: 0.8rem; color: var(--text-muted); }

.video-facade iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Page Links — Compact Notion-style Pill Rows */
.notion-page-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 8px;
  margin: 1px -8px;
  border-radius: 7px;
  text-decoration: none !important;
  color: var(--text);
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}

.notion-page-link:hover {
  background: var(--bg-hover);
  color: var(--text-strong);
}

.notion-page-link:active {
  background: var(--bg-active);
}

.page-link-title {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.notion-page-link:hover .page-link-title {
  color: var(--text-strong);
}

.page-link-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 22px;
  font-size: 1.02rem;
  line-height: 1;
}

.row-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
}

.page-link-icon-doc,
.row-icon-doc {
  color: var(--text-faint);
}

.page-link-icon-img {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.page-mention {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px;
  border-radius: 6px;
  font-weight: 530;
  background: var(--bg-subtle);
  text-decoration: none !important;
  transition: background 140ms var(--ease-out);
}

.page-mention:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Link Cards */
.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin: 0.9rem 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: inset 0 1px 0 var(--card-highlight);
  text-decoration: none !important;
  color: var(--text);
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out);
}

.link-card:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.link-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.link-card-title {
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--text-strong);
  overflow-wrap: anywhere;
}

.link-card-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-card-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 2px;
}

.link-card-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 520;
}

.link-card-arrow {
  color: var(--text-faint);
  flex-shrink: 0;
  transition: transform 150ms var(--ease-out), color 150ms var(--ease-out);
}

.link-card:hover .link-card-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* Responsive Tables & Embedded Databases */
.table-wrapper {
  overflow-x: auto;
  max-inline-size: 100%;
  margin: 1.15rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: inset 0 1px 0 var(--card-highlight), var(--shadow-card);
}

.notion-table,
.db-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.91rem;
}

.notion-table th,
.notion-table td,
.db-table th,
.db-table td {
  padding: 8px 13px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: middle;
}

.notion-table tr:last-child > *,
.db-table tr:last-child > * { border-bottom: 0; }

.notion-table tr > :last-child,
.db-table tr > :last-child { border-right: 0; }

.notion-table thead th,
.db-table thead th {
  position: sticky;
  inset-block-start: 0;
  background: var(--bg-subtle);
  font-weight: 620;
  color: var(--text-muted);
  font-size: 0.79rem;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.db-table tbody tr {
  transition: background 120ms var(--ease-out);
}

.db-table tbody tr:hover {
  background: var(--bg-hover);
}

.notion-database {
  margin: 1.9rem 0;
}

.db-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.db-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 690;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.db-count,
.db-group-count {
  font-size: 0.76rem;
  font-weight: 560;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.db-description {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.db-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 var(--card-highlight), var(--shadow-card);
  overflow: hidden;
}

.db-list-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 0;
  border-bottom: 1px solid var(--border);
  transition: background 120ms var(--ease-out);
}

.db-list-item:last-child { border-bottom: 0; }
.db-list-item:hover { background: var(--bg-hover); }

.db-list-item > .db-row-link {
  flex: 1 1 auto;
  padding: 8px 13px;
}

.db-row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  font-weight: 530;
  text-decoration: none !important;
  color: var(--text-strong);
}

.db-row-main {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.db-row-link:hover .db-row-title {
  color: var(--accent);
}

.db-open-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  flex-shrink: 0;
  opacity: 0.7;
  transition: color 140ms var(--ease-out), opacity 140ms var(--ease-out), transform 150ms var(--ease-out);
}

.db-list-item:hover .db-open-icon,
.db-table tbody tr:hover .db-open-icon {
  color: var(--accent);
  opacity: 1;
  transform: translateX(3px);
}

.db-list-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 15px 8px 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.db-group { margin: 1rem 0; }

.db-group-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  cursor: pointer;
  font-weight: 600;
}

.db-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.db-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 540;
  line-height: 1.5;
  background: var(--nc-gray-bg);
  color: var(--text);
  white-space: nowrap;
}

.db-pill-gray { background: var(--nc-gray-bg); }
.db-pill-brown { background: var(--nc-brown-bg); }
.db-pill-orange { background: var(--nc-orange-bg); }
.db-pill-yellow { background: var(--nc-yellow-bg); }
.db-pill-green { background: var(--nc-green-bg); }
.db-pill-blue { background: var(--nc-blue-bg); }
.db-pill-purple { background: var(--nc-purple-bg); }
.db-pill-pink { background: var(--nc-pink-bg); }
.db-pill-red { background: var(--nc-red-bg); }

/* Previous / Next Note Pager */
.article-pager {
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pager-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: inset 0 1px 0 var(--card-highlight);
  text-decoration: none;
  color: var(--text);
  transition: border-color 150ms var(--ease-out), background 150ms var(--ease-out), transform 140ms var(--ease-out);
}

.pager-card:hover {
  border-color: var(--accent);
  background: var(--bg-subtle);
}

.pager-card:active {
  transform: scale(0.985);
}

.pager-next {
  text-align: right;
}

.pager-dir {
  font-size: 0.76rem;
  font-weight: 580;
  color: var(--text-muted);
}

.pager-title {
  font-size: 0.93rem;
  font-weight: 620;
  color: var(--text-strong);
  text-wrap: balance;
}

@media (max-width: 560px) {
  .article-pager {
    grid-template-columns: 1fr;
  }
  .pager-next {
    text-align: left;
  }
}

/* Notion Semantic Colors */
.nc-gray { color: var(--nc-gray); }
.nc-brown { color: var(--nc-brown); }
.nc-orange { color: var(--nc-orange); }
.nc-yellow { color: var(--nc-yellow); }
.nc-green { color: var(--nc-green); }
.nc-blue { color: var(--nc-blue); }
.nc-purple { color: var(--nc-purple); }
.nc-pink { color: var(--nc-pink); }
.nc-red { color: var(--nc-red); }

.nc-gray_background { background: var(--nc-gray-bg); }
.nc-brown_background { background: var(--nc-brown-bg); }
.nc-orange_background { background: var(--nc-orange-bg); }
.nc-yellow_background { background: var(--nc-yellow-bg); }
.nc-green_background { background: var(--nc-green-bg); }
.nc-blue_background { background: var(--nc-blue-bg); }
.nc-purple_background { background: var(--nc-purple-bg); }
.nc-pink_background { background: var(--nc-pink-bg); }
.nc-red_background { background: var(--nc-red-bg); }

span[class*="nc-"][class*="_background"] {
  padding: 0.08em 0.3em;
  border-radius: 4px;
}

/* Search Modal Dialog (Modern Web Guidance: native <dialog>, overscroll containment) */
.search-dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: min(76vh, 600px);
  padding: 0;
  margin: min(10vh, 76px) auto auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--card-highlight), var(--shadow-dialog);
  overflow: hidden;
}

.search-dialog[open] {
  display: flex;
  flex-direction: column;
}

.search-dialog:modal {
  overscroll-behavior: contain;
}

.search-dialog::backdrop {
  background: light-dark(rgba(58, 55, 50, 0.36), rgba(2, 12, 24, 0.68));
  backdrop-filter: blur(5px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.search-dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.search-input-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  font-size: 1rem;
}

.search-input::placeholder {
  color: var(--text-faint);
}

.search-close-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  cursor: pointer;
}

.search-results {
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
}

.search-hint {
  margin: 24px 8px;
  color: var(--text-muted);
  font-size: 0.89rem;
  text-align: center;
}

.search-result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.search-result-item a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background 120ms var(--ease-out);
}

.search-result-item a:hover,
.search-result-item a:focus-visible,
.search-result-item a.is-selected {
  background: var(--bg-hover);
  outline: none;
}

.search-result-item a.is-selected {
  box-shadow: inset 2px 0 0 var(--accent);
}

.search-result-title {
  font-weight: 620;
  font-size: 0.94rem;
  color: var(--text-strong);
}

.search-result-url {
  font-size: 0.76rem;
  font-family: var(--font-mono);
  color: var(--accent);
  margin: 2px 0 4px;
  opacity: 0.85;
}

.search-result-excerpt {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.search-result-excerpt mark {
  background: var(--accent-soft);
  color: var(--text-strong);
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 560;
}

.search-dialog-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-faint);
}

.search-dialog-foot kbd {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 1px 5px;
  margin-right: 3px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
}

/* Mobile database tables & lists: show only the page title column (hide Tag, Notes, etc.) */
@media (max-width: 640px) {
  .db-table thead,
  .db-table td,
  .db-list-meta {
    display: none;
  }
  .db-table tbody th {
    border-right: 0;
    width: 100%;
  }
  .db-table-wrapper {
    overflow-x: hidden;
  }
}

/* Mobile Polish (375px+) */
@media (max-width: 560px) {
  .header-inner {
    padding: 0 14px;
  }
  .page-shell {
    padding: 20px 16px 64px;
  }
  .page-home .notion-callout {
    padding: 20px 18px 18px;
  }
  .btn-label,
  .kbd-hint,
  .search-dialog-foot {
    display: none;
  }
  .search-trigger {
    width: 33px;
    padding: 0;
  }
  .header-cta {
    padding: 0 11px;
    font-size: 0.8rem;
  }
  .page-prop-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
