:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #6b7180;
  --faint: #9aa0ad;
  --rule: #e8e9ee;
  --accent: #3651d4;
  --accent-soft: #eef1fd;
  --thumb: #f0f2f6;
  --thumb-ink: #a3a9b6;
  --tabbar: rgba(255, 255, 255, 0.85);
  --indicator: #16181d;
  --indicator-text: #ffffff;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e2026;
    --surface: #25282e;
    --text: #ecedf0;
    --muted: #9a9fab;
    --faint: #6c717d;
    --rule: #353841;
    --accent: #8da2ff;
    --accent-soft: #283052;
    --thumb: #2b2e35;
    --thumb-ink: #555b67;
    --tabbar: rgba(30, 32, 38, 0.85);
    --indicator: #ecedf0;
    --indicator-text: #1e2026;
  }
}
:root[data-theme="dark"] {
  --bg: #1e2026;
  --surface: #25282e;
  --text: #ecedf0;
  --muted: #9a9fab;
  --faint: #6c717d;
  --rule: #353841;
  --accent: #8da2ff;
  --accent-soft: #283052;
  --thumb: #2b2e35;
  --thumb-ink: #555b67;
  --tabbar: rgba(30, 32, 38, 0.85);
  --indicator: #ecedf0;
  --indicator-text: #1e2026;
}
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 70px); }
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 0; }

.page { max-width: 780px; margin: 0 auto; padding: 56px 24px 72px; }

/* Intro */
.intro { display: grid; grid-template-columns: 1fr 168px; gap: 40px; align-items: start; }
.intro h1 {
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600; font-size: clamp(28px, 5vw, 32px);
  line-height: 1.05; letter-spacing: -0.015em; margin: 0 0 8px;
}
.role { color: var(--muted); margin: 0 0 22px; font-size: 17px; }
.bio p { margin: 0 0 14px; max-width: 58ch; }
.contact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.contact a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 1px solid var(--rule); border-radius: 0;
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 500;
}
.contact a:hover { text-decoration: none; border-color: var(--text); }
.contact a.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.contact svg { width: 15px; height: 15px; }
.portrait {
  width: 168px; aspect-ratio: 1; border-radius: 0;
  background: var(--thumb); color: var(--thumb-ink);
  display: flex; align-items: center; justify-content: center;
  font-family: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif; font-size: 44px; font-weight: 500; overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }

/* Sticky tab bar */
.tabbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  margin: 64px -24px 0; padding: 12px 24px;
  background: var(--tabbar);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabs { position: relative; display: inline-flex; gap: 2px; padding: 4px; border-radius: 0; background: var(--thumb); }
.indicator {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
  background: var(--indicator); border-radius: 0;
  transition: transform 0.28s cubic-bezier(.3,.7,.2,1), width 0.28s cubic-bezier(.3,.7,.2,1);
}
.tab {
  position: relative; z-index: 1;
  font: inherit; font-size: 14px; font-weight: 500;
  background: none; border: 0; color: var(--muted);
  padding: 7px 16px; border-radius: 0; cursor: pointer; white-space: nowrap;
  transition: color 0.2s;
}
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { color: var(--indicator-text); }
.tab .count { margin-left: 6px; font-size: 12px; opacity: 0.6; font-variant-numeric: tabular-nums; }

/* Entries */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.entry {
  display: grid; grid-template-columns: 176px 1fr; gap: 24px;
  padding: 24px 0; border-bottom: 1px solid var(--rule);
}
.entry:last-child { border-bottom: 0; }
.entry[hidden] { display: none; }
.entry.compact { grid-template-columns: 1fr; padding: 18px 0; }
.entry.compact .title { font-size: 16px; }
.entry.enter { animation: enter 0.35s cubic-bezier(.3,.7,.2,1) both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.thumb {
  width: 176px; aspect-ratio: 4 / 3; border-radius: 0;
  background: var(--thumb); color: var(--thumb-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.venue {
  font-weight: 600; color: var(--text);
  padding: 2px 9px; border-radius: 0; background: var(--thumb);
}
.badge {
  font-weight: 600; color: var(--accent);
  padding: 2px 9px; border-radius: 0; background: var(--accent-soft);
}
.title { display: block; font-size: 18px; font-weight: 600; line-height: 1.35; color: var(--text); letter-spacing: -0.005em; }
.title:hover { color: var(--accent); text-decoration: none; }
.authors { margin-top: 4px; font-size: 14px; color: var(--muted); }
.authors strong { color: var(--text); font-weight: 600; }
.desc { margin: 8px 0 0; font-size: 15px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.links a {
  font-size: 13px; font-weight: 500; color: var(--text);
  padding: 4px 11px; border: 1px solid var(--rule); border-radius: 0;
}
.links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.empty { padding: 32px 0; color: var(--muted); }

footer { margin-top: 48px; font-size: 13px; color: var(--faint); }

@media (max-width: 640px) {
  .page { padding-top: 36px; }
  .intro { grid-template-columns: 1fr; gap: 24px; }
  .portrait { order: -1; width: 112px; border-radius: 0; font-size: 38px; }
  .entry { grid-template-columns: 1fr; gap: 14px; }
  .thumb { width: 100%; aspect-ratio: 16 / 9; }
  .tabbar { margin-top: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .indicator, .tab { transition: none; }
  .entry.enter { animation: none; }
}

.bio p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------
   Detail page (item.php)
   ------------------------------------------------------------- */
.detail { max-width: 720px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--faint); margin-bottom: 40px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

.preview-note {
  padding: 10px 14px; margin: 0 0 28px; font-size: 14px;
  background: var(--accent-soft); color: var(--accent);
}

.detail-head h1 {
  font-size: clamp(26px, 4.4vw, 34px); font-weight: 600;
  line-height: 1.2; letter-spacing: -0.02em; margin: 4px 0 12px;
}
.detail-head .meta { margin-bottom: 10px; }
.detail-head .authors { font-size: 16px; margin: 0; }
.detail-head .links { margin-top: 20px; }
.links a.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.links a.primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.hero { margin: 36px 0 0; background: var(--thumb); }
.hero img { display: block; width: 100%; height: auto; }

.lead { font-size: 18px; line-height: 1.6; margin: 32px 0 0; color: var(--text); }

/* Long-form content written in the admin */
.prose { margin-top: 28px; font-size: 16.5px; line-height: 1.75; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure, .prose table { margin: 0 0 20px; }
.prose h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.01em; margin: 44px 0 12px; line-height: 1.3; }
.prose h3 { font-size: 18px; font-weight: 600; margin: 32px 0 10px; }
.prose h4 { font-size: 16px; font-weight: 600; margin: 24px 0 8px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--faint); }
.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose blockquote {
  padding: 2px 0 2px 18px; border-left: 2px solid var(--text);
  color: var(--muted); font-style: italic;
}
.prose code {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em; background: var(--thumb); padding: 2px 5px;
}
.prose pre { background: var(--thumb); padding: 16px 18px; overflow-x: auto; line-height: 1.55; }
.prose pre code { background: none; padding: 0; font-size: 14px; }
.prose img { max-width: 100%; height: auto; display: block; }
.prose figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 36px 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 15px; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 8px 12px; text-align: left; }
.prose th { background: var(--thumb); font-weight: 600; }

/* Citation */
.cite { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--rule); }
.cite-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cite h2 { font-size: 18px; font-weight: 600; margin: 0; }
.copy-btn {
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  background: none; color: var(--text); border: 1px solid var(--rule); padding: 5px 12px;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.cite pre {
  margin: 0; padding: 16px 18px; background: var(--thumb); overflow-x: auto;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; line-height: 1.6;
}

/* More from this category */
.more { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule); }
.more h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.more ul { list-style: none; margin: 0; padding: 0; }
.more li { padding: 10px 0; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.more li:last-child { border-bottom: 0; }
.more li a { color: var(--text); font-weight: 500; }
.more li a:hover { color: var(--accent); }
.more-meta { font-size: 14px; color: var(--muted); }

.detail footer { margin-top: 48px; }
.detail footer a { color: var(--muted); }
.detail footer a:hover { color: var(--accent); }
