/* Oyster Widget Docs - static, hostable */
:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #0f1733;
  --panel-2: #111c3d;
  --text: #e9ecf5;
  --muted: #aab3d0;
  --border: rgba(255, 255, 255, 0.10);
  --shadow: rgba(0, 0, 0, 0.40);
  --accent: #7c3aed;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --code-bg: rgba(0, 0, 0, 0.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.topbar {
  display: none;
}

.nav-overlay {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 18px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 10px 30px var(--shadow);
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-title { font-weight: 700; line-height: 1.1; }
.brand-subtitle { color: var(--muted); font-size: 12px; margin-top: 2px; }

.nav {
  margin-top: 16px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
}
.nav a {
  display: block;
  padding: 10px 10px;
  border-radius: 10px;
  color: var(--muted);
}
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.05); text-decoration: none; }
.nav .group {
  margin: 10px 0 6px;
  padding: 0 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}

.content {
  padding: 28px 28px 60px;
  overflow: auto;
}

.page-title {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}
.page-kicker {
  margin-top: 8px;
  color: var(--muted);
  max-width: 900px;
}

.grid {
  display: grid;
  gap: 14px;
}

.cards {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 14px 14px;
}
.card h3 { margin: 0 0 6px; font-size: 14px; }
.card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.section {
  margin-top: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}

/* Allow sticky snippet to work inside the playground section.
   (Sticky breaks if any ancestor has overflow != visible.) */
#playground.section {
  overflow: visible;
}
.section-header {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
}
.section-header h2 { margin: 0; font-size: 16px; }
.section-header .hint { color: var(--muted); font-size: 12px; }
.section-body { padding: 14px 14px; }
.section-body h3 { margin: 18px 0 8px; font-size: 14px; }
.section-body p { margin: 8px 0; color: rgba(233,236,245,0.92); line-height: 1.55; }
.section-body ul { margin: 8px 0 8px 18px; color: rgba(233,236,245,0.92); }
.section-body li { margin: 6px 0; }
.muted { color: var(--muted); }

.codewrap { position: relative; }
pre {
  margin: 10px 0 0;
  padding: 12px 12px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  background: var(--code-bg);
  overflow: auto;
}
code {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: rgba(255,255,255,0.92);
}
.copybtn {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 10px;
  cursor: pointer;
}
.copybtn:hover { background: rgba(255,255,255,0.10); }
.copybtn:active { transform: translateY(1px); }
.copybtn.ok { border-color: rgba(34,197,94,0.50); }

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.playground-layout {
  /* Use flex for reliable sticky behavior across browsers */
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.playground-left {
  flex: 1 1 0%;
  min-width: 0;
}

.playground-right {
  flex: 0 0 420px;
  max-width: 520px;
  min-width: 320px;
}

.playground-right .codewrap {
  margin-top: 0;
}

.codewrap-sticky {
  position: sticky;
  top: 20px;
  align-self: flex-start;
}
.field {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  background: rgba(0,0,0,0.20);
  padding: 10px 10px;
}
.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.62);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  outline: none;
  font-family: var(--sans);
}
.field select {
  /* Improve contrast/consistency for native selects */
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23E9ECF5' d='M5.6 7.4a1 1 0 0 1 1.4 0L10 10.4l3-3a1 1 0 1 1 1.4 1.4l-3.7 3.7a1 1 0 0 1-1.4 0L5.6 8.8a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px 18px;
}
.field textarea { min-height: 96px; resize: vertical; font-family: var(--mono); font-size: 12px; }
.field input::placeholder, .field textarea::placeholder { color: rgba(255,255,255,0.40); }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.span2 { grid-column: span 2; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.btn {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: rgba(255,255,255,0.10); }
.btn:active { transform: translateY(1px); }
.btn.primary { border-color: rgba(124,58,237,0.55); background: rgba(124,58,237,0.18); }
.btn.success { border-color: rgba(34,197,94,0.55); background: rgba(34,197,94,0.16); }
.btn.danger { border-color: rgba(239,68,68,0.55); background: rgba(239,68,68,0.14); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.status {
  margin-top: 10px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.18);
  color: rgba(233,236,245,0.92);
  font-size: 13px;
}
.status.ok { border-color: rgba(34,197,94,0.45); }
.status.warn { border-color: rgba(245,158,11,0.45); }
.status.err { border-color: rgba(239,68,68,0.45); }

.log {
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  overflow: hidden;
}
.log header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.84);
  font-size: 12px;
}
.log pre { margin: 0; border: 0; border-radius: 0; max-height: 260px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.92);
  font-size: 12px;
}
.pill strong { font-weight: 700; }

.kbd {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.20);
  color: rgba(255,255,255,0.85);
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 60;
    margin: -10px -10px 14px;
    padding: 10px 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(15, 23, 51, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .topbar-title {
    font-weight: 700;
    color: rgba(233,236,245,0.92);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
    z-index: 90;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    max-width: 86vw;
    height: 100vh;
    overflow: auto;
    transform: translateX(-110%);
    transition: transform 200ms ease;
    z-index: 100;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent), var(--bg);
  }

  .nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .cards { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .playground-layout { display: block; }
  .codewrap-sticky { position: static; }
  .span2 { grid-column: auto; }
}
