* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--ds-font-sans);
  background: var(--ds-bg);
  color: var(--ds-foreground);
  min-height: 100vh;
}

.noise,
.halo {
  display: none;
}

a {
  color: inherit;
}

.topbar {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 20px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--ds-border);
}

.brand img {
  width: 176px;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

nav a {
  position: relative;
  text-decoration: none;
  color: var(--ds-muted);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
}

nav a:hover {
  color: var(--ds-foreground);
}

nav a:hover::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -17px;
  height: 2px;
  background: var(--ds-action);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 16px;
  border-left: 1px solid var(--ds-border);
}

.lang-btn {
  border: none;
  background: none;
  color: var(--ds-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.lang-btn:hover,
.lang-btn[aria-pressed="true"] {
  color: var(--ds-foreground);
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: 40px auto 80px;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ds-foreground);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 3.6vw, 3.5rem);
  line-height: 1.05;
}

h2 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  line-height: 1.15;
}

.lead {
  margin: 0;
  color: var(--ds-muted);
  font-size: 1rem;
  line-height: 1.75;
}

.case-hero,
.panel,
.gallery-section,
.related {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: 12px;
  box-shadow: var(--ds-shadow-sm);
}

.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 32px;
  padding: 32px;
}

.case-intro {
  display: grid;
  gap: 18px;
  align-content: start;
}

.case-category {
  margin: 0;
  color: var(--ds-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.case-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.case-meta div {
  padding-top: 12px;
  border-top: 1px solid var(--ds-border);
}

.case-meta dt {
  color: var(--ds-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.case-meta dd {
  margin: 6px 0 0;
  font-size: 0.94rem;
  color: var(--ds-foreground);
}

.case-status {
  font-weight: 700;
}

.status-live {
  color: var(--ds-success);
}

.status-build {
  color: var(--ds-info);
}

.status-demo {
  color: var(--ds-action);
}

.status-prep {
  color: var(--ds-warning);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tag-row span {
  padding-left: 12px;
  border-left: 1px solid var(--ds-border);
  color: var(--ds-muted);
  font-size: 0.84rem;
}

.tag-row span:first-child {
  padding-left: 0;
  border-left: none;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--ds-border-strong);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-foreground);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.btn:hover {
  border-color: var(--ds-action);
}

.btn-primary {
  border-color: var(--ds-action);
  background: var(--ds-action);
  color: var(--ds-action-foreground);
}

.btn-primary:hover {
  background: var(--ds-action-hover);
  color: var(--ds-action-foreground);
}

.case-cover-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--ds-border);
  border-radius: 10px;
  background: var(--ds-surface-alt);
}

.case-cover-wrap.is-illustration {
  padding: 28px;
}

.case-cover {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  display: block;
}

.case-cover.is-illustration {
  height: auto;
  min-height: 0;
  max-height: 320px;
  object-fit: contain;
}

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

.panel {
  padding: 24px;
}

.panel h2 {
  margin-bottom: 14px;
}

.panel p {
  margin: 0;
  color: var(--ds-muted);
  line-height: 1.7;
}

.panel ul {
  margin: 0;
  padding-left: 18px;
}

.panel li {
  margin: 0.55rem 0;
  color: var(--ds-muted);
  line-height: 1.7;
}

.gallery-section,
.related {
  margin-top: 24px;
  padding: 24px;
}

.section-head {
  margin-bottom: 20px;
}

.gallery-head,
.related-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.gallery-counter {
  margin: 8px 0 0;
  color: var(--ds-muted);
  font-size: 0.9rem;
}

.gallery-controls,
.related-controls {
  display: flex;
  gap: 8px;
}

.gallery-nav,
.related-nav {
  width: 36px;
  height: 36px;
  border: 1px solid var(--ds-border-strong);
  border-radius: 8px;
  background: var(--ds-surface);
  color: var(--ds-foreground);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.gallery-nav:disabled,
.related-nav:disabled {
  opacity: 0.45;
  cursor: default;
}

.gallery-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 20px;
}

.gallery-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  border: 1px solid var(--ds-border);
  border-radius: 10px;
  background: var(--ds-surface-alt);
  overflow: hidden;
}

.gallery-image {
  width: 100%;
  height: 100%;
  max-height: 640px;
  object-fit: contain;
  display: block;
}

.gallery-meta {
  display: grid;
  align-content: start;
  gap: 16px;
}

.gallery-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gallery-meta-top strong {
  font-size: 1rem;
}

.gallery-role {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--ds-border);
  border-radius: 8px;
  background: var(--ds-surface-alt);
  color: var(--ds-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

.gallery-meta p {
  margin: 0;
  color: var(--ds-muted);
  line-height: 1.7;
}

.gallery-thumbs {
  display: grid;
  gap: 10px;
}

.gallery-thumb {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--ds-border);
  border-radius: 10px;
  background: var(--ds-surface);
  cursor: pointer;
  text-align: left;
}

.gallery-thumb:hover,
.gallery-thumb.is-active {
  border-color: var(--ds-action);
  background: var(--ds-surface-alt);
}

.gallery-thumb img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--ds-border);
  border-radius: 8px;
  background: var(--ds-surface-alt);
}

.gallery-thumb-copy {
  display: grid;
  gap: 4px;
}

.gallery-thumb-copy strong {
  font-size: 0.88rem;
}

.gallery-thumb-copy span {
  color: var(--ds-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.related-controls.is-hidden {
  display: none;
}

.related-carousel {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.related-carousel::-webkit-scrollbar {
  display: none;
}

.related-grid {
  display: flex;
  gap: 16px;
  width: max-content;
}

.related-card {
  display: block;
  width: clamp(240px, 28vw, 320px);
  text-decoration: none;
  color: inherit;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: 10px;
  overflow: hidden;
  scroll-snap-align: start;
}

.related-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--ds-border);
}

.related-card.is-illustration img {
  object-fit: contain;
  padding: 18px;
  background: var(--ds-surface-alt);
}

.related-body {
  padding: 16px;
}

.related-body p {
  margin: 8px 0 0;
  color: var(--ds-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.case-empty {
  display: grid;
  gap: 12px;
}

footer {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto 40px;
  padding-top: 16px;
  border-top: 1px solid var(--ds-border);
  color: var(--ds-muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .topbar,
  main,
  footer {
    width: min(1120px, calc(100% - 1.5rem));
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  nav {
    flex-wrap: wrap;
    gap: 16px;
  }

  .lang-switch {
    padding-left: 0;
    border-left: none;
  }

  .case-hero {
    grid-template-columns: 1fr;
  }

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

  .gallery-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main {
    margin: 24px auto 64px;
  }

  .case-hero,
  .panel,
  .gallery-section,
  .related {
    padding: 24px;
  }

  .case-meta {
    grid-template-columns: 1fr;
  }

  .gallery-head,
  .gallery-meta-top,
  .related-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-thumb {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .related-card {
    width: min(82vw, 320px);
  }
}
