:root {
  color-scheme: dark light;
  --color-page: #050505;
  --color-surface: #101010;
  --color-surface-raised: #151515;
  --color-text: #f7f7f4;
  --color-heading: #ffffff;
  --color-muted: #cecec8;
  --color-border: rgba(255, 255, 255, 0.12);
  --color-header: rgba(5, 5, 5, 0.88);
  --color-accent: #ff3e1c;
  --color-accent-contrast: #050505;
  --color-code-surface: #1c1c1c;
  --color-code-text: #f7f7f4;
  --shadow-soft: 0 20px 56px rgba(0, 0, 0, 0.32);
  background: var(--color-page);
  color: var(--color-text);
}

@media (prefers-color-scheme: light) {
  :root {
    --color-page: #f7f7f4;
    --color-surface: #ffffff;
    --color-surface-raised: #f0f1ed;
    --color-text: #171717;
    --color-heading: #050505;
    --color-muted: #51524d;
    --color-border: rgba(5, 5, 5, 0.13);
    --color-header: rgba(247, 247, 244, 0.88);
    --color-accent-contrast: #ffffff;
    --color-code-surface: #eceee8;
    --color-code-text: #1f211d;
    --shadow-soft: 0 18px 46px rgba(18, 20, 16, 0.12);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  margin: 0;
  padding: 0;
  color: var(--color-text);
  background: var(--color-page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 52px);
  color: var(--color-heading);
  background: var(--color-header);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.brand img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 18px;
  color: var(--color-muted);
  font-size: 0.95rem;
}

.site-header a {
  color: inherit;
  text-decoration: none;
}

.site-header a:hover,
.site-header a:focus-visible {
  color: var(--color-accent);
}

header.demo-hero {
  max-width: none;
  margin: 0;
  padding: clamp(44px, 7vw, 86px) clamp(18px, 6vw, 88px) 28px;
}

.demo-hero-inner {
  max-width: 1120px;
  margin: 0 auto;
}

h1 {
  max-width: 820px;
  margin: 0;
  color: var(--color-heading);
  font-size: clamp(2.4rem, 8vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--color-muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.55;
}

main {
  width: min(100%, 1240px);
  max-width: none;
  margin: 0 auto;
  padding: 16px clamp(18px, 6vw, 88px) clamp(52px, 8vw, 92px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.card {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 16px;
  color: var(--color-text);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

h2 {
  min-width: 0;
  margin: 0;
  color: var(--color-heading);
  font-size: 1.08rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.meta span {
  flex: 0 0 auto;
  color: var(--color-accent);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.code-frame {
  display: grid;
  place-items: center;
  min-height: clamp(180px, 28vw, 240px);
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.code-frame img,
.code-frame svg {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 240px;
  height: auto;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}

code {
  display: block;
  min-height: 42px;
  padding: 9px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  color: var(--color-code-text);
  background: var(--color-code-surface);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  padding: 28px clamp(18px, 6vw, 88px);
  color: var(--color-muted);
  background: var(--color-page);
  border-top: 1px solid var(--color-border);
}

.site-footer span {
  color: var(--color-heading);
  font-weight: 800;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--color-accent);
}

@media (max-width: 640px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .site-header nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: flex-start;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media print {
  .site-header,
  .site-footer {
    display: none;
  }

  body {
    background: #ffffff;
  }

  header.demo-hero,
  main {
    padding: 16px;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}
