:root {
  color-scheme: light dark;
  --bg: #071018;
  --surface: rgba(15, 29, 40, 0.82);
  --surface-strong: #102432;
  --line: rgba(148, 184, 202, 0.2);
  --text: #edf8fb;
  --muted: #a8bdc7;
  --accent: #38d0c4;
  --accent-strong: #83f2e9;
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 5%, rgba(56, 208, 196, 0.16), transparent 34rem),
    radial-gradient(circle at 92% 18%, rgba(58, 124, 189, 0.2), transparent 32rem),
    var(--bg);
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-nav,
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-nav {
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 22px rgba(56, 208, 196, 0.72);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.nav-links a,
.text-link {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-links a:hover,
.text-link:hover {
  color: var(--accent-strong);
}

.hero {
  padding: 92px 0 56px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

.hero h1 {
  max-width: 900px;
  margin-bottom: 20px;
  font-size: clamp(2.65rem, 7vw, 5.7rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 730px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.75;
}

.gallery-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 18px 0 24px;
}

.gallery-heading h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 22px;
  padding-bottom: 84px;
}

.diagram-card {
  grid-column: span 6;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.diagram-card:first-child {
  grid-column: span 12;
}

.diagram-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 208, 196, 0.62);
  background: var(--surface-strong);
}

.diagram-card:focus-visible,
.nav-links a:focus-visible,
.text-link:focus-visible,
.brand:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.diagram-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top left;
  background: #f4f8fa;
  border-bottom: 1px solid var(--line);
}

.diagram-card:first-child .diagram-preview {
  aspect-ratio: 2.25 / 1;
}

.card-copy {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 22px 24px 24px;
}

.card-copy h3 {
  margin: 0 0 7px;
  font-size: 1.18rem;
}

.card-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

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

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.viewer-page {
  height: 100dvh;
  min-height: 640px;
  overflow: hidden;
}

.viewer-bar {
  min-height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.92);
  backdrop-filter: blur(16px);
}

.viewer-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-frame {
  display: block;
  width: 100%;
  height: calc(100dvh - 64px);
  border: 0;
  background: #f4f8fa;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  .hero {
    padding: 68px 0 42px;
  }

  .gallery-heading,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .diagram-card,
  .diagram-card:first-child {
    grid-column: span 12;
  }

  .diagram-card:first-child .diagram-preview,
  .diagram-preview {
    aspect-ratio: 16 / 10;
  }

  .viewer-bar {
    gap: 12px;
  }

  .viewer-bar .text-link:last-child {
    display: none;
  }
}

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