/*
  OSIIX Library - AI Safe Operations Guide v0.9
  Source style guide:
  - Static, dependency-free CSS.
  - No external fonts or third-party assets.
  - Class names favor predictable structure over cleverness.
*/

:root {
  color-scheme: light;
  --color-bg: #f3f6fb;
  --color-surface: #ffffff;
  --color-surface-soft: #f8fbff;
  --color-ink: #172033;
  --color-ink-soft: #48566f;
  --color-muted: #667085;
  --color-line: #d8e1ef;
  --color-accent: #2457c5;
  --color-accent-deep: #0f2f6f;
  --color-accent-soft: #edf4ff;
  --color-warning: #7a5200;
  --color-warning-bg: #fff7df;
  --color-success: #0b6149;
  --color-success-bg: #e8f7f1;
  --color-danger: #8b271c;
  --color-danger-bg: #fff0ee;
  --color-code-bg: #101827;
  --color-code-ink: #f8fafc;
  --shadow-soft: 0 24px 70px rgba(16, 24, 40, 0.11);
  --shadow-card: 0 14px 42px rgba(16, 24, 40, 0.08);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --max-width: 1180px;
  --toc-width: 244px;
  --space-page: clamp(20px, 4vw, 40px);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Noto Sans CJK JP", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

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

.library-guide-page {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(36, 87, 197, 0.14), transparent 26rem),
    linear-gradient(180deg, #eef4ff 0%, var(--color-bg) 24rem);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.012em;
}



a {
  color: var(--color-accent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  color: var(--color-accent-deep);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(36, 87, 197, 0.36);
  outline-offset: 3px;
  border-radius: 8px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 16px;
  z-index: 20;
  transform: translateY(-140%);
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.guide-hero {
  padding: 80px var(--space-page) 96px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(15, 47, 111, 0.96), rgba(36, 87, 197, 0.94)),
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.18), transparent 28rem);
}

.hero__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero__eyebrow {
  display: inline-flex;
  margin: 0 0 22px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero__title {
  max-width: 940px;
  margin: 0;
  font-size: clamp(36px, 6vw, 66px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.hero__lead {
  max-width: 760px;
  margin: 26px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(17px, 2.4vw, 22px);
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  max-width: 920px;
  margin: 38px 0 0;
}

.hero__meta div {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
}

.hero__meta dt {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero__meta dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.page-shell {
  display: grid;
  grid-template-columns: var(--toc-width) minmax(0, 1fr);
  gap: 28px;
  max-width: var(--max-width);
  margin: -46px auto 84px;
  padding: 0 var(--space-page);
}

.toc {
  position: sticky;
  top: 22px;
  align-self: start;
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
}

.toc__title {
  margin: 0 0 12px;
  color: var(--color-accent-deep);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toc__nav {
  display: grid;
  gap: 2px;
}

.toc__nav a {
  display: block;
  padding: 7px 9px;
  border-radius: 9px;
  color: var(--color-ink-soft);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

.toc__nav a:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
}

.guide {
  min-width: 0;
}

.panel {
  position: relative;
  margin: 0 0 26px;
  padding: clamp(26px, 4vw, 42px);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.panel--intro {
  border-color: rgba(36, 87, 197, 0.22);
}

.panel__marker {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 4px 10px;
  border: 1px solid #c8d8f8;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2,
h3 {
  color: var(--color-accent-deep);
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.32;
}

h3 {
  margin: 30px 0 12px;
  font-size: clamp(20px, 2.4vw, 24px);
  line-height: 1.4;
}

p,
ul,
ol,
pre,
.table-frame {
  margin-top: 0;
}

p {
  margin-bottom: 15px;
}

.lead {
  color: #24314b;
  font-size: clamp(17px, 2.2vw, 20px);
  line-height: 1.85;
}

ul,
ol {
  padding-left: 1.35em;
  margin-bottom: 16px;
}

li {
  margin: 6px 0;
}

.notice,
.note,
.license-box,
.info-card {
  margin: 18px 0;
  padding: 18px 20px;
  border-radius: var(--radius-md);
}

.notice h3,
.info-card h3 {
  margin-top: 0;
}

.notice--legal,
.notice--warning {
  border: 1px solid #f0d28d;
  background: var(--color-warning-bg);
  color: #3e2f08;
}

.notice--copy,
.note,
.info-card {
  border: 1px solid var(--color-line);
  background: var(--color-surface-soft);
}

.notice--support {
  border: 1px solid #bfd0f3;
  background: #f0f5ff;
  color: #172b5f;
}

.notice--success {
  border: 1px solid #a7e1cf;
  background: var(--color-success-bg);
  color: #063c2f;
}

.notice__small {
  margin-bottom: 0;
  color: var(--color-ink-soft);
  font-size: 14px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
}

.button:hover {
  background: var(--color-accent-deep);
  color: #fff;
}

.button--secondary {
  background: #fff;
  color: var(--color-accent-deep);
}

.button--secondary:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
}

.compare-grid,
.split-grid,
.principle-grid {
  display: grid;
  gap: 18px;
}

.compare-grid,
.split-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compare-card,
.principle {
  padding: 20px;
  border-radius: var(--radius-md);
}

.compare-card h3,
.principle h3 {
  margin-top: 0;
}

.compare-card--bad {
  border: 1px solid #efb5ac;
  background: var(--color-danger-bg);
}

.compare-card--good {
  border: 1px solid #a7e1cf;
  background: var(--color-success-bg);
}

.workflow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  padding: 0;
  margin: 24px 0 0;
  list-style: none;
  counter-reset: workflow;
}

.workflow li {
  display: grid;
  align-content: center;
  min-height: 92px;
  padding: 15px 12px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff, #f7faff);
  color: var(--color-accent-deep);
  font-weight: 800;
  text-align: center;
}

.workflow li::before {
  counter-increment: workflow;
  content: counter(workflow, decimal-leading-zero);
  display: block;
  margin-bottom: 4px;
  color: var(--color-muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.principle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.principle {
  border: 1px solid var(--color-line);
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.05);
}

.principle span {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
  font-size: 12px;
  font-weight: 900;
}

.principle p {
  margin-bottom: 0;
  color: var(--color-ink-soft);
}

.table-frame {
  overflow-x: auto;
  margin-bottom: 18px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-line);
  border-right: 1px solid var(--color-line);
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
  font-weight: 800;
  text-align: left;
}

td:first-child {
  font-weight: 800;
  white-space: nowrap;
}

pre {
  overflow: auto;
  margin-bottom: 18px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--color-code-bg);
  color: var(--color-code-ink);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

code {
  font-family: var(--font-mono);
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: #edf2f7;
  color: #101828;
  font-size: 0.92em;
}

.check-list {
  padding-left: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 1.8em;
}

.check-list li::before {
  content: "□";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: 900;
}

.license-box {
  border: 1px solid var(--color-line);
  background: var(--color-surface-soft);
}


.site-footer {
  padding: 36px var(--space-page) 48px;
  color: var(--color-muted);
  font-size: 13px;
  text-align: center;
}

.site-footer p {
  margin: 0 0 6px;
}

@media (max-width: 980px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .toc {
    position: static;
    max-height: none;
  }

  .toc__nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero__meta,
  .principle-grid,
  .workflow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .library-guide-page {
    line-height: 1.82;
  }

  .guide-hero {
    padding-top: 56px;
  }

  .hero__meta,
  .compare-grid,
  .split-grid,
  .principle-grid,
  .workflow,
  .toc__nav {
    grid-template-columns: 1fr;
  }

  .panel {
    border-radius: var(--radius-md);
  }

  pre,
  table {
    font-size: 12.5px;
  }
}

@media print {
  .library-guide-page {
    background: #fff;
    color: #000;
  }


  .skip-link,
  .toc,
  .no-print,
  .no-print {
    display: none !important;
  }

  .guide-hero {
    padding: 0 0 20px;
    background: #fff;
    color: #000;
  }

  .hero__eyebrow,
  .hero__meta div {
    border-color: #888;
    background: #fff;
    color: #000;
  }

  .hero__lead,
  .hero__meta dt,
  .hero__meta dd {
    color: #000;
  }

  .page-shell {
    display: block;
    margin: 0;
    padding: 0;
  }

  .panel {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border-color: #aaa;
  }

  a {
    color: #000;
    text-decoration: none;
  }
}


/* OSIIX site integration */
.library-guide-page .site-header {
  position: relative;
  z-index: 5;
}

.library-guide-page .site-nav a[aria-current="page"] {
  color: var(--accent, #007f99);
}

.library-guide-page .search-link svg {
  fill: none;
}

.library-guide-page .guide-hero {
  margin-top: 0;
}

@media (max-width: 680px) {
  .library-guide-page .site-header {
    align-items: flex-start;
  }
}
/* --------------------------------------------------------------------------
   OSIIX Library index page
   -------------------------------------------------------------------------- */

.library-index-page {
  background:
    radial-gradient(circle at 16% 0%, rgba(36, 87, 197, 0.10), transparent 24rem),
    linear-gradient(180deg, #f4f7fd 0%, #fbfcfd 38rem);
}

.library-site-header {
  position: relative;
  z-index: 2;
}

.library-index {
  max-width: 1180px;
  margin: 0 auto 88px;
  padding: 42px var(--space-page) 0;
}

.library-hero {
  max-width: 860px;
  padding: 56px 0 34px;
}

.library-hero .doc-kicker,
.card-kicker {
  margin: 0 0 14px;
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.library-hero h1 {
  margin: 0;
  color: var(--color-ink);
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.library-hero .doc-lead {
  max-width: 760px;
  margin: 24px 0 0;
  color: var(--color-ink-soft);
  font-size: clamp(17px, 2.2vw, 21px);
  line-height: 1.9;
}

.library-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.library-card {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 4vw, 44px);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
  box-shadow: var(--shadow-card);
}

.library-card::after {
  position: absolute;
  right: -80px;
  top: -90px;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(36, 87, 197, 0.16);
  border-radius: 999px;
  content: "";
}

.library-card--featured {
  border-color: rgba(36, 87, 197, 0.24);
}

.card-topline {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.card-topline .card-kicker {
  margin-bottom: 0;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(36, 87, 197, 0.20);
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.library-card h2 {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 22px 0 0;
  color: var(--color-ink);
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.library-card p {
  position: relative;
  z-index: 1;
  max-width: 840px;
  margin: 20px 0 0;
  color: var(--color-ink-soft);
  font-size: 16px;
  line-height: 1.9;
}

.card-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 28px 0 0;
}

.card-meta div {
  padding: 14px 16px;
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.card-meta dt {
  margin: 0 0 5px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-meta dd {
  margin: 0;
  color: var(--color-ink);
  font-size: 14px;
  font-weight: 800;
}

.library-card .action-row {
  position: relative;
  z-index: 1;
  margin-top: 30px;
}

.library-note {
  margin: 28px 0 0;
  padding: 26px 30px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
}

.library-note h2 {
  margin: 0 0 10px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.library-note p {
  margin: 0;
  color: var(--color-ink-soft);
}

.library-footer {
  border-top: 1px solid var(--color-line);
}

@media (max-width: 760px) {
  .library-index {
    padding-top: 18px;
  }

  .library-hero {
    padding-top: 34px;
  }

  .card-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .card-meta {
    grid-template-columns: 1fr;
  }
}

@media print {
  .library-index-page {
    background: #fff;
  }

  .library-card,
  .library-note {
    box-shadow: none;
  }
}



@media print {
  }

/* Public source and reuse notices */
.source-note,
.rights-note {
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 18px 20px;
  margin: 20px 0;
}

.source-note strong,
.rights-note strong {
  font-weight: 700;
}

.rights-note {
  border-style: dashed;
}

@media print {
  .source-note,
  .rights-note {
    background: #fff;
    border-color: #888;
  }
}
/* Document purpose */
.purpose-note {
  border-left: 4px solid currentColor;
  padding: 14px 18px;
  margin: 18px 0 24px;
  background: rgba(255, 255, 255, 0.72);
}
.purpose-note p { margin: 0; }
@media print { .purpose-note { background: #fff; border-color: #555; } }

/* PDF / print cleanup */
@media print {
  @page { size: A4; margin: 14mm 15mm 16mm; }
  .site-header,
  .site-footer,
  .skip-link,
  .toc,
  .no-print,
  .guide-hero::before,
  .guide-hero::after,
  body::before,
  body::after {
    display: none !important;
    content: none !important;
  }
  .guide-hero {
    margin: 0 0 8mm !important;
    padding: 0 !important;
    min-height: 0 !important;
    border: 0 !important;
  }
  .hero__inner { max-width: none !important; padding: 0 !important; }
  .hero__title { font-size: 25pt !important; line-height: 1.25 !important; }
  .page-shell { display: block !important; max-width: none !important; }
  .guide { display: block !important; }
  .panel {
    break-inside: auto !important;
    page-break-inside: auto !important;
    margin: 0 0 7mm !important;
    padding: 7mm !important;
    border-radius: 0 !important;
  }
  .panel h2,
  .panel h3,
  .notice,
  .note,
  .purpose-note,
  .source-note,
  table,
  pre {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
}
