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

:root {
  --background: #161616;
  --background-hover: #212121;
  --layer: #262626;
  --layer-hover: #333333;
  --border: #393939;
  --border-strong: #6f6f6f;
  --text: #f4f4f4;
  --text-secondary: #c6c6c6;
  --text-muted: #8d8d8d;
  --accent: #78a9ff;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

[data-theme="light"] {
  --background: #ffffff;
  --background-hover: #e8e8e8;
  --layer: #f4f4f4;
  --layer-hover: #e8e8e8;
  --border: #e0e0e0;
  --border-strong: #8d8d8d;
  --text: #161616;
  --text-secondary: #525252;
  --text-muted: #6f6f6f;
  --accent: #0f62fe;
}

html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

body {
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
}

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

.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.header-inner {
  display: flex;
  width: 100%;
  max-width: 1584px;
  height: 100%;
  margin: 0 auto;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  height: 100%;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-prefix {
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions,
.nav-list {
  display: flex;
  height: 100%;
  align-items: center;
}

.nav-list {
  list-style: none;
}

.nav-list a {
  display: flex;
  height: 100%;
  padding: 0 16px;
  align-items: center;
  border-top: 2px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.nav-list a:hover {
  background: var(--background-hover);
  color: var(--text);
}

.nav-list a.active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.theme-toggle {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--background-hover);
  color: var(--text);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-sun,
[data-theme="light"] .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun {
  display: block;
}

.page {
  width: 100%;
  max-width: 1200px;
  margin: 48px auto 0;
  padding: 64px 24px 80px;
}

.eyebrow {
  margin-bottom: 16px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  max-width: 760px;
  font-size: 2.625rem;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.19;
}

.page-description {
  max-width: 620px;
  margin-top: 24px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 48px;
  border-top: 1px solid var(--border-strong);
  border-left: 1px solid var(--border);
}

.server-card {
  position: relative;
  display: flex;
  min-height: 240px;
  padding: 24px;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--layer);
  transition: background 160ms ease, transform 160ms ease;
}

.server-card:hover,
.server-card:focus-visible {
  z-index: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--layer-hover);
}

.server-card-index,
.server-card-action {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
}

.server-card-title {
  margin-top: auto;
  padding: 48px 0 16px;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 400;
  letter-spacing: -0.03em;
}

.server-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
}

.server-card-arrow {
  color: var(--accent);
  font-size: 1.25rem;
}

.detail-header {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-strong);
}

.detail-header .page-description {
  max-width: none;
}

.back-link {
  display: inline-flex;
  margin-bottom: 48px;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.back-link:hover {
  color: var(--accent);
}

.placeholder {
  display: grid;
  min-height: 320px;
  margin-top: 32px;
  place-items: center;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-section {
  margin-top: 72px;
}

.project-section-title {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.focus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 48px;
  background: var(--border);
}

.focus-item {
  min-height: 176px;
  padding: 24px;
  background: var(--layer);
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.focus-item:hover,
.focus-item:is(a):focus-visible {
  z-index: 1;
  background: #0043ce;
  color: #ffffff;
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.focus-item:is(a):focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

.focus-item:hover h3,
.focus-item:is(a):focus-visible h3 {
  color: #ffffff;
}

.focus-item:hover p,
.focus-item:is(a):focus-visible p {
  color: #e8e8e8;
}

.focus-item:hover .meta-label,
.focus-item:is(a):focus-visible .meta-label {
  color: #c6d9ff;
}

.focus-item .meta-label {
  display: block;
  margin-bottom: 40px;
  color: var(--accent);
  font-size: 0.6875rem;
}

.focus-item h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.focus-item p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color 0.2s ease;
}

.project-archive {
  margin-top: 32px;
  border-top: 1px solid var(--border);
  list-style: none;
}

.project-archive a {
  display: grid;
  grid-template-columns: 64px 160px 1fr auto;
  gap: 24px;
  padding: 20px 0;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.project-archive a:hover,
.project-archive a:focus-visible {
  outline: 0;
  background: var(--layer);
}

.project-archive time,
.project-archive-field,
.project-archive-action {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.project-archive strong {
  font-size: 1rem;
  font-weight: 500;
}

.project-archive-action {
  color: var(--accent);
}

.detail-content {
  width: 100%;
  padding-top: 40px;
}

.detail-content h2 {
  margin: 40px 0 12px;
  font-size: 1rem;
}

.detail-content p {
  color: var(--text-secondary);
}

.detail-lead {
  font-size: 1.125rem;
  line-height: 1.7;
}

.publication-title {
  margin-bottom: 12px;
  font-size: 1.25rem;
  font-weight: 500;
}

.detail-meta {
  display: flex;
  margin-top: 24px;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.detail-meta li {
  padding: 4px 8px;
  background: var(--layer);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

.detail-link {
  display: inline-flex;
  margin-top: 32px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.detail-link:hover,
.detail-link:focus-visible {
  border-color: var(--accent);
  outline: 0;
  background: var(--accent);
  color: #ffffff;
}

.detail-links {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
}

.project-media {
  margin-top: 72px;
}

.project-media-title {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-strong);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.media-grid,
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.media-wide {
  grid-column: 1 / -1;
}

.media-card {
  overflow: hidden;
  background: var(--layer);
}

.media-card video,
.media-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #000000;
}

.media-grid video {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.media-pair img + img {
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

.media-pair-match img {
  aspect-ratio: 1 / 1.16;
  object-fit: cover;
  object-position: top;
}

.media-card figcaption {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
}

@media (max-width: 820px) {
  .nav-list {
    display: none;
  }

  .page {
    padding: 48px 16px 64px;
  }

  .server-grid {
    grid-template-columns: 1fr;
    margin-top: 48px;
  }

  .server-card {
    min-height: 210px;
  }

  .project-archive a {
    grid-template-columns: 52px 1fr auto;
    gap: 12px;
  }

  .project-archive-field {
    display: none;
  }

  .media-grid,
  .photo-grid {
    grid-template-columns: 1fr;
  }

  .media-wide {
    grid-column: auto;
  }
}

@media (max-width: 580px) {
  .focus-grid {
    grid-template-columns: 1fr;
  }
}
