@import url("/library/opencode/assets/opencode-guide.css");

:root {
  --brand: #d84c3a;
  --brand-soft: #fff1ee;
  --brand-border: #f2b5aa;
}

[data-theme="dark"] {
  --brand: #ff9a88;
  --brand-soft: #382522;
  --brand-border: #75483f;
}

.brand-mark {
  width: 42px;
  background: linear-gradient(145deg, #ff806d, #cf3f30);
  font-size: 12px;
  text-transform: lowercase;
}

.content-shell {
  width: min(100%, 1020px);
}

.workflow-nav {
  margin-top: 8px;
  border-color: var(--brand-border);
  background: var(--brand-soft);
}

.guide-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
  padding: 34px;
  border: 1px solid var(--brand-border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 90% 0, color-mix(in srgb, var(--brand) 22%, transparent), transparent 34%),
    linear-gradient(145deg, var(--brand-soft), var(--panel));
}

.guide-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -54px;
  width: 210px;
  height: 210px;
  border: 22px solid color-mix(in srgb, var(--brand) 12%, transparent);
  border-radius: 50%;
}

.hero-kicker,
.workflow-kind {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.guide-hero h2 {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 8px 0 12px;
  font-size: clamp(30px, 5vw, 50px);
  line-height: 1.08;
  letter-spacing: -.045em;
}

.guide-hero > p:not(.hero-kicker) {
  position: relative;
  z-index: 1;
  max-width: 760px;
  color: var(--muted);
}

.hero-stats,
.hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hero-stats span {
  padding: 10px 13px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--muted);
  font-size: 13px;
}

.hero-stats strong {
  color: var(--text);
  font-size: 18px;
}

.hero-actions a,
.primary-action {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--brand-border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--brand);
  font-weight: 750;
  text-decoration: none;
}

.hero-actions .primary-action,
.primary-action {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.learning-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.learning-stage {
  position: relative;
  min-height: 210px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.learning-stage:last-child {
  grid-column: 1 / -1;
}

.stage-number {
  color: var(--brand);
  font: 800 13px/1 var(--mono);
}

.learning-stage h2 {
  margin: 12px 0 9px;
  font-size: 23px;
}

.learning-stage p {
  color: var(--muted);
}

.stage-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.stage-links a {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--brand);
  font-size: 13px;
  text-decoration: none;
}

.source-boundary,
.workflow-intro {
  margin-top: 24px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--background-soft);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 28px;
}

.workflow-card {
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.workflow-card.official-example {
  border-color: var(--brand-border);
  background: linear-gradient(145deg, var(--brand-soft), var(--panel));
}

.workflow-card h3 {
  margin: 10px 0;
  font-size: 17px;
  line-height: 1.45;
}

.workflow-card p {
  margin: 4px 0;
  color: var(--muted);
  font-size: 13px;
}

.workflow-card > a,
.workflow-actions {
  margin-top: auto;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workflow-actions a,
.workflow-card > a {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.workflow-nodes {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.workflow-warning {
  padding: 12px 14px;
  border-left: 4px solid #e5a63b;
  background: color-mix(in srgb, #e5a63b 12%, transparent);
}

.official-mdx figure {
  margin: 22px 0;
}

.official-welcome-intro {
  max-width: 760px;
  margin-bottom: 26px;
}

.welcome-kicker {
  margin: 0;
  color: var(--brand);
  font: 800 12px/1.2 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.official-welcome-intro h2 {
  margin: 10px 0 12px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.04;
  letter-spacing: -.045em;
}

.official-welcome-intro > p:last-child {
  max-width: 700px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.official-welcome-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0;
}

.official-welcome-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: 176px 1fr;
  min-height: 390px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
}

.official-welcome-card::after {
  content: "";
  position: absolute;
  top: 36px;
  right: -18px;
  width: 36px;
  height: 2px;
  background: var(--brand-border);
}

.official-welcome-card:nth-child(2n)::after {
  display: none;
}

.official-welcome-card > img {
  width: 100%;
  height: 176px;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--brand-soft);
  object-fit: cover;
}

.welcome-card-number {
  position: absolute;
  z-index: 1;
  top: 16px;
  left: 16px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid color-mix(in srgb, white 30%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, #141414 78%, transparent);
  color: white;
  font: 800 12px/1 var(--mono);
  box-shadow: 0 8px 24px rgb(0 0 0 / 18%);
}

.welcome-card-body {
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.welcome-card-body h2 {
  margin: 0 0 9px;
  font-size: 22px;
}

.welcome-card-body p {
  margin: 0;
  color: var(--muted);
}

.welcome-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
}

.welcome-card-links a,
.welcome-advanced-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid var(--brand-border);
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.welcome-card-links a:hover,
.welcome-advanced-links a:hover {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand-soft) 72%, var(--panel));
}

.welcome-advanced {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(280px, 1.2fr);
  gap: 22px 36px;
  margin-top: 32px;
  padding: 26px;
  border: 1px solid var(--brand-border);
  border-radius: 16px;
  background:
    linear-gradient(135deg, var(--brand-soft), var(--panel) 68%);
}

.welcome-advanced span {
  color: var(--brand);
  font: 800 12px/1 var(--mono);
  letter-spacing: .08em;
}

.welcome-advanced h2 {
  margin: 9px 0 0;
  font-size: 24px;
}

.welcome-advanced > p {
  margin: 0;
  color: var(--muted);
}

.welcome-advanced-links {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.official-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.official-card {
  display: flex;
  min-height: 148px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}

.official-card:hover {
  border-color: var(--brand-border);
  background: var(--brand-soft);
}

.official-card-copy strong {
  display: block;
  margin-bottom: 8px;
  font-size: 18px;
}

.official-card-copy br {
  display: none;
}

.official-card-action {
  margin-top: auto;
  padding-top: 18px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 750;
}

.official-table-scroll {
  overflow-x: auto;
  margin: 22px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.official-table-scroll .official-html-table {
  min-width: 620px;
  margin: 0;
  border: 0;
}

.official-table-scroll .official-html-table th:first-child,
.official-table-scroll .official-html-table td:first-child {
  border-left: 0;
}

.official-table-scroll .official-html-table th:last-child,
.official-table-scroll .official-html-table td:last-child {
  border-right: 0;
}

.official-table-scroll .official-html-table thead:first-child tr:first-child th {
  border-top: 0;
}

.official-table-scroll .official-html-table tbody:last-child tr:last-child td {
  border-bottom: 0;
}

.official-html-table ul,
.official-html-table ol {
  margin: 0;
  padding-left: 18px;
}

.official-html-table pre {
  min-width: 260px;
  margin: 0;
}

.official-mdx kbd {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--background-soft);
  color: var(--text);
  font: 700 .84em/1.5 var(--mono);
  white-space: nowrap;
}

.official-figure picture {
  display: block;
}

.official-figure picture img {
  margin: 0 auto;
}

.official-mdx figcaption {
  margin-top: 8px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.official-details {
  margin: 22px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background-soft);
}

.official-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 750;
}

.official-mdx img[data-size="line"] {
  display: inline-block;
  width: auto;
  max-height: 28px;
  margin: 0 4px;
  border: 0;
  border-radius: 4px;
  vertical-align: middle;
}

.footnote-ref {
  margin-left: 2px;
  font-size: .72em;
  line-height: 0;
  vertical-align: super;
}

.footnote-ref a,
.footnote-backref {
  color: var(--brand);
  font-weight: 750;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.footnotes {
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.footnotes h2 {
  margin-top: 0;
  color: var(--text);
  font-size: 20px;
}

.footnotes li {
  padding-left: 6px;
}

.footnotes li > div,
.footnotes li p {
  display: inline;
}

.footnote-backref {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: 8px;
}

@media (max-width: 760px) {
  .guide-hero {
    padding: 25px 20px;
  }

  .learning-map,
  .workflow-grid,
  .official-welcome-grid,
  .official-card-grid {
    grid-template-columns: 1fr;
  }

  .learning-stage:last-child {
    grid-column: auto;
  }

  .official-welcome-card {
    min-height: 360px;
  }

  .official-welcome-card::after {
    display: none;
  }

  .welcome-advanced {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .welcome-advanced-links {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .official-welcome-card,
  .official-card {
    transition:
      transform 160ms ease,
      border-color 160ms ease,
      background-color 160ms ease;
  }

  .official-welcome-card:hover {
    transform: translateY(-3px);
    border-color: var(--brand-border);
  }
}
