:root {
  color-scheme: dark;
  --bg: #090909;
  --bg-elevated: #111111;
  --bg-panel: rgba(17, 17, 17, 0.9);
  --bg-muted: #171717;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f2f2f2;
  --text-dim: rgba(242, 242, 242, 0.66);
  --text-muted: rgba(242, 242, 242, 0.4);
  --accent: #f2f2f2;
  --accent-soft: #bdbdbd;
  --soft-fill: rgba(255, 255, 255, 0.1);
  --panel-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --body-glow-a: rgba(255, 255, 255, 0.05);
  --body-glow-b: rgba(255, 255, 255, 0.04);
  --sidebar-wash: rgba(255, 255, 255, 0.02);
  --scanline: rgba(255, 255, 255, 0.02);
  --hover-fill: rgba(255, 255, 255, 0.06);
  --status-glow: rgba(242, 242, 242, 0.45);
  --pulse-start: rgba(242, 242, 242, 0.28);
  --pulse-end: rgba(242, 242, 242, 0);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f8f8;
  --bg-elevated: #ffffff;
  --bg-panel: rgba(255, 255, 255, 0.92);
  --bg-muted: #eef1f2;
  --border: rgba(18, 24, 28, 0.14);
  --border-strong: rgba(18, 24, 28, 0.28);
  --text: #101417;
  --text-dim: rgba(16, 20, 23, 0.68);
  --text-muted: rgba(16, 20, 23, 0.44);
  --accent: #101417;
  --accent-soft: #57636a;
  --soft-fill: rgba(16, 20, 23, 0.08);
  --panel-shadow: 0 18px 42px rgba(18, 24, 28, 0.08);
  --body-glow-a: rgba(28, 92, 122, 0.08);
  --body-glow-b: rgba(120, 92, 38, 0.06);
  --sidebar-wash: rgba(16, 20, 23, 0.025);
  --scanline: rgba(16, 20, 23, 0.025);
  --hover-fill: rgba(16, 20, 23, 0.055);
  --status-glow: rgba(16, 20, 23, 0.26);
  --pulse-start: rgba(16, 20, 23, 0.2);
  --pulse-end: rgba(16, 20, 23, 0);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

html,
body {
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: "IBM Plex Mono", monospace;
  background:
    radial-gradient(circle at top left, var(--body-glow-a), transparent 24%),
    radial-gradient(circle at bottom right, var(--body-glow-b), transparent 22%),
    var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

button,
input,
select,
textarea,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--text);
}

svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex: 0 0 auto;
}

img {
  display: block;
  max-width: 100%;
}

code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.55;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 3px
  );
  opacity: 0.22;
  mix-blend-mode: soft-light;
}

.page-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 34px 24px;
  overflow-y: auto;
  min-width: 0;
  background: linear-gradient(180deg, var(--sidebar-wash), transparent), var(--bg-elevated);
  border-right: 1px solid var(--border);
}

.sidebar-block {
  padding-bottom: 26px;
  border-bottom: 1px dashed var(--border);
}

.identity-block {
  display: grid;
  gap: 18px;
}

.avatar {
  width: 88px;
  height: 88px;
  border: 1px solid var(--border);
  object-fit: cover;
  filter: grayscale(0.12) contrast(1.04);
}

.eyebrow,
.sidebar-section-title,
.panel-header,
.link-list em,
.sidebar-meta {
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.eyebrow,
.sidebar-section-title,
.panel-header,
.link-list em,
.sidebar-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.product-title {
  margin: 10px 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 0.95;
  letter-spacing: 0;
}

.sidebar-copy {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.sidebar-meta {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  line-height: 1.5;
}

.sidebar-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-dim);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.sidebar-button:hover {
  transform: translateX(4px);
  border-color: var(--border-strong);
  background: var(--bg-muted);
  color: var(--text);
}

.theme-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  background: var(--bg-panel);
}

.theme-toggle button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  transition: background 140ms ease, color 140ms ease;
}

.theme-toggle button:last-child {
  border-right: 0;
}

.theme-toggle button:hover,
.theme-toggle button[aria-pressed="true"] {
  background: var(--bg-muted);
  color: var(--text);
}

.main {
  min-width: 0;
  padding: 30px;
}

.standalone-shell {
  width: min(1060px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0;
}

.return-link {
  padding-top: 24px;
}

.return-link a {
  display: inline-block;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-dim);
}

.return-link a:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--status-glow);
  animation: pulse-live 2.3s ease-in-out infinite;
}

.section-title-row {
  padding: 8px 0 24px;
  border-top: 1px solid var(--border);
  margin-top: 36px;
}

.section-title-row:first-child {
  margin-top: 0;
  border-top: 0;
}

.section-title-row h1,
.section-title-row h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  border: 0;
  background: transparent;
  min-width: 0;
}

.section-grid {
  margin-bottom: 8px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--panel-shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-header span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.panel-header span:last-child {
  text-align: right;
}

.panel-body {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.panel-body p {
  margin: 0;
  color: var(--text-dim);
}

.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text-dim);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.link-list a:hover {
  border-color: var(--border-strong);
  background: var(--hover-fill);
  color: var(--text);
}

.link-list span {
  color: var(--text);
}

.hash-block {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.hash-block span {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-body,
.project-body {
  align-content: space-between;
}

.project-body {
  min-height: 220px;
}

.card-body {
  min-height: 150px;
}

.blog-card .card-body {
  min-height: 160px;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}

@keyframes pulse-live {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--pulse-start);
  }
  50% {
    box-shadow: 0 0 0 4px var(--pulse-end);
  }
}

@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell,
  .sidebar,
  .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .main {
    padding: 16px;
  }

  .standalone-shell {
    width: calc(100% - 32px);
    padding: 24px 0;
  }

  .sidebar {
    padding: 22px 16px;
  }

  .sidebar-copy {
    max-width: 34ch;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .panel-header span:last-child {
    text-align: left;
  }

  .hash-block code {
    max-width: calc(100vw - 78px);
  }

  .link-list a {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
