/* Ototo API Docs — shared stylesheet */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f6f8fa;
  --color-sidebar-bg: #f6f8fa;
  --color-text: #1b1f24;
  --color-text-muted: #59636e;
  --color-border: #d8dee4;
  --color-accent: #1a56db;
  --color-accent-hover: #143f9e;
  --color-accent-soft: #e8f0fe;
  --color-code-bg: #f6f8fa;
  --color-code-border: #e3e8ee;
  --color-warn-bg: #fff8e6;
  --color-warn-border: #f2c94c;
  --color-note-bg: #eef6ff;
  --color-note-border: #8fbcf5;
  --color-danger-bg: #fdeeee;
  --color-danger-border: #e57373;
  --get: #1a56db;
  --get-bg: #e8f0fe;
  --post: #1a7f37;
  --post-bg: #e6f4ea;
  --put: #9a5b00;
  --put-bg: #fff1de;
  --shadow-sm: 0 1px 2px rgba(27, 31, 36, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0d1117;
    --color-bg-alt: #11161d;
    --color-sidebar-bg: #10151c;
    --color-text: #e6edf3;
    --color-text-muted: #9aa7b2;
    --color-border: #2a323c;
    --color-accent: #6ea8fe;
    --color-accent-hover: #93bffe;
    --color-accent-soft: #142544;
    --color-code-bg: #11161d;
    --color-code-border: #232b34;
    --color-warn-bg: #2b2410;
    --color-warn-border: #7a5f10;
    --color-note-bg: #101f33;
    --color-note-border: #2f5d95;
    --color-danger-bg: #2a1414;
    --color-danger-border: #7a3a3a;
    --get: #6ea8fe;
    --get-bg: #142544;
    --post: #4fce77;
    --post-bg: #12281a;
    --put: #e3a44b;
    --put-bg: #2c2210;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  font-size: 16px;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* ---------- Layout ---------- */

.site {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  padding: 1.25rem 1rem 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  padding: 0.25rem 0.5rem 1rem;
  text-decoration: none;
}

.sidebar-brand:hover {
  text-decoration: none;
  color: var(--color-text);
}

.sidebar-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sidebar-section {
  margin-top: 1.1rem;
}

.sidebar-heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: 0 0.5rem 0.35rem;
  font-weight: 600;
}

.sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar nav a {
  display: block;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.92rem;
}

.sidebar nav a:hover {
  background: var(--color-accent-soft);
  text-decoration: none;
}

.sidebar nav a.active {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: 600;
}

.sidebar nav ul ul {
  margin-left: 0.6rem;
  border-left: 1px solid var(--color-border);
  padding-left: 0.5rem;
}

.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
}

.content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

main {
  width: 100%;
  max-width: 800px;
  padding: 2.5rem 2rem 6rem;
}

.topbar {
  display: none;
}

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 650;
  scroll-margin-top: 1.5rem;
}

h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.4rem;
  margin: 2.5rem 0 1rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--color-border);
}

h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

h3 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.75rem;
}

h4 {
  font-size: 0.95rem;
  margin: 1.25rem 0 0.5rem;
}

p {
  margin: 0.75rem 0;
}

.lede {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

.eyebrow {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

ul, ol {
  padding-left: 1.4rem;
}

li {
  margin: 0.3rem 0;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}

.muted {
  color: var(--color-text-muted);
}

/* ---------- Code ---------- */

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  border: 1px solid var(--color-code-border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--color-code-bg);
  border: 1px solid var(--color-code-border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
  margin: 1rem 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 1em;
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 1rem 0 -0.6rem;
  display: block;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  vertical-align: top;
}

th {
  background: var(--color-bg-alt);
  font-weight: 650;
  white-space: nowrap;
}

td code {
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--color-bg-alt) 45%, transparent);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.badge-get   { color: var(--get);  background: var(--get-bg); }
.badge-post  { color: var(--post); background: var(--post-bg); }
.badge-put   { color: var(--put);  background: var(--put-bg); }

.req {
  color: var(--post);
  font-weight: 700;
  font-size: 0.82em;
}

.opt {
  color: var(--color-text-muted);
  font-size: 0.82em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* endpoint heading strip */
.endpoint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.endpoint code {
  background: none;
  border: none;
  padding: 0;
  font-size: 1em;
}

/* ---------- Callouts ---------- */

.callout {
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  border: 1px solid var(--color-note-border);
  background: var(--color-note-bg);
}

.callout p:first-child {
  margin-top: 0;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
  display: block;
}

.callout.warn {
  border-color: var(--color-warn-border);
  background: var(--color-warn-bg);
}

.callout.danger {
  border-color: var(--color-danger-border);
  background: var(--color-danger-bg);
}

/* ---------- Cards (home page) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--color-accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--color-text);
}

.card p {
  margin: 0;
  font-size: 0.87rem;
  color: var(--color-text-muted);
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.env-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  background: var(--color-bg-alt);
}

.env-card h4 {
  margin: 0 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.env-card code {
  display: block;
  margin-top: 0.4rem;
  word-break: break-all;
  white-space: normal;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-green { background: var(--post); }
.dot-amber { background: var(--put); }

/* ---------- Footer / prev-next ---------- */

.page-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.see-also {
  margin: 1rem 0;
  padding-left: 1.4rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .topbar .sidebar-brand {
    padding: 0;
  }

  .nav-toggle-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--color-text);
    background: var(--color-bg);
  }

  .site {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    inset: 0;
    top: 57px;
    height: calc(100vh - 57px);
    z-index: 15;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    width: 100%;
    max-width: 320px;
  }

  .nav-toggle:checked ~ .site .sidebar {
    transform: translateX(0) !important;
    box-shadow: var(--shadow-sm);
  }

  main {
    padding: 1.75rem 1.25rem 4rem;
  }
}

@media (min-width: 901px) {
  .sidebar {
    display: block !important;
  }
}
