:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-hover: #f7f7f8;
  --text: #171717;
  --muted: #666a73;
  --faint: #8b9099;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
}

:root[data-theme="dark"] {
  --bg: #111113;
  --panel: #18181b;
  --panel-hover: #222226;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: #2f3037;
  --accent: #60a5fa;
  --accent-soft: #172554;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.55;
  transition: background 180ms ease, color 180ms ease;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  border-radius: 6px;
  background: var(--text);
  color: var(--bg);
  padding: 0.65rem 0.85rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-header,
main,
.site-footer {
  width: min(42rem, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 1.25rem 0 0.75rem;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  object-fit: cover;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle,
.menu-button {
  min-height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
}

.theme-toggle {
  min-width: 4rem;
  padding: 0.35rem 0.75rem;
}

.theme-toggle:hover,
.menu-button:hover,
.site-nav a:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.menu-button {
  display: none;
  width: 2.35rem;
  padding: 0;
}

.menu-button span:not(.sr-only) {
  display: block;
  width: 1rem;
  height: 2px;
  margin: 3px auto;
  background: currentColor;
}

.site-nav {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding-top: 0.25rem;
}

.site-nav a {
  border-radius: 7px;
  padding: 0.45rem 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a[aria-current] {
  background: var(--panel-hover);
  color: var(--text);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

main {
  min-height: 72vh;
  padding: 2.5rem 0 4rem;
}

.profile-block,
.page-title {
  display: grid;
  gap: 1rem;
  padding: 1.5rem 0 2rem;
}

.profile-block {
  grid-template-columns: 6rem 1fr;
  align-items: start;
}

.profile-mark {
  width: 5.25rem;
  height: 5.25rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: var(--shadow);
  object-fit: cover;
}

.eyebrow,
.row-kicker {
  margin: 0;
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  max-width: 14ch;
  font-size: clamp(2.25rem, 8vw, 4rem);
  font-weight: 800;
}

h2 {
  font-size: 1rem;
  font-weight: 800;
}

.intro {
  max-width: 36rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.link-grid,
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.link-grid a,
.info-grid article,
.note-panel,
.detail-layout aside {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 1rem;
}

.link-grid a {
  display: grid;
  gap: 0.25rem;
  min-height: 5.5rem;
  align-content: center;
  text-decoration: none;
}

.link-grid a:hover,
.list-row:hover {
  background: var(--panel-hover);
}

.link-grid span {
  color: var(--faint);
  font-size: 0.82rem;
  font-weight: 800;
}

.link-grid strong {
  font-size: 0.96rem;
}

.content-section {
  padding-top: 2.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.section-link,
.note-panel a,
.title-actions a,
.row-actions a {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.section-link:hover,
.note-panel a:hover,
.title-actions a:hover,
.row-actions a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.row-list {
  display: grid;
  gap: 0.65rem;
}

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 1rem;
  transition: background 160ms ease, border-color 160ms ease;
}

.row-main {
  display: grid;
  gap: 0.25rem;
  text-decoration: none;
}

.row-main strong {
  font-size: 1.05rem;
}

.row-main span:last-child,
.prose-block p,
.note-panel p,
.plain-list li {
  color: var(--muted);
}

.row-meta {
  display: grid;
  justify-items: end;
  gap: 0.55rem;
}

.row-actions,
.title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chips span {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.22rem 0.5rem;
  font-size: 0.76rem;
  font-weight: 800;
}

.note-panel {
  display: grid;
  gap: 0.6rem;
  margin-top: 2.5rem;
}

.note-panel p {
  margin: 0;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 1rem;
  padding-top: 1.25rem;
}

.prose-block,
.detail-layout aside,
.info-grid article {
  display: grid;
  gap: 0.75rem;
}

.prose-block p {
  margin: 0;
}

.plain-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.1rem;
}

.primary-link {
  display: inline-flex;
  min-height: 2.35rem;
  align-items: center;
  border-radius: 7px;
  background: var(--text);
  color: var(--bg) !important;
  padding: 0.45rem 0.8rem;
  text-decoration: none !important;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding: 1.4rem 0 2rem;
  color: var(--faint);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--muted);
  font-weight: 750;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 680px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 1.25rem, 42rem);
  }

  .menu-button {
    display: block;
  }

  .site-nav {
    display: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 0.45rem;
  }

  .site-nav.is-open {
    display: grid;
  }

  .site-nav a {
    padding: 0.65rem 0.75rem;
  }

  .profile-block {
    grid-template-columns: 1fr;
  }

  .profile-mark {
    width: 4.75rem;
    height: 4.75rem;
  }

  .link-grid,
  .info-grid,
  .list-row,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .row-meta {
    justify-items: start;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
