/* ============================================================================
   tiny_agent — tinyagent.cc
   Direction: "datasheet, in daylight". Component-datasheet typography
   (units set apart, measured values attributed) rendered bright and Material:
   white surfaces on a pale blue ground, one C++ blue ink taken from the
   project icon, soft elevation, no gradients.
   ========================================================================== */

:root {
  /* ink */
  --ink:        #0B2136;
  --ink-2:      #47637C;
  --ink-3:      #7A93A8;

  /* brand, from docs/assets/icon.svg */
  --brand:      #00599C;
  --brand-700:  #003F72;
  --brand-300:  #7FB3DA;
  --brand-100:  #D8E9F6;

  /* measured values */
  --measure:    #00695C;
  --measure-50: #E3F1EF;

  /* surfaces */
  --surface:    #FFFFFF;
  --wash:       #E8F1F9;
  --wash-2:     #F4F9FD;
  --edge:       #D5E4F1;
  --edge-soft:  #E6EFF7;

  /* elevation */
  --e1: 0 1px 2px rgba(11,33,54,.05), 0 2px 8px rgba(11,33,54,.04);
  --e2: 0 1px 2px rgba(11,33,54,.06), 0 10px 28px rgba(11,33,54,.06);
  --e3: 0 2px 4px rgba(11,33,54,.06), 0 18px 46px rgba(11,33,54,.08);

  /* type */
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body:    "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --gut: 28px;
  --radius: 14px;
}

/* ---------------------------------------------------------------- reset -- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--wash-2);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 700; line-height: 1.06; letter-spacing: -0.021em; font-stretch: 112%; }
p { margin: 0 0 1.05em; }
p:last-child { margin-bottom: 0; }
a { color: var(--brand); text-decoration-color: var(--brand-300); text-underline-offset: 3px; }
a:hover { color: var(--brand-700); text-decoration-color: currentColor; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--wash); color: var(--brand-700); padding: 0.1em 0.36em; border-radius: 5px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand); color: #fff; padding: 12px 18px; border-radius: 0 0 10px 0;
  font-weight: 600; text-decoration: none;
}
.skip:focus { left: 0; color: #fff; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--gut); }
.wrap-narrow { max-width: 820px; }

/* --------------------------------------------------------------- topbar -- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(244,249,253,.86);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--edge-soft);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.brand-word { font-family: var(--mono); font-weight: 500; font-size: 16px; letter-spacing: -0.01em; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 26px; }
.nav a {
  font-size: 15px; color: var(--ink-2); text-decoration: none; font-weight: 600;
  padding: 6px 0; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--brand); border-bottom-color: var(--brand-300); }
.nav a.nav-cta {
  background: var(--brand); color: #fff; border-radius: 999px; padding: 9px 20px;
  border-bottom: none; box-shadow: var(--e1);
}
.nav a.nav-cta:hover { background: var(--brand-700); border-bottom: none; }

.navtoggle {
  display: none; margin-left: auto; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--edge); border-radius: 999px;
  padding: 8px 16px; font: 600 14px/1 var(--body); color: var(--ink); cursor: pointer;
}
.navtoggle-bars { display: grid; gap: 4px; }
.navtoggle-bars i { display: block; width: 16px; height: 2px; background: var(--ink); border-radius: 2px; }

/* ----------------------------------------------------------- primitives -- */

.eyebrow {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand);
  margin: 0 0 18px;
}
.h2 { font-size: clamp(1.95rem, 3.6vw, 2.85rem); margin-bottom: 24px; }
.sub { font-family: var(--display); font-size: 1.35rem; font-stretch: 108%; margin: 56px 0 12px; }
.section-lede { color: var(--ink-2); max-width: 62ch; margin-bottom: 30px; }
.note { color: var(--ink-3); font-size: 15px; max-width: 74ch; margin-top: 22px; }
.note code { background: transparent; padding: 0; color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font: 600 16px/1 var(--body); text-decoration: none;
  padding: 15px 26px; border-radius: 999px; transition: background .16s, box-shadow .16s, transform .16s;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--e2); }
.btn-primary:hover { background: var(--brand-700); color: #fff; transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--brand); border: 1px solid var(--edge); box-shadow: var(--e1); }
.btn-ghost:hover { background: #fff; color: var(--brand-700); border-color: var(--brand-300); transform: translateY(-1px); }
.ext { width: 13px; height: 13px; flex: none; }

/* ------------------------------------------------------------------ hero -- */

.hero { padding: 76px 0 0; }
.hero-grid { display: grid; grid-template-columns: 1fr 1.06fr; gap: 52px; align-items: start; }
.hero h1 { font-size: clamp(2.65rem, 4.7vw, 3.85rem); font-stretch: 118%; margin-bottom: 26px; }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 34ch; margin-bottom: 34px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-code { min-width: 0; }
.panel-note { margin-top: 16px; font-size: 14.5px; color: var(--ink-3); }
.panel-note code { background: transparent; padding: 0; color: var(--ink-2); }

/* ----------------------------------------------------------- code panel -- */

.panel {
  background: var(--surface); border: 1px solid var(--edge);
  border-radius: var(--radius); box-shadow: var(--e2); overflow: hidden;
}
.panel-head {
  display: flex; align-items: stretch; gap: 0;
  background: var(--wash); border-bottom: 1px solid var(--edge);
}
.panel-title {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
  padding: 12px 16px; letter-spacing: 0.01em;
}
.tab {
  appearance: none; background: transparent; border: 0; cursor: pointer;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-3);
  padding: 12px 16px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--brand); }
.tab.is-on { color: var(--brand-700); background: var(--surface); border-bottom-color: var(--brand); }
.copy {
  appearance: none; margin-left: auto; align-self: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--edge); color: var(--ink-2);
  font: 500 11.5px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 999px; margin-right: 10px;
}
.copy:hover { border-color: var(--brand-300); color: var(--brand); }
.copy[data-done] { color: var(--measure); border-color: var(--measure); }

.panel-body { overflow-x: auto; }
.panel-body pre { margin: 0; padding: 22px 24px; }
.panel-body code {
  background: none; padding: 0; border-radius: 0; color: var(--ink);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.62; white-space: pre;
}
.panel-body .k { color: var(--brand); font-weight: 500; }
.panel-body .t { color: var(--brand-700); }
.panel-body .f { color: var(--ink); font-weight: 500; }
.panel-body .s { color: var(--measure); }
.panel-body .c { color: var(--ink-3); font-style: italic; }
.panel-body .p { color: var(--ink-2); }

/* ------------------------------------------------------- spec rail (sig) -- */

.rail {
  margin: 74px 0 0; padding: 34px 34px 24px;
  background: var(--surface); border: 1px solid var(--edge);
  border-radius: var(--radius); box-shadow: var(--e1);
}
.rail-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px;
  padding-bottom: 26px; border-bottom: 1px solid var(--edge-soft);
}
.spec { position: relative; padding-left: 16px; }
.spec::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 2px; background: var(--brand-100); border-radius: 2px;
}
.spec:first-child::before { background: var(--brand); }
.spec-key {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px;
}
.spec-val {
  font-family: var(--display); font-stretch: 118%; font-weight: 700;
  font-size: 2.3rem; line-height: 1; letter-spacing: -0.03em; color: var(--ink);
  margin: 0 0 9px;
}
.spec-val .unit {
  font-family: var(--mono); font-weight: 400; font-size: 0.78rem;
  letter-spacing: 0; color: var(--measure); margin-left: 7px; font-stretch: normal;
}
.spec-src { font-size: 13.5px; color: var(--ink-2); margin: 0; line-height: 1.45; }
.rail-foot { margin: 18px 0 0; font-size: 13px; color: var(--ink-3); font-family: var(--mono); }

/* -------------------------------------------------------------- section -- */

.section { padding: 104px 0; }
.section-wash { background: var(--wash); border-block: 1px solid var(--edge-soft); }

/* why edge */
.edge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.edge-lead p { font-size: 1.08rem; color: var(--ink-2); }
.edge-lead p:first-child { color: var(--ink); }
.constraints { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; }
.constraints li {
  padding-left: 22px; border-left: 3px solid var(--brand-100);
  font-size: 15.5px; color: var(--ink-2);
}
.constraints li:first-child { border-left-color: var(--brand); }
.c-key {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink); margin: 0 0 7px;
}

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
  padding: 30px 30px 32px; box-shadow: var(--e1);
  transition: box-shadow .18s, transform .18s;
}
.card:hover { box-shadow: var(--e2); transform: translateY(-2px); }
.card h3 { font-size: 1.22rem; font-stretch: 106%; letter-spacing: -0.012em; margin-bottom: 12px; }
.card p { font-size: 15.5px; color: var(--ink-2); }

.card-lead {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 44px;
  align-items: center; margin-bottom: 22px; padding: 36px 38px;
}
.card-lead:hover { transform: none; box-shadow: var(--e1); }
.card-lead h3 { font-size: 1.5rem; font-stretch: 108%; }
.lead-copy p { font-size: 16px; }

.tree { width: 100%; height: auto; display: block; margin-bottom: 16px; }
.tree-node rect { fill: var(--surface); stroke: var(--brand-300); stroke-width: 1.5; }
.tree-node text { font-family: var(--mono); font-size: 15px; fill: var(--brand-700); }
.tree-model { font-family: var(--mono); font-size: 13px; fill: var(--ink-3); }
.tree-cap { font-size: 13.5px; color: var(--ink-3); line-height: 1.5; }
.tree-cap code { background: transparent; padding: 0; color: var(--ink-2); }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 0; padding: 0; }
.chips li {
  font-family: var(--mono); font-size: 11.5px; color: var(--brand-700);
  background: var(--wash); border: 1px solid var(--edge-soft);
  padding: 4px 10px; border-radius: 999px;
}
.also { margin-top: 30px; color: var(--ink-2); font-size: 15.5px; max-width: 82ch; }
.also code { background: var(--surface); }

/* datasheet tables */
.tablewrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--e1); background: var(--surface); border: 1px solid var(--edge); }
.datasheet { width: 100%; border-collapse: collapse; min-width: 720px; }
.datasheet thead th {
  text-align: left; vertical-align: bottom; padding: 20px 20px 16px;
  font-family: var(--display); font-weight: 700; font-size: 15px; font-stretch: 108%;
  color: var(--ink); border-bottom: 2px solid var(--brand-100); background: var(--wash-2);
}
.datasheet thead th span {
  display: block; font-family: var(--mono); font-weight: 400; font-size: 11px;
  letter-spacing: 0.08em; color: var(--ink-3); margin-top: 5px; font-stretch: normal;
}
.datasheet thead th.col-metric { width: 34%; }
.datasheet tbody th {
  text-align: left; font-weight: 400; font-size: 15px; color: var(--ink-2);
  padding: 16px 20px; border-bottom: 1px solid var(--edge-soft); vertical-align: middle;
}
.datasheet tbody td {
  padding: 16px 20px; border-bottom: 1px solid var(--edge-soft);
  white-space: nowrap; vertical-align: middle;
}
.datasheet tbody tr:last-child th,
.datasheet tbody tr:last-child td { border-bottom: 0; }
.datasheet tbody tr:hover th,
.datasheet tbody tr:hover td { background: var(--wash-2); }
.datasheet b {
  font-family: var(--display); font-stretch: 116%; font-weight: 700;
  font-size: 1.2rem; letter-spacing: -0.02em; color: var(--ink);
}
.datasheet i {
  font-style: normal; font-family: var(--mono); font-size: 11.5px;
  color: var(--measure); margin-left: 5px;
}
.datasheet .na { color: var(--ink-3); font-family: var(--mono); font-size: 12px; }
.datasheet .rate { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.datasheet.micro { min-width: 520px; }
.datasheet.micro tbody th { width: 55%; }

/* quickstart */
.qs-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 52px; align-items: start; }
.qs-copy p { color: var(--ink-2); }
.qs-panels { display: grid; gap: 20px; min-width: 0; }

/* faq */
.qa {
  background: var(--surface); border: 1px solid var(--edge); border-radius: var(--radius);
  margin-bottom: 12px; box-shadow: var(--e1); overflow: hidden;
}
.qa summary {
  cursor: pointer; list-style: none; padding: 20px 56px 20px 24px; position: relative;
  font-family: var(--display); font-weight: 700; font-stretch: 106%; font-size: 1.05rem;
  letter-spacing: -0.01em; color: var(--ink);
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after {
  content: ""; position: absolute; right: 26px; top: 50%;
  width: 9px; height: 9px; margin-top: -6px;
  border-right: 2px solid var(--brand); border-bottom: 2px solid var(--brand);
  transform: rotate(45deg); transition: transform .18s;
}
.qa[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.qa summary:hover { color: var(--brand); }
.qa-body { padding: 0 24px 24px; color: var(--ink-2); font-size: 15.5px; border-top: 1px solid var(--edge-soft); padding-top: 18px; }
.faq-more { margin-top: 26px; color: var(--ink-3); font-size: 15px; }

/* -------------------------------------------------------------- footer -- */

.footer { background: var(--surface); border-top: 1px solid var(--edge); padding: 62px 0 74px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 44px; }
.footer-word { font-family: var(--mono); font-weight: 500; font-size: 17px; margin: 0 0 10px; color: var(--ink); }
.footer-tag { color: var(--ink-2); margin: 0 0 16px; max-width: 34ch; }
.footer-license { font-size: 14px; color: var(--ink-3); margin: 0; }
.footer-nav { display: flex; flex-direction: column; gap: 9px; }
.footer-head {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 4px;
}
.footer-nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; }
.footer-nav a:hover { color: var(--brand); text-decoration: underline; }

/* --------------------------------------------------------------- motion -- */

.rise { opacity: 0; transform: translateY(10px); animation: rise .6s cubic-bezier(.2,.7,.3,1) forwards; }
.rise[data-rise="1"] { animation-delay: .04s; }
.rise[data-rise="2"] { animation-delay: .12s; }
.rise[data-rise="3"] { animation-delay: .2s; }
.rise[data-rise="4"] { animation-delay: .28s; }
@keyframes rise { to { opacity: 1; transform: none; } }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s cubic-bezier(.2,.7,.3,1); }
.reveal.is-in { opacity: 1; transform: none; }

/* ----------------------------------------------------------- responsive -- */

@media (max-width: 1040px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --gut: 22px; }
  html { scroll-padding-top: 76px; }
  .hero { padding-top: 52px; }
  .hero-grid, .edge-grid, .qs-grid { grid-template-columns: 1fr; gap: 40px; }
  .lede { max-width: none; }
  .rail { margin-top: 52px; padding: 26px 24px 20px; }
  .rail-row { grid-template-columns: repeat(2, 1fr); gap: 26px; }
  .section { padding: 76px 0; }
  .card-lead { grid-template-columns: 1fr; gap: 28px; padding: 28px 26px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: span 2; }

  .navtoggle { display: inline-flex; }
  .nav {
    position: absolute; left: 0; right: 0; top: 68px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--edge);
    box-shadow: var(--e2); padding: 8px var(--gut) 18px; display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 13px 0; border-bottom: 1px solid var(--edge-soft); }
  .nav a:hover { border-bottom-color: var(--edge-soft); }
  .nav a.nav-cta { text-align: center; margin-top: 14px; padding: 13px 20px; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .cards, .rail-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand { grid-column: auto; }
  .panel-body pre { padding: 18px 16px; }
  .panel-body code { font-size: 12px; }
  .tab { padding: 11px 12px; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .rise { opacity: 1; transform: none; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .topbar, .navtoggle, .copy { display: none; }
  body { background: #fff; }
}

@media print {
  .reveal { opacity: 1; transform: none; }
}
