/* =========================
   Root / Base (Tellio Navy)
========================= */
:root{
  --bg: #f4f6fa;
  --card: #ffffff;

  --primary: #1e3a8a;       /* navy */
  --primary-dark: #172554;
  --primary-soft: #e0e7ff;

  --accent: #38bdf8;        /* sky */
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #f59e0b;

  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;

  --radius: 14px;
  --shadow: 0 10px 28px rgba(15,23,42,.08);
  --shadow2: 0 16px 44px rgba(15,23,42,.10);

  --sidebar-w: 280px;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin:0;
  font-family: "Noto Sans JP", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
}

/* Dark-ish mode via data-theme */
:root[data-theme="dark"]{
  --bg: #0b1220;
  --card: rgba(255,255,255,.06);
  --text: #e5e7eb;
  --muted: #9aa6bd;
  --border: rgba(148,163,184,.22);
  --shadow: 0 12px 34px rgba(0,0,0,.35);
  --shadow2: 0 18px 50px rgba(0,0,0,.42);
  --primary-soft: rgba(30,58,138,.22);
}

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

.muted{ color: var(--muted); }
.small{ font-size: .92rem; }
.lead{ font-size: 1.02rem; }
.sep{ color: var(--muted); padding: 0 .35rem; }

/* =========================
   Layout
========================= */
.layout{
  display: flex;
  min-height: 100vh;
}

/* =========================
   Sidebar
========================= */
.sidebar{
  width: var(--sidebar-w);
  background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.52));
  border-right: 1px solid rgba(148,163,184,.22);
  backdrop-filter: blur(10px);
  padding: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

:root[data-theme="dark"] .sidebar{
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.05));
}

.brand{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: .75rem;
  padding: .4rem .35rem .8rem;
}

.brandLink{
  display:flex;
  align-items:center;
  gap: .6rem;
}

.brandDot{
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--primary));
  box-shadow: 0 0 0 4px rgba(56,189,248,.18);
}

.brandText{
  font-weight: 800;
  letter-spacing: .02em;
}

.sidebarMeta{
  display:flex;
  flex-wrap: wrap;
  gap: .45rem;
  padding: .6rem .35rem 1rem;
  border-bottom: 1px solid rgba(148,163,184,.22);
}

.pill{
  display:inline-flex;
  align-items:center;
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.26);
  background: rgba(255,255,255,.65);
  font-size: .86rem;
}

:root[data-theme="dark"] .pill{
  background: rgba(255,255,255,.06);
}

.sideNav{
  margin-top: 1rem;
  display:flex;
  flex-direction: column;
  gap: .25rem;
}

.sideLink{
  padding: .55rem .65rem;
  border-radius: 12px;
  color: rgba(15,23,42,.88);
  border: 1px solid transparent;
}

:root[data-theme="dark"] .sideLink{
  color: rgba(229,231,235,.92);
}

.sideLink:hover{
  background: var(--primary-soft);
  border-color: rgba(30,58,138,.18);
  text-decoration: none;
}

.sideLink.is-active{
  background: var(--primary-soft);
  border-color: rgba(56,189,248,.35);
  box-shadow: 0 8px 20px rgba(30,58,138,.12);
}

.sidebarFooter{
  margin-top: 1rem;
  padding: .9rem .35rem 0;
  border-top: 1px solid rgba(148,163,184,.22);
}

/* Mobile sidebar overlay */
.sidebar.is-hidden{
  transform: translateX(-110%);
}
.sidebar{
  transition: transform .22s ease;
}

/* =========================
   Content / Topbar
========================= */
.content{
  flex:1;
  display:flex;
  flex-direction: column;
  min-width: 0;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.1rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.topbarTitle h1{
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: .02em;
}
.kicker{
  font-size: .82rem;
  opacity: .9;
}

.topbarActions{
  display:flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.iconBtn{
  border: 0;
  background: rgba(255,255,255,.12);
  color: #fff;
  border-radius: 12px;
  padding: .5rem .7rem;
  cursor: pointer;
  line-height: 1;
}
.iconBtn:hover{ background: rgba(255,255,255,.18); }

.btn{
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 12px;
  padding: .5rem .8rem;
  cursor: pointer;
}
.btn:hover{ background: rgba(255,255,255,.20); }
.btn.ghost{
  background: transparent;
}
.btn.small{
  padding: .35rem .6rem;
  border-radius: 10px;
  font-size: .88rem;
}

/* Breadcrumb */
.breadcrumb{
  max-width: 1120px;
  margin: 1rem auto 0;
  padding: 0 1rem;
  color: rgba(15,23,42,.78);
}
:root[data-theme="dark"] .breadcrumb{ color: rgba(229,231,235,.80); }

/* Main container */
.main{
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1rem 2.2rem;
}

/* =========================
   Hero
========================= */
.hero{
  display:grid;
  grid-template-columns: 1.3fr .9fr;
  gap: 1rem;
  align-items: stretch;
  margin-top: 1rem;
}

.heroText{
  background: var(--card);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  box-shadow: var(--shadow);
}

.heroText h2{
  margin: 0 0 .6rem;
  line-height: 1.35;
}

.heroBadges{
  margin-top: .8rem;
  display:flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.badge{
  display:inline-flex;
  align-items:center;
  padding: .22rem .6rem;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid rgba(56,189,248,.25);
  font-weight: 700;
  font-size: .85rem;
}

.heroPanel{
  background: rgba(255,255,255,.65);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem;
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .heroPanel{
  background: rgba(255,255,255,.06);
}

.panelTitle{
  font-weight: 800;
  margin-bottom: .4rem;
}

.check{
  padding-left: 1.1rem;
  margin: .5rem 0 .2rem;
}
.check li{ margin: .2rem 0; }
.panelHint{ margin-top: .6rem; }

/* =========================
   Cards / Grids
========================= */
.grid3{
  margin-top: 1rem;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.grid2{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.card{
  background: var(--card);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: var(--radius);
  padding: 1.05rem 1.1rem;
  box-shadow: var(--shadow);
}

.card.soft{
  background: rgba(255,255,255,.65);
}
:root[data-theme="dark"] .card.soft{
  background: rgba(255,255,255,.06);
}

.card h3{
  margin: 0 0 .35rem;
  line-height: 1.35;
}

/* =========================
   Sections
========================= */
.section{
  margin-top: 1.4rem;
  padding: 1.1rem 1.15rem;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

:root[data-theme="dark"] .section{
  background: rgba(255,255,255,.06);
}

.section h2{
  margin: 0 0 .6rem;
  font-size: 1.2rem;
  letter-spacing: .01em;
}
.section h3{
  margin: 1rem 0 .4rem;
  font-size: 1.03rem;
}

.section ul{
  margin: .35rem 0 .9rem;
  padding-left: 1.2rem;
}

.twoCol{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Chips */
.chips{
  display:flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: .5rem 0 .8rem;
}
.chip{
  padding: .22rem .6rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(224,231,255,.65);
  font-size: .88rem;
}
:root[data-theme="dark"] .chip{
  background: rgba(30,58,138,.18);
}

/* Notes */
.note{
  margin: .9rem 0;
  padding: .85rem .95rem;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(224,231,255,.55);
}
.noteTitle{
  font-weight: 800;
  margin-bottom: .25rem;
}
.note.warn{ background: rgba(245,158,11,.10); border-color: rgba(245,158,11,.25); }
.note.ok{ background: rgba(22,163,74,.10); border-color: rgba(22,163,74,.22); }

/* Steps */
.steps{ display:flex; flex-direction: column; gap: .75rem; margin-top: .6rem; }
.step{
  display:flex;
  gap: .8rem;
  align-items:flex-start;
  padding: .85rem .9rem;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(255,255,255,.55);
}
:root[data-theme="dark"] .step{ background: rgba(255,255,255,.04); }
.stepNum{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--primary));
}
.stepBody h3{ margin: 0 0 .2rem; }
.stepBody p{ margin: 0; }

/* Diagram */
.diagram{
  margin: .8rem 0;
  padding: .9rem .95rem;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(255,255,255,.55);
}
:root[data-theme="dark"] .diagram{ background: rgba(255,255,255,.04); }

.dRow{
  display:flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items:center;
  margin: .25rem 0;
}
.dItem{
  padding: .24rem .6rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.22);
  background: var(--primary-soft);
  font-weight: 800;
  font-size: .9rem;
}
.dArrow{ opacity: .65; }

/* Code box */
.codeBox{
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  overflow: hidden;
  margin: .8rem 0 1rem;
  box-shadow: var(--shadow);
}
.codeTop{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: .8rem;
  padding: .6rem .75rem;
  background: linear-gradient(135deg, rgba(30,58,138,.12), rgba(56,189,248,.10));
}
.codeTitle{
  font-weight: 800;
  color: rgba(15,23,42,.88);
}
:root[data-theme="dark"] .codeTitle{ color: rgba(229,231,235,.92); }

pre.code{
  margin: 0;
  padding: .9rem .95rem;
  background: rgba(15,23,42,.92);
  color: #e5e7eb;
  overflow: auto;
  line-height: 1.6;
}
pre code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .9rem;
}

/* Table */
.tableWrap{
  margin: .8rem 0 1rem;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  overflow: auto;
  background: rgba(255,255,255,.55);
}
:root[data-theme="dark"] .tableWrap{ background: rgba(255,255,255,.04); }

.tbl{
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.tbl th, .tbl td{
  padding: .75rem .85rem;
  border-bottom: 1px solid rgba(148,163,184,.20);
  vertical-align: top;
}
.tbl th{
  text-align: left;
  font-weight: 900;
  background: rgba(224,231,255,.55);
}

/* Glossary */
.glossary{
  display:flex;
  flex-direction: column;
  gap: .7rem;
  margin: .6rem 0 .2rem;
}
.glossary dt{
  font-weight: 900;
}
.glossary dd{
  margin: .2rem 0 0;
  color: rgba(15,23,42,.82);
}
:root[data-theme="dark"] .glossary dd{ color: rgba(229,231,235,.84); }

/* TOC */
.tocWrap{
  margin-top: 1rem;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(148,163,184,.22);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
:root[data-theme="dark"] .tocWrap{ background: rgba(255,255,255,.06); }

.tocHead{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid rgba(148,163,184,.22);
}
.tocHead h3{ margin: 0; }
.tocBody{
  padding: .8rem 1rem 1rem;
}
.tocBody ul{
  margin: .2rem 0;
  padding-left: 1.1rem;
}
.tocBody a{
  color: rgba(15,23,42,.88);
}
:root[data-theme="dark"] .tocBody a{ color: rgba(229,231,235,.90); }
.tocBody a:hover{ text-decoration: underline; }
.tocBody .toc-l2{ margin-left: .75rem; }

/* Footer */
.footer{
  margin: 1.6rem auto .6rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: var(--shadow2);
}
:root[data-theme="dark"] .footer{
  background: rgba(255,255,255,.06);
}

/* =========================
   Responsive
========================= */
@media (max-width: 1100px){
  .hero{ grid-template-columns: 1fr; }
  .grid3{ grid-template-columns: 1fr; }
}

@media (max-width: 920px){
  .sidebar{
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
  }
  .content{ margin-left: 0; }
}

@media (max-width: 760px){
  .twoCol{ grid-template-columns: 1fr; }
  .grid2{ grid-template-columns: 1fr; }
  .topbarTitle h1{ font-size: 1.12rem; }
}
