/* byte-design.css -- the one look for all byte apps (taken from SystemConcepts: warm parchment, serif reading text,
   system-ui chrome, 9-10px radii, 1px hairlines, one copper accent). Version 1.1 (contrast-checked: text pairs >= 4.5:1 in light and dark; solid focus ring).
   Canonical copy: orfleet-azure/design/byte-design.css. Apps carry a COPY (they deploy alone); change it here, then re-copy.
   Adopt by (1) including this file first, (2) mapping the app's own variables onto the --byte-* tokens, (3) using the
   .byte-* components for anything new. Nothing here styles bare elements except the reset block, so it cannot fight an app. */

/* ---------- tokens (light) ---------- */
:root{
  --byte-bg:#faf8f3;      /* page */
  --byte-fg:#2b2721;      /* body text */
  --byte-muted:#6b6050;   /* secondary text */
  --byte-head:#5b4636;    /* headings, active nav */
  --byte-link:#9a5f2b;
  --byte-border:#e6ddcd;  /* hairlines */
  --byte-card:#fffdf8;    /* raised surface */
  --byte-bar:#f3eee3;     /* sidebar, top bar, table heads */
  --byte-accent:#8f5f2e;  /* the one accent (5.4:1 under --byte-on-accent) */
  --byte-pill:#efe7d7;    /* chips, code, quiet buttons */
  --byte-done:#1f7340;    /* success */
  --byte-warn:#98560f;
  --byte-danger:#b3402f;
  --byte-on-accent:#fffdf8;

  --byte-font-read:Georgia,'Iowan Old Style','Palatino Linotype',serif;           /* long-form reading text */
  --byte-font-ui:system-ui,-apple-system,'Segoe UI',sans-serif;                    /* chrome, controls, tables */
  --byte-font-mono:ui-monospace,'Cascadia Code',Consolas,monospace;

  --byte-radius-s:6px; --byte-radius:9px; --byte-radius-l:12px; --byte-radius-pill:20px;
  --byte-space-1:4px; --byte-space-2:8px; --byte-space-3:12px; --byte-space-4:16px; --byte-space-5:24px; --byte-space-6:36px;
  --byte-bar-h:56px; --byte-sidebar-w:230px; --byte-touch:44px;
  --byte-shadow:0 1px 2px rgba(60,40,20,.06),0 4px 14px rgba(60,40,20,.06);
  --byte-focus:0 0 0 2px var(--byte-bg),0 0 0 4px var(--byte-accent);
}
/* ---------- tokens (dark): explicit choice wins, otherwise follow the system ---------- */
:root[data-theme=dark]{
  --byte-bg:#17140f; --byte-fg:#e7e0d2; --byte-muted:#9a9080; --byte-head:#d9bd94; --byte-link:#d6a86a;
  --byte-border:#332e25; --byte-card:#201c15; --byte-bar:#1d1a13; --byte-accent:#caa06a; --byte-pill:#2a251c;
  --byte-done:#6fcf8f; --byte-warn:#e0a04e; --byte-danger:#ef7f6c; --byte-on-accent:#17140f;
  --byte-shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.35); --byte-focus:0 0 0 2px var(--byte-bg),0 0 0 4px var(--byte-accent);
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme=light]){
    --byte-bg:#17140f; --byte-fg:#e7e0d2; --byte-muted:#9a9080; --byte-head:#d9bd94; --byte-link:#d6a86a;
    --byte-border:#332e25; --byte-card:#201c15; --byte-bar:#1d1a13; --byte-accent:#caa06a; --byte-pill:#2a251c;
    --byte-done:#6fcf8f; --byte-warn:#e0a04e; --byte-danger:#ef7f6c; --byte-on-accent:#17140f;
    --byte-shadow:0 1px 2px rgba(0,0,0,.4),0 4px 14px rgba(0,0,0,.35); --byte-focus:0 0 0 2px var(--byte-bg),0 0 0 4px var(--byte-accent);
  }
}

/* ---------- reset (the only bare-element rules) ---------- */
*,*::before,*::after{box-sizing:border-box}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*{transition:none!important;animation:none!important}}

/* ---------- page + text ---------- */
.byte-page{margin:0;background:var(--byte-bg);color:var(--byte-fg);font:16px/1.6 var(--byte-font-ui)}
.byte-read{font:17px/1.7 var(--byte-font-read)}                       /* long-form text: put on the article/column */
.byte-wrap{max-width:820px;margin:0 auto;padding:0 22px}
.byte-h1{font:700 30px/1.25 var(--byte-font-ui);color:var(--byte-head);margin:.2em 0 .5em}
.byte-h2{font:700 22px/1.3 var(--byte-font-ui);color:var(--byte-head);margin:1.5em 0 .5em;padding-bottom:.2em;border-bottom:1px solid var(--byte-border)}
.byte-h3{font:600 18px/1.35 var(--byte-font-ui);color:var(--byte-head);margin:1.3em 0 .4em}
.byte-muted{color:var(--byte-muted)}
.byte-link{color:var(--byte-link);text-decoration:none;border-bottom:1px solid transparent}
.byte-link:hover{border-bottom-color:var(--byte-link)}
.byte-code{font-family:var(--byte-font-mono);font-size:.9em;background:var(--byte-pill);padding:.1em .4em;border-radius:5px}

/* ---------- shell: sidebar + top bar + drawer on small screens ---------- */
.byte-shell{display:flex;align-items:stretch;min-height:100vh}
.byte-sidebar{flex:none;width:var(--byte-sidebar-w);background:var(--byte-bar);border-right:1px solid var(--byte-border);
  display:flex;flex-direction:column;position:sticky;top:0;height:100vh;overflow-y:auto;font-family:var(--byte-font-ui)}
.byte-brand{display:flex;align-items:center;gap:10px;padding:20px 18px 12px;font-weight:700;color:var(--byte-head);
  text-decoration:none;font-size:15px;letter-spacing:.02em}
.byte-brand .dot{width:10px;height:10px;border-radius:3px;background:var(--byte-accent);flex:none}
.byte-nav{display:flex;flex-direction:column;gap:2px;padding:6px 10px}
.byte-nav-link{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:var(--byte-radius);color:var(--byte-muted);
  text-decoration:none;font-size:14px}
.byte-nav-link:hover{color:var(--byte-fg);background:var(--byte-card)}
.byte-nav-link.active,.byte-nav-link[aria-current=page]{color:var(--byte-head);background:var(--byte-card);font-weight:600}
.byte-overlay{display:none}
.byte-main{flex:1;min-width:0;display:flex;flex-direction:column}
.byte-topbar{position:sticky;top:0;z-index:20;background:var(--byte-bar);border-bottom:1px solid var(--byte-border);
  display:flex;align-items:center;gap:12px;height:var(--byte-bar-h);padding:0 16px;font-family:var(--byte-font-ui)}
.byte-topbar .grow{flex:1}
.byte-menu-btn{display:none}
@media (max-width:768px){
  .byte-sidebar{position:fixed;top:0;left:0;bottom:0;height:100vh;width:250px;z-index:30;transform:translateX(-100%);transition:transform .25s ease}
  .byte-sidebar.open{transform:translateX(0);box-shadow:4px 0 24px rgba(0,0,0,.35)}
  .byte-overlay.open{display:block;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:25}
  .byte-menu-btn{display:inline-flex;align-items:center;justify-content:center}
  .byte-topbar{padding:0 12px}
  .byte-nav-link{min-height:var(--byte-touch);padding:13px 12px}
}

/* ---------- controls ---------- */
.byte-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;font:600 14px/1.2 var(--byte-font-ui);
  min-height:36px;padding:8px 14px;border-radius:var(--byte-radius);border:1px solid var(--byte-border);
  background:var(--byte-pill);color:var(--byte-head);cursor:pointer;text-decoration:none}
.byte-btn:hover{border-color:var(--byte-accent)}
.byte-btn:focus-visible,.byte-input:focus-visible,.byte-nav-link:focus-visible,.byte-link:focus-visible{outline:none;box-shadow:var(--byte-focus)}
.byte-btn.primary{background:var(--byte-accent);border-color:var(--byte-accent);color:var(--byte-on-accent)}
.byte-btn.primary:hover{filter:brightness(1.07)}
.byte-btn.ghost{background:transparent}
.byte-btn.danger{color:var(--byte-danger);border-color:var(--byte-danger);background:transparent}
.byte-btn[disabled],.byte-btn[aria-disabled=true]{opacity:.5;cursor:not-allowed}
.byte-icon-btn{width:34px;height:34px;min-width:34px;padding:0;font-size:16px;background:none;color:var(--byte-fg)}
.byte-icon-btn:hover{background:var(--byte-card)}
@media (max-width:768px){.byte-btn,.byte-icon-btn{min-height:var(--byte-touch);min-width:var(--byte-touch)}}
.byte-input{width:100%;font:15px/1.4 var(--byte-font-ui);padding:9px 12px;border-radius:var(--byte-radius);
  border:1px solid var(--byte-border);background:var(--byte-card);color:var(--byte-fg)}
.byte-input::placeholder{color:var(--byte-muted)}
.byte-input:focus{border-color:var(--byte-accent)}
.byte-label{display:block;font:600 13px/1.3 var(--byte-font-ui);color:var(--byte-muted);margin:0 0 4px}

/* ---------- surfaces ---------- */
.byte-card{background:var(--byte-card);border:1px solid var(--byte-border);border-radius:var(--byte-radius-l);padding:var(--byte-space-4)}
.byte-card.raised{box-shadow:var(--byte-shadow)}
.byte-pill{display:inline-flex;align-items:center;font:12px/1.5 var(--byte-font-ui);background:var(--byte-pill);color:var(--byte-muted);
  border:1px solid var(--byte-border);border-radius:var(--byte-radius-pill);padding:1px 10px}
.byte-pill.done{color:var(--byte-done);border-color:var(--byte-done);background:transparent;font-weight:600}
.byte-notice{border:1px solid var(--byte-border);border-left:3px solid var(--byte-accent);background:var(--byte-card);
  border-radius:var(--byte-radius);padding:10px 14px;color:var(--byte-fg)}
.byte-notice.error{border-left-color:var(--byte-danger)}
.byte-quote{margin:1em 0;padding:.4em 1em;border-left:3px solid var(--byte-accent);color:var(--byte-muted)}
.byte-rule{border:0;border-top:1px solid var(--byte-border);margin:2em 0}

/* ---------- tables: cells size to their content (no word wrap inside a word), the table scrolls sideways if needed ---------- */
.byte-table-wrap{overflow-x:auto;max-width:100%}
.byte-table{border-collapse:collapse;font:14px/1.45 var(--byte-font-ui);width:max-content;min-width:100%}
.byte-table th,.byte-table td{border:1px solid var(--byte-border);padding:6px 10px;text-align:left;vertical-align:top;min-width:min-content}
.byte-table th{background:var(--byte-bar);color:var(--byte-head);font-weight:600}

footer.byte-footer,.byte-footer{border-top:1px solid var(--byte-border);margin-top:40px;color:var(--byte-muted);font:14px/1.5 var(--byte-font-ui);padding:18px 0}

/* keyboard focus must stay visible when box-shadow is dropped (Windows high contrast / forced colors) */
@media (forced-colors:active){:focus-visible{outline:2px solid CanvasText;outline-offset:2px}}
