/* Omoya site stylesheet. Two deliberate palettes share one token set;
   html[data-theme] is set before first paint by the inline bootstrap. */
:root {
  --ink: #12202d;
  --paper: #f4f0e8;
  --panel: #fffdf7;
  --line: #c9c0af;
  --orange: #d64a17;
  --blue: #167aa1;
  --dark: #152936;
  --code-inline: #e4ded0;
  --shadow: 5px 5px 0 var(--ink);
  --focus: #b53a0e;
  color-scheme: light;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
html[data-theme="dark"] {
  --ink: #e8e2d4;
  --paper: #131a20;
  --panel: #1b252d;
  --line: #3a4a55;
  --orange: #f07a4a;
  --blue: #63b8d8;
  --dark: #0c1218;
  --code-inline: #2a3844;
  --shadow: 5px 5px 0 #000;
  --focus: #ff9a6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); line-height: 1.6; transition: background-color .15s ease, color .15s ease; }
a { color: var(--blue); text-decoration-thickness: 2px; text-underline-offset: .18em; }
a:hover { color: var(--orange); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; top: -4rem; left: 1rem; z-index: 30; padding: .5rem 1rem;
  color: #fff; background: var(--orange); font-weight: 800; transition: top .15s ease;
}
html[data-theme="dark"] .skip-link { color: #131a20; }
.skip-link:focus { top: .5rem; }

/* ------------------------------------------------------------ header */
.site-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: .75rem 1.5rem; max-width: 78rem; margin: auto; padding: 1.25rem 1.5rem;
  border-bottom: 3px solid var(--ink);
}
.brand { color: var(--ink); font-size: 1.45rem; font-weight: 800; letter-spacing: -.08em; text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: 1.1rem; }
.site-nav a[aria-current="page"] { color: var(--orange); font-weight: 800; }
.nav-note { color: var(--ink); opacity: .55; font-size: .85rem; cursor: help; }
.header-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }

/* theme control: one segmented light/dark/system control */
.theme-control {
  display: inline-flex; margin: 0; padding: 0; border: 2px solid var(--ink);
  background: var(--panel);
}
.theme-control button {
  padding: .3rem .6rem; border: 0; border-right: 1px solid var(--line);
  color: var(--ink); background: transparent; font: inherit; font-size: .78rem;
  font-weight: 700; cursor: pointer;
}
.theme-control button:last-of-type { border-right: 0; }
.theme-control button:hover { background: var(--code-inline); }
.theme-control button[aria-pressed="true"] { color: #fff; background: var(--orange); }
html[data-theme="dark"] .theme-control button[aria-pressed="true"] { color: #131a20; }

/* search */
.site-search { position: relative; }
#search-input {
  width: min(16rem, 42vw); padding: .35rem .6rem; color: var(--ink);
  background: var(--panel); border: 2px solid var(--ink); font: inherit; font-size: .85rem;
}
#search-input::placeholder { color: var(--ink); opacity: .5; }
.search-results {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  width: min(24rem, 90vw); margin: 0; padding: .25rem; list-style: none;
  background: var(--panel); border: 2px solid var(--ink); box-shadow: var(--shadow);
}
.search-results a {
  display: flex; flex-direction: column; gap: .1rem; padding: .45rem .6rem;
  color: var(--ink); text-decoration: none;
}
.search-results a:hover, .search-results a.active { background: var(--code-inline); }
.result-title { font-weight: 800; }
.result-section { font-size: .75rem; opacity: .6; }
.search-empty { margin: 0; padding: .45rem .6rem; font-size: .85rem; opacity: .7; }

/* ------------------------------------------------------------ layout */
main { max-width: 78rem; margin: auto; padding: 3rem 1.5rem 5rem; }
.with-sidebar {
  display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 2.5rem;
  max-width: 78rem; margin: auto; padding: 2.5rem 1.5rem 5rem;
}
.with-sidebar main { max-width: none; margin: 0; padding: 0; min-width: 0; }
.api-nav { position: sticky; top: 1.25rem; align-self: start; }
.api-nav-title { margin: 0 0 .6rem; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--orange); }
.api-nav ul { margin: 0; padding: 0; list-style: none; }
.api-nav li { margin: 0; }
.api-nav a {
  display: block; padding: .3rem .6rem; color: var(--ink); text-decoration: none;
  border-left: 3px solid transparent; font-size: .9rem;
}
.api-nav a:hover { color: var(--orange); border-left-color: var(--line); }
.api-nav a[aria-current="page"] { color: var(--orange); font-weight: 800; border-left-color: var(--orange); }

/* ------------------------------------------------------------ content */
.hero { max-width: 52rem; padding: 2rem 0 4rem; }
.eyebrow { color: var(--orange); font-size: .8rem; font-weight: 800; letter-spacing: .12em; }
h1 { max-width: 14ch; margin: .2rem 0 1rem; font-size: clamp(2.8rem, 9vw, 6.5rem); line-height: .94; letter-spacing: -.09em; }
h2 { margin-top: 2.5rem; line-height: 1.1; }
h3 { margin-top: 2rem; }
.lede { max-width: 47rem; font-size: clamp(1.1rem, 2vw, 1.4rem); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem; margin: 2rem 0; }
.button {
  display: inline-block; padding: .65rem 1rem; color: #fff; background: var(--orange);
  border: 2px solid var(--ink); box-shadow: var(--shadow); font-weight: 800; text-decoration: none;
}
html[data-theme="dark"] .button { color: #131a20; }
.button:hover { color: #fff; background: var(--blue); box-shadow: 2px 2px 0 var(--ink); transform: translate(3px, 3px); }
html[data-theme="dark"] .button:hover { color: #131a20; }
.text-link { font-weight: 800; }
pre { overflow-x: auto; padding: 1.25rem; color: #e6f5ee; background: var(--dark); border: 2px solid var(--ink); box-shadow: var(--shadow); }
code { font-family: inherit; }
p code, li code, dd code, td code { padding: .08rem .25rem; background: var(--code-inline); border: 1px solid var(--line); }
pre code { padding: 0; background: none; border: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.25rem; }
.grid article { padding: 1.25rem; background: var(--panel); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--line); }
.grid h3 { margin-top: 0; }
.features article pre { box-shadow: none; font-size: .82rem; }

/* ------------------------------------------------------------ docs */
.documentation { max-width: 62rem; }
.documentation h1 { max-width: none; font-size: clamp(2.5rem, 6vw, 4.5rem); }
.documentation h2 { padding-top: 1rem; border-top: 2px solid var(--line); }
.documentation pre { box-shadow: none; }
.symbol { margin: 1.5rem 0; padding: 1rem 1.25rem; background: var(--panel); border: 2px solid var(--ink); }
.symbol.member { margin-left: 1.5rem; border-style: dashed; }
.symbol h3, .symbol h4 { margin-top: 0; overflow-wrap: anywhere; }
.kind, .flag {
  padding: .1rem .4rem; font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--paper); background: var(--blue); border-radius: 2px;
}
.flag { background: var(--orange); }
.type { font-size: .8rem; opacity: .65; }
.params { display: grid; grid-template-columns: max-content 1fr; gap: .15rem 1rem; margin: .5rem 0; }
.params dt { font-weight: 700; }
.params dd { margin: 0; }
.returns, .from, .helper, .label { font-size: .9rem; opacity: .85; }
.contract-source { margin: 1rem 0 1.5rem; padding-left: 1rem; border-left: 3px solid var(--line); }
.contract-source h4 { margin-bottom: .25rem; }
.typedef { margin: .75rem 0; }
ul.compact li { margin: .2rem 0; }
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }
th, td { padding: .45rem .6rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--code-inline); }
details summary { cursor: pointer; font-weight: 700; }
blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 3px solid var(--orange); }

/* ------------------------------------------------------------ footer */
.site-footer { max-width: 78rem; margin: auto; padding: 1.5rem; border-top: 3px solid var(--ink); font-size: .85rem; }

@media (max-width: 56rem) {
  .with-sidebar { display: block; }
  .api-nav { position: static; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 2px solid var(--line); }
  .api-nav ul { display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
  .api-nav a { border-left: 0; border-bottom: 3px solid transparent; }
  .api-nav a[aria-current="page"] { border-bottom-color: var(--orange); }
}
@media (max-width: 38rem) {
  .site-header { padding: 1rem; }
  main, .with-sidebar { padding: 2rem 1rem 3rem; }
  h1 { letter-spacing: -.07em; }
  #search-input { width: 100%; }
  .site-search { flex: 1 1 100%; order: 3; }
}
