/* ==========================================================================
   canonic — Shibuya brand layer (teal / canonical-seal system)
   ========================================================================== */

:root {
  --cn-teal-50: #f0fdfa;
  --cn-teal-100: #ccfbf1;
  --cn-teal-200: #99f6e4;
  --cn-teal-300: #5eead4;
  --cn-teal-500: #14b8a6;
  --cn-teal-600: #0d9488;
  --cn-teal-700: #0f766e;
  --cn-teal-800: #115e59;
  --cn-teal-900: #134e4a;
  --cn-ink: #0f172a;
  --cn-radius: 16px;
}

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

.cn-hero {
  position: relative;
  overflow: hidden;
  margin: 0 0 2rem;
  padding: 1.75rem 1.55rem 1.5rem;
  border-radius: var(--cn-radius);
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(45, 212, 191, 0.14), transparent 50%),
    radial-gradient(120% 80% at 0% 0%, rgba(45, 212, 191, 0.2), transparent 55%),
    linear-gradient(145deg, #f0fdfa 0%, #ecfeff 42%, #f8fafc 100%);
  border: 1px solid var(--cn-teal-200);
  box-shadow:
    0 1px 0 rgba(15, 118, 110, 0.06),
    0 12px 40px -24px rgba(15, 118, 110, 0.35);
}
.cn-hero::after {
  content: "";
  position: absolute;
  right: -2rem;
  top: -2rem;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.16), transparent 70%);
  pointer-events: none;
}
html.dark .cn-hero {
  background:
    radial-gradient(90% 70% at 100% 0%, rgba(45, 212, 191, 0.1), transparent 50%),
    radial-gradient(120% 80% at 0% 0%, rgba(20, 184, 166, 0.16), transparent 55%),
    linear-gradient(145deg, #042f2e 0%, #0f172a 100%);
  border-color: var(--cn-teal-800);
  box-shadow: none;
}

.cn-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cn-teal-800);
  background: rgba(204, 251, 241, 0.85);
  border: 1px solid var(--cn-teal-200);
}
html.dark .cn-hero-eyebrow {
  color: var(--cn-teal-100);
  background: rgba(17, 94, 89, 0.55);
  border-color: var(--cn-teal-700);
}

.cn-hero-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 0 0.95rem;
  position: relative;
  z-index: 1;
}
.cn-hero-mark {
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  border-radius: 15px;
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.24);
}
html.dark .cn-hero-mark {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.cn-hero-name {
  margin: 0;
  font-size: clamp(1.85rem, 3.2vw, 2.3rem);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--cn-teal-800);
}
html.dark .cn-hero-name { color: var(--cn-teal-100); }

.cn-hero-sub {
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
  font-weight: 550;
  color: var(--cn-teal-700);
  letter-spacing: -0.01em;
}
html.dark .cn-hero-sub { color: var(--cn-teal-300); }

.cn-hero-logo {
  display: block;
  max-width: min(320px, 78vw);
  height: auto;
  margin: 0 0 0.75rem;
}
.cn-hero-brand ~ .cn-hero-logo { display: none !important; }
html.dark .cn-hero:not(:has(.cn-hero-brand)) .cn-hero-logo-light { display: none; }
html:not(.dark) .cn-hero:not(:has(.cn-hero-brand)) .cn-hero-logo-dark { display: none; }

.cn-hero-tagline {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--cn-teal-900);
  max-width: 44rem;
}
html.dark .cn-hero-tagline { color: var(--cn-teal-200); }

.cn-hero-tagline code {
  font-size: 0.92em;
  padding: 0.08em 0.35em;
  border-radius: 5px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--cn-teal-800);
}
html.dark .cn-hero-tagline code {
  background: rgba(94, 234, 212, 0.12);
  color: var(--cn-teal-100);
}

.cn-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.05rem;
  position: relative;
  z-index: 1;
}
.cn-hero-pills span {
  font-size: 0.76rem;
  padding: 0.24rem 0.68rem;
  border-radius: 999px;
  background: var(--cn-teal-100);
  color: var(--cn-teal-800);
  font-weight: 650;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
html.dark .cn-hero-pills span {
  background: var(--cn-teal-800);
  color: #ecfdf5;
  border-color: rgba(94, 234, 212, 0.15);
}

.cn-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.25rem;
  position: relative;
  z-index: 1;
}
.cn-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.95rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none !important;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.cn-btn:hover { transform: translateY(-1px); }
.cn-btn-primary {
  background: var(--cn-teal-700);
  color: #ecfdf5 !important;
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.28);
}
.cn-btn-primary:hover {
  background: var(--cn-teal-600);
  color: #fff !important;
}
.cn-btn-ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--cn-teal-800) !important;
  border-color: var(--cn-teal-200);
}
.cn-btn-ghost:hover {
  background: #fff;
  color: var(--cn-teal-700) !important;
}
html.dark .cn-btn-primary {
  background: var(--cn-teal-500);
  color: #042f2e !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
html.dark .cn-btn-ghost {
  background: rgba(15, 23, 42, 0.45);
  color: var(--cn-teal-100) !important;
  border-color: var(--cn-teal-700);
}

/* --- Pipeline / flow strip ----------------------------------------------- */

.cn-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
}
@media (max-width: 820px) {
  .cn-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .cn-flow { grid-template-columns: 1fr; }
}
.cn-flow li {
  position: relative;
  margin: 0;
  padding: 0.9rem 0.95rem 0.85rem;
  border-radius: 12px;
  background: var(--cn-teal-50);
  border: 1px solid var(--cn-teal-200);
  min-height: 5.5rem;
}
html.dark .cn-flow li {
  background: rgba(4, 47, 46, 0.55);
  border-color: var(--cn-teal-800);
}
.cn-flow-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  background: var(--cn-teal-700);
  color: #ecfdf5;
  margin-bottom: 0.45rem;
}
html.dark .cn-flow-n {
  background: var(--cn-teal-500);
  color: #042f2e;
}
.cn-flow-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--cn-teal-800);
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}
html.dark .cn-flow-title { color: var(--cn-teal-100); }
.cn-flow-desc {
  display: block;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #334155;
}
html.dark .cn-flow-desc { color: #94a3b8; }
.cn-flow-cmd {
  display: inline-block;
  margin-top: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--cn-teal-800);
}
html.dark .cn-flow-cmd {
  background: rgba(94, 234, 212, 0.12);
  color: var(--cn-teal-200);
}

/* --- Page intro band (inner pages) --------------------------------------- */

.cn-page-intro {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem;
  border-radius: 12px;
  border-left: 4px solid var(--cn-teal-500);
  background: linear-gradient(90deg, rgba(240, 253, 250, 0.95), transparent 85%);
}
html.dark .cn-page-intro {
  background: linear-gradient(90deg, rgba(4, 47, 46, 0.65), transparent 85%);
  border-left-color: var(--cn-teal-500);
}
.cn-page-intro p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--cn-teal-900);
}
html.dark .cn-page-intro p { color: var(--cn-teal-200); }

/* --- Command / need cards via sphinx-design tweaks ----------------------- */

.sd-card {
  border-radius: 12px !important;
  border-color: var(--cn-teal-200) !important;
  box-shadow: 0 1px 0 rgba(15, 118, 110, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.sd-card:hover {
  border-color: var(--cn-teal-300) !important;
  box-shadow: 0 8px 24px -16px rgba(15, 118, 110, 0.45);
  transform: translateY(-1px);
}
html.dark .sd-card {
  border-color: var(--cn-teal-800) !important;
  background: rgba(15, 23, 42, 0.35) !important;
}
html.dark .sd-card:hover {
  border-color: var(--cn-teal-600) !important;
}
.sd-card .sd-card-title {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cn-teal-800);
}
html.dark .sd-card .sd-card-title { color: var(--cn-teal-100); }

/* Command chip list inside cards */
.cn-cmd-list {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}
.cn-cmd-list li {
  margin: 0.35rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.35;
  padding: 0.35rem 0.55rem;
  border-radius: 7px;
  background: rgba(15, 118, 110, 0.06);
  color: var(--cn-teal-900);
  border: 1px solid rgba(15, 118, 110, 0.08);
}
html.dark .cn-cmd-list li {
  background: rgba(94, 234, 212, 0.08);
  color: var(--cn-teal-100);
  border-color: rgba(94, 234, 212, 0.12);
}
.cn-cmd-list .cn-cmd-hint {
  display: block;
  margin-top: 0.15rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.78;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

/* Numbered tutorial steps */
.cn-steps {
  counter-reset: cn-step;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}
.cn-steps > li {
  position: relative;
  counter-increment: cn-step;
  margin: 0 0 0.85rem;
  padding: 0.95rem 1rem 0.95rem 3.1rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
html.dark .cn-steps > li {
  background: rgba(15, 23, 42, 0.4);
  border-color: #1e293b;
}
.cn-steps > li::before {
  content: counter(cn-step);
  position: absolute;
  left: 0.85rem;
  top: 0.95rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 750;
  background: var(--cn-teal-700);
  color: #ecfdf5;
}
html.dark .cn-steps > li::before {
  background: var(--cn-teal-500);
  color: #042f2e;
}
.cn-steps strong { color: var(--cn-teal-800); }
html.dark .cn-steps strong { color: var(--cn-teal-100); }

/* Principle tiles on design page */
.cn-principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}
@media (max-width: 720px) {
  .cn-principles { grid-template-columns: 1fr; }
}
.cn-principles li {
  margin: 0;
  padding: 1rem 1.05rem;
  border-radius: 12px;
  background: var(--cn-teal-50);
  border: 1px solid var(--cn-teal-200);
}
html.dark .cn-principles li {
  background: rgba(4, 47, 46, 0.5);
  border-color: var(--cn-teal-800);
}
.cn-principles h3 {
  margin: 0 0 0.4rem;
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--cn-teal-800);
}
html.dark .cn-principles h3 { color: var(--cn-teal-100); }
.cn-principles p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #334155;
}
html.dark .cn-principles p { color: #94a3b8; }

/* Header chrome polish */
.sy-head-brand img,
.sidebar-logo {
  border-radius: 6px;
}

/* Soften wide content rhythm */
.sy-contents article > section > h1 {
  letter-spacing: -0.02em;
}

/* Inline kbd-ish mono in body */
.sy-contents code.literal {
  border-radius: 4px;
}

/* --- Architecture / figure band ---------------------------------------- */

.cn-figure {
  margin: 0 0 1.75rem;
  padding: 1rem;
  border-radius: 16px;
  background:
    radial-gradient(90% 80% at 100% 0%, rgba(45, 212, 191, 0.12), transparent 55%),
    #f8fafc;
  border: 1px solid #99f6e4;
  overflow: hidden;
}
html.dark .cn-figure {
  background:
    radial-gradient(90% 80% at 100% 0%, rgba(20, 184, 166, 0.12), transparent 55%),
    #0f172a;
  border-color: #115e59;
}
.cn-figure img,
.cn-figure object,
.cn-figure svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}
.cn-figure-caption {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: #134e4a;
  line-height: 1.4;
}
html.dark .cn-figure-caption { color: #99f6e4; }

/* Module card grid (API page) */
.cn-mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
}
.cn-mod-grid li {
  margin: 0;
  padding: 0.95rem 1rem;
  border-radius: 12px;
  background: var(--cn-teal-50, #f0fdfa);
  border: 1px solid var(--cn-teal-200, #99f6e4);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cn-mod-grid li:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -16px rgba(15, 118, 110, 0.5);
}
html.dark .cn-mod-grid li {
  background: rgba(4, 47, 46, 0.5);
  border-color: #115e59;
}
.cn-mod-grid code {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 0.35rem;
}
html.dark .cn-mod-grid code { color: #5eead4; }
.cn-mod-grid p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #334155;
}
html.dark .cn-mod-grid p { color: #94a3b8; }

/* Rustdoc CTA */
.cn-rustdoc-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1.75rem;
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  background: linear-gradient(120deg, #042f2e 0%, #0f766e 55%, #14b8a6 100%);
  color: #ecfdf5;
  box-shadow: 0 10px 28px -14px rgba(15, 118, 110, 0.55);
}
.cn-rustdoc-cta strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.cn-rustdoc-cta p {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  opacity: 0.92;
  max-width: 36rem;
}
.cn-rustdoc-cta a.cn-btn {
  margin-left: auto;
  background: #ecfdf5;
  color: #0f766e !important;
  border: none;
  box-shadow: none;
}
.cn-rustdoc-cta a.cn-btn:hover {
  background: #fff;
  color: #042f2e !important;
}
html.dark .cn-rustdoc-cta {
  background: linear-gradient(120deg, #022c22 0%, #0f766e 60%, #2dd4bf 100%);
}

/* Code blocks: slightly teal-tinted frame */
.highlight {
  border-radius: 10px;
  border: 1px solid rgba(15, 118, 110, 0.12);
}
html.dark .highlight {
  border-color: rgba(94, 234, 212, 0.12);
}

/* Admonition accent */
.admonition {
  border-radius: 10px;
}

/* Table polish */
table.docutils {
  border-radius: 10px;
  overflow: hidden;
}

/* Footer brand strip */
.cn-foot-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #99f6e4;
  font-size: 0.85rem;
  color: #0f766e;
}
html.dark .cn-foot-brand {
  border-top-color: #115e59;
  color: #99f6e4;
}
.cn-foot-brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
