@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800;900&display=swap");

:root {
  color-scheme: light;
  --color-primary: #000078;
  --color-primary-dark: #00005C;
  --color-primary-light: #EEF0FF;
  --color-primary-bright: #5870E0;
  --color-brand-green: #55D78C;
  --color-brand-green-light: #EAFBF1;
  --color-brand-cyan: #48D0F0;
  --color-brand-blue: #0020D8;
  --color-brand-magenta: #F05AF7;
  --color-secondary: #17145F;
  --color-accent: #F4C542;
  --color-white: #FFFFFF;
  --color-background: #F2F3FF;
  --color-surface: #F0F0F0;
  --color-text: #17145F;
  --color-muted: #55527A;
  --color-border: #D9DCF5;
  --font-sans: Poppins, Inter, Arial, Helvetica, sans-serif;
  --blue-institutional: var(--color-primary);
  --blue-text: var(--color-secondary);
  --blue-hero: var(--color-primary-bright);
  --blue-electric: var(--color-brand-blue);
  --mint: var(--color-brand-green);
  --mint-light: var(--color-brand-green-light);
  --cyan: var(--color-brand-cyan);
  --magenta: var(--color-brand-magenta);
  --lavender: var(--color-background);
  --gray-light: var(--color-surface);
  --text: var(--color-text);
  --text-secondary: var(--color-muted);
  --border: var(--color-border);
  --white: var(--color-white);
  --shadow: 0 18px 48px var(--color-border);
  --font-body: var(--font-sans);
  --font-mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
a {
  font: inherit;
}

a {
  color: var(--blue-electric);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 75px;
  padding: 10px 48px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.brand {
  display: inline-flex;
  align-items: flex-start;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: 68px;
  object-fit: contain;
  object-position: left center;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-link,
.primary-button,
.copy-button,
.media-button,
.download-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.primary-button {
  border-color: var(--blue-institutional);
  background: var(--blue-institutional);
  color: var(--white);
}

.primary-button:hover {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-dark);
}

.ghost-link:hover,
.copy-button:hover,
.media-button:hover {
  border-color: var(--blue-electric);
  transform: translateY(-1px);
}

.shell {
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
  gap: 32px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px 48px;
  background:
    linear-gradient(var(--blue-institutional), var(--blue-institutional)) 0 0 / 100% 52px no-repeat,
    var(--white);
}

.sidebar {
  position: sticky;
  top: 107px;
  align-self: start;
  max-height: calc(100vh - 118px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  background: var(--white);
  color: var(--text);
  box-shadow: 0 24px 58px rgba(0, 0, 120, 0.12);
}

.search-card {
  margin-top: 0;
  padding: 0;
}

.search-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.search-card input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 14px;
  background: var(--color-primary-light);
  color: var(--text);
  outline: none;
}

.search-card input::placeholder {
  color: var(--text-secondary);
}

.search-card input:focus {
  border-color: var(--mint);
}

.toc {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.toc a {
  position: relative;
  display: block;
  border-radius: 999px;
  padding: 13px 14px 13px 18px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
}

.toc a::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 8px;
  width: 3px;
  border-radius: 99px;
  background: transparent;
  content: "";
}

.toc a:hover {
  background: var(--color-primary-light);
  color: var(--text);
}

.toc a.is-active {
  background: var(--blue-institutional);
  color: var(--white);
}

.toc a.is-active::before {
  background: var(--mint);
}

.content {
  min-width: 0;
}

.hero {
  position: relative;
  display: grid;
  gap: 22px;
  min-height: 470px;
  align-content: end;
  padding: 72px 52px 52px;
  overflow: hidden;
  border-bottom: 0;
  border-radius: 0 0 0 88px;
  background: var(--blue-hero);
}

.hero::before {
  position: absolute;
  top: -120px;
  right: -128px;
  width: 410px;
  height: 520px;
  border: 72px solid var(--magenta);
  border-bottom-color: var(--blue-electric);
  border-left-color: var(--blue-electric);
  border-radius: 50%;
  opacity: 0.98;
  content: "";
}

.hero::after {
  position: absolute;
  top: 180px;
  right: 168px;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: var(--blue-institutional);
  content: "";
}

.kicker {
  position: relative;
  z-index: 1;
  width: max-content;
  max-width: 100%;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 9px 14px;
  background: var(--white);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.support-kicker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.support-kicker img {
  display: block;
  width: 72px;
  height: auto;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0;
  color: var(--white);
  font-size: 58px;
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
  text-wrap: balance;
}

.lead {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0;
  color: var(--white);
  font-size: 20px;
  line-height: 1.55;
  font-weight: 400;
  text-wrap: pretty;
}

.stats {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stats span {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--white);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.stats strong {
  color: var(--text);
  font-weight: 800;
}

.library {
  display: grid;
  gap: 24px;
  padding: 34px 0 76px;
}

.section {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--white);
  box-shadow: 0 20px 54px rgba(0, 0, 120, 0.1);
  overflow: hidden;
}

.section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 28px;
  cursor: pointer;
  list-style: none;
}

.section > summary::-webkit-details-marker,
.example > summary::-webkit-details-marker {
  display: none;
}

.section-title {
  min-width: 0;
}

.section-title small {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.section-title h2,
.example-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 30px;
  line-height: 1.18;
  font-weight: 800;
  text-wrap: balance;
}

.chevron {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  transition: transform 180ms ease, background 180ms ease;
}

.section[open] > summary .chevron,
.example[open] > summary .chevron {
  background: var(--mint-light);
  transform: rotate(90deg);
}

.section-body {
  display: grid;
  gap: 18px;
  padding: 0 28px 28px;
}

.example {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.example:hover,
.media-card:hover,
.file-card:hover,
.link-card:hover,
.prompt-card:hover {
  border-color: var(--blue-hero);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.module-card {
  border-color: var(--border);
}

.module-card > summary {
  background: var(--color-primary-light);
}

.example > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  background: var(--white);
}

.example-title h3 {
  font-size: 22px;
}

.example-content {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.note {
  max-width: 78ch;
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.75;
  text-wrap: pretty;
}

.prompt-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.prompt-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--blue-institutional);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.copy-button {
  min-height: 34px;
  border-color: var(--white);
  background: var(--white);
  color: var(--text);
}

pre {
  margin: 0;
  overflow: auto;
  padding: 18px;
  color: var(--text);
  background: var(--white);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.inline-prompt {
  margin: 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--mint);
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--mint-light);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  text-wrap: pretty;
}

.placeholder-card {
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 24px;
  background: var(--white);
}

.placeholder-kicker {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--mint-light);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.placeholder-card h3 {
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
}

.placeholder-card p {
  margin: 0;
  color: var(--text-secondary);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.media-card,
.file-card,
.link-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--white);
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.media-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--gray-light);
}

.media-meta,
.link-card,
.file-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.file-card-head {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.media-meta strong,
.file-card strong,
.file-name,
.link-card strong {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  text-wrap: balance;
}

.file-name {
  color: var(--blue-electric);
  overflow-wrap: anywhere;
}

.file-type {
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--mint-light);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.media-meta small {
  color: var(--text-secondary);
  line-height: 1.5;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  min-width: 0;
}

.media-button {
  border-color: var(--mint);
  background: var(--mint);
  color: var(--text);
  min-height: 36px;
  padding: 8px 12px;
}

.download-button {
  min-height: 48px;
  border-color: var(--blue-institutional);
  background: var(--blue-institutional);
  color: var(--white);
  font-size: 14px;
  font-weight: 800;
}

.download-button:hover {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.contract {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  background: var(--white);
}

.contract h3 {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.contract p {
  max-width: 84ch;
  margin: 0 0 12px;
  color: var(--text);
  line-height: 1.78;
  overflow-wrap: anywhere;
}

.contract table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border-collapse: collapse;
  color: var(--text);
  font-size: 14px;
  -webkit-overflow-scrolling: touch;
}

.contract th,
.contract td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
}

.empty-state {
  margin: 30px 0 80px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 24px;
  background: var(--white);
  color: var(--text-secondary);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  min-width: 220px;
  max-width: calc(100vw - 40px);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--blue-institutional);
  color: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.is-hidden {
  display: none;
}

@media (max-width: 920px) {
  .topbar,
  .top-actions {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
    padding: 16px 18px;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .shell {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 22px 18px 36px;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

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

  .hero {
    min-height: 0;
    padding: 46px 28px 36px;
    border-radius: 0 0 0 46px;
  }

  h1 {
    font-size: 44px;
  }

  .lead {
    font-size: 18px;
  }

  .section-title h2 {
    font-size: 26px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .top-actions,
  .toc,
  .stats {
    grid-template-columns: 1fr;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    height: 54px;
  }

  .shell {
    padding: 16px 12px 30px;
  }

  .sidebar {
    border-radius: 16px;
    padding: 16px;
  }

  .hero::before {
    top: -96px;
    right: -178px;
    width: 318px;
    height: 408px;
    border-width: 54px;
  }

  .hero::after {
    top: 128px;
    right: 52px;
    width: 74px;
    height: 74px;
    opacity: 0.8;
  }

  h1 {
    font-size: 34px;
    line-height: 1.1;
  }

  .lead {
    font-size: 16px;
  }

  .section > summary {
    padding: 20px 16px;
  }

  .section-body {
    padding: 0 14px 16px;
  }

  .section-title h2 {
    font-size: 22px;
  }

  .example-title h3 {
    font-size: 18px;
  }

  .example-content {
    padding: 14px;
  }

  pre {
    padding: 15px;
    font-size: 12px;
    line-height: 1.65;
  }

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

  .contract {
    padding: 18px;
    border-radius: 14px;
  }

  .contract h3 {
    font-size: 22px;
  }

  .contract p {
    font-size: 14px;
    line-height: 1.7;
  }

  .contract table {
    white-space: nowrap;
  }
}
