:root {
  --ink: #111315;
  --muted: #5f6868;
  --paper: #f3f7f8;
  --panel: #ffffff;
  --line: rgba(17, 19, 21, 0.14);
  --line-strong: rgba(17, 19, 21, 0.26);
  --night: #121614;
  --night-soft: rgba(18, 22, 20, 0.72);
  --accent: #23695d;
  --accent-2: #d45131;
  --accent-soft: rgba(35, 105, 93, 0.12);
  --radius: 8px;
  --shell: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family:
    Inter,
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.65;
}

body.lock-scroll {
  overflow: hidden;
}

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

a {
  color: inherit;
}

p,
h1,
h2,
h3,
figure,
pre {
  margin: 0;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(calc(100% - 40px), var(--shell));
  margin: 0 auto;
  padding: 22px 0;
  color: #fff;
}

.brand {
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
}

.top-tools {
  display: flex;
  align-items: center;
  gap: 18px;
}

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

.topnav a {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 180ms ease;
}

.topnav a:hover,
.topnav a:focus-visible {
  color: #fff;
}

.language-picker select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.language-picker select:focus-visible {
  outline: 2px solid rgba(255, 177, 153, 0.62);
  outline-offset: 2px;
}

.hero {
  position: relative;
  min-height: 78svh;
  overflow: clip;
  background: var(--night);
  color: #fff;
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  filter: saturate(0.92) contrast(0.98) brightness(0.58);
  transform: scale(1.02);
}

.hero-shade {
  background:
    linear-gradient(180deg, rgba(18, 22, 20, 0.32), rgba(18, 22, 20, 0.62)),
    linear-gradient(90deg, rgba(18, 22, 20, 0.92), rgba(18, 22, 20, 0.62) 48%, rgba(18, 22, 20, 0.18));
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 140px;
  background: linear-gradient(180deg, rgba(243, 247, 248, 0), var(--paper));
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 40px), var(--shell));
  margin: 0 auto;
  padding: max(136px, calc(var(--hero-header-height, 0px) + 36px)) 0 112px;
  max-width: 690px;
}

.eyebrow {
  color: var(--accent-2);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #ffb199;
}

h1 {
  margin-top: 16px;
  max-width: 660px;
  font-size: 4rem;
  line-height: 1;
  letter-spacing: 0;
}

.hero-copy {
  margin-top: 22px;
  max-width: 620px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.15rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button,
.copy-button,
.filter-button {
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
}

.button:hover,
.button:focus-visible,
.copy-button:hover,
.copy-button:focus-visible,
.filter-button:hover,
.filter-button:focus-visible {
  transform: translateY(-1px);
}

.button.primary {
  background: #fff;
  color: var(--night);
}

.button.ghost {
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.local-reference,
.library-intro,
.case-area,
.source-section {
  width: min(calc(100% - 40px), var(--shell));
  margin: 0 auto;
}

.local-reference {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 0.72fr);
  gap: 56px;
  align-items: center;
  padding: 74px 0 88px;
}

.section-copy h2 {
  margin-top: 12px;
  max-width: 760px;
  font-size: 2.25rem;
  line-height: 1.12;
  letter-spacing: 0;
}

.section-copy p:not(.eyebrow):not(.source-url) {
  margin-top: 18px;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
}

.local-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--night);
  box-shadow: 0 24px 70px rgba(17, 19, 21, 0.16);
}

.local-frame img {
  width: 100%;
  max-height: 640px;
  object-fit: cover;
  object-position: center;
}

.local-frame figcaption {
  position: absolute;
  inset: auto 12px 12px;
  padding: 6px 9px;
  border-radius: 6px;
  background: rgba(18, 22, 20, 0.72);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.78rem;
  word-break: break-all;
}

.library-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(360px, 0.68fr);
  gap: 42px;
  align-items: end;
  padding: 76px 0 32px;
  border-top: 1px solid var(--line);
}

.library-controls {
  display: grid;
  gap: 14px;
}

.search-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

#caseSearch {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

#caseSearch:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 750;
}

.filter-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.case-area {
  padding: 12px 0 86px;
}

.case-summary {
  margin-bottom: 24px;
  color: var(--muted);
  font-weight: 700;
}

.category-section {
  padding: 34px 0 18px;
  border-top: 1px solid var(--line);
}

.category-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.category-heading h2 {
  font-size: 1.75rem;
  line-height: 1.16;
  letter-spacing: 0;
}

.category-heading span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.case-stack {
  display: grid;
  gap: 22px;
}

.case-card {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 48px rgba(17, 19, 21, 0.06);
}

.case-card.is-featured {
  border-color: rgba(212, 81, 49, 0.52);
}

.case-media {
  overflow: hidden;
  border-radius: var(--radius);
  background: #161a18;
}

.case-image-link {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: #fff;
  text-decoration: none;
}

.case-media img {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.case-body {
  min-width: 0;
}

.case-meta,
.case-links,
.prompt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.case-meta {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 850;
}

.case-number::before {
  content: "· ";
  color: var(--line-strong);
}

.case-body h3 {
  margin-top: 8px;
  font-size: 1.55rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.case-links {
  margin-top: 12px;
}

.case-links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 750;
  text-decoration-color: rgba(95, 104, 104, 0.3);
  text-underline-offset: 4px;
}

.case-links a:hover,
.case-links a:focus-visible {
  color: var(--ink);
}

.prompt-head {
  justify-content: space-between;
  margin-top: 22px;
  color: var(--ink);
  font-weight: 850;
}

.copy-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 800;
}

.copy-button.is-copied {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.prompt-text {
  margin-top: 12px;
  max-height: 520px;
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(17, 19, 21, 0.1);
  border-radius: var(--radius);
  background: #f8faf9;
  color: #232827;
  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;
  font-size: 0.92rem;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 44px 0;
  color: var(--muted);
  font-weight: 700;
}

.source-section {
  padding: 76px 0 54px;
  border-top: 1px solid var(--line);
}

.source-url {
  margin-top: 18px;
  max-width: 960px;
  color: var(--ink);
  font-weight: 750;
  word-break: break-all;
}

.source-url a {
  text-decoration-color: rgba(17, 19, 21, 0.28);
  text-underline-offset: 4px;
}

.source-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.source-badges a {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  text-decoration: none;
}

.source-badges img {
  max-height: 34px;
  width: auto;
}

.site-footer {
  width: min(calc(100% - 40px), var(--shell));
  margin: 0 auto;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-meta {
  display: grid;
  gap: 4px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.footer-links a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(95, 104, 104, 0.28);
  text-underline-offset: 4px;
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] .prompt-text {
  direction: ltr;
  text-align: left;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 520ms ease,
    transform 520ms ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .top-tools {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .topnav {
    gap: 10px 12px;
  }

  .language-picker select {
    min-width: 140px;
    max-width: 100%;
  }

  .hero {
    min-height: 82svh;
  }

  .hero-content {
    padding-top: max(188px, calc(var(--hero-header-height, 0px) + 38px));
    padding-bottom: 96px;
  }

  h1 {
    font-size: 3rem;
  }

  .local-reference,
  .library-intro,
  .case-card {
    grid-template-columns: 1fr;
  }

  .local-reference {
    padding-top: 58px;
  }
}

@media (max-width: 560px) {
  .topbar,
  .hero-content,
  .local-reference,
  .library-intro,
  .case-area,
  .source-section,
  .site-footer {
    width: min(calc(100% - 28px), var(--shell));
  }

  .topnav {
    font-size: 0.9rem;
  }

  .hero {
    min-height: 86svh;
  }

  .hero-content {
    padding-top: max(210px, calc(var(--hero-header-height, 0px) + 42px));
  }

  h1 {
    font-size: 2.45rem;
  }

  .hero-copy,
  .section-copy p:not(.eyebrow):not(.source-url) {
    font-size: 1rem;
  }

  .section-copy h2 {
    font-size: 1.85rem;
  }

  .category-heading {
    display: grid;
    gap: 6px;
  }

  .case-card {
    padding: 14px;
  }

  .case-image-link {
    min-height: 220px;
  }

  .case-body h3 {
    font-size: 1.3rem;
  }

  .prompt-text {
    max-height: 430px;
    padding: 13px;
  }
}
