:root {
  --bg: #eef2ff;
  --panel: #0b1020;
  --panel-soft: #111a33;
  --text: #0f172a;
  --line: #dbe4ff;
  --brand: #2563eb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(165deg, var(--panel) 0%, #0d1528 45%, var(--panel-soft) 100%);
  color: #f8fafc;
  padding: 22px 14px 20px;
  border-right: 1px solid rgba(30, 41, 59, 0.9);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.brand .brand-tagline {
  margin: 8px 0 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.sidebar-nav__heading {
  margin: 0 0 10px 2px;
  padding: 0 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}
.sidebar-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.35);
  color: #e2e8f0;
  padding: 11px 12px 11px 13px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.menu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  transition: background 0.15s ease;
}
.menu-item__label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: #f1f5f9;
}
.menu-item__hint {
  font-size: 0.6875rem;
  font-weight: 400;
  line-height: 1.45;
  color: #94a3b8;
}

.menu-item:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
}
.menu-item:hover .menu-item__hint { color: #cbd5e1; }

.menu-item:focus-visible {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45);
}

.menu-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.38) 0%, rgba(30, 64, 175, 0.22) 100%);
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}
.menu-item.active::before { background: #60a5fa; }
.menu-item.active .menu-item__label { color: #fff; }
.menu-item.active .menu-item__hint { color: #bfdbfe; }

.menu-group { display: flex; flex-direction: column; gap: 4px; }
.menu-group__head {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.menu-chevron {
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 52px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.35);
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.menu-chevron:hover {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(59, 130, 246, 0.35);
  color: #e2e8f0;
}
.menu-chevron:focus-visible {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.45);
}
.menu-chevron__icon {
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}
.menu-group.is-open .menu-chevron__icon {
  transform: rotate(90deg);
}
.menu-group.is-open .menu-chevron {
  border-color: rgba(96, 165, 250, 0.45);
  color: #bfdbfe;
}

.menu-item--parent {
  flex: 1;
  min-width: 0;
  width: auto;
}

.menu-submenu {
  list-style: none;
  margin: 0 0 0 4px;
  padding: 4px 0 6px 10px;
  border-left: 2px solid rgba(59, 130, 246, 0.35);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-submenu[hidden] { display: none !important; }

.menu-subitem {
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.35;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(15, 23, 42, 0.25);
  color: #cbd5e1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.menu-subitem:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
  color: #f1f5f9;
}
.menu-subitem:focus-visible {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}
.menu-subitem.active {
  background: rgba(37, 99, 235, 0.28);
  border-color: rgba(96, 165, 250, 0.45);
  color: #fff;
  font-weight: 600;
}

.content {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  background: linear-gradient(120deg, #0f172a, #1d4ed8);
  color: #f8fafc;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.hero h2 { margin: 0; font-size: 24px; }
.hero p { margin: 6px 0 0; font-size: 14px; color: #dbeafe; }
.hero-tags { margin-top: 12px; }
.hero-tags span {
  display: inline-block;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.35);
}

.menu-btn {
  display: none;
  border: none;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.deck { display: none; }
.deck.active { display: block; }

.deck-slide {
  display: none;
  min-height: calc(100vh - 185px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
}

.deck-slide.active { display: block; }

.deck-slide h3 { margin-top: 0; font-size: 28px; }
.deck-slide h4 { margin-bottom: 8px; }
.deck-slide li { margin-bottom: 8px; line-height: 1.45; }

/* System Landscape — technical cards */
.deck-slide--tech-landscape {
  background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 45%, #e8eef7 100%);
  border: 1px solid #cbd5e1;
}

.tech-landscape-header {
  margin-bottom: 14px;
}

.tech-landscape-title {
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.tech-landscape-lead {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
  max-width: 58rem;
}

.tech-landscape-lead strong {
  color: #1e293b;
}

.tech-landscape-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tech-legend-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
}

.tech-legend-chip--public { border-color: #93c5fd; color: #1d4ed8; background: #eff6ff; }
.tech-legend-chip--internal { border-color: #c4b5fd; color: #5b21b6; background: #f5f3ff; }
.tech-legend-chip--services { border-color: #6ee7b7; color: #047857; background: #ecfdf5; }
.tech-legend-chip--platform { border-color: #fdba74; color: #c2410c; background: #fff7ed; }

.tech-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.tech-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow:
    0 1px 0 rgba(15, 23, 42, 0.04),
    0 12px 32px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tech-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--tech-accent, #64748b);
}

.tech-card--public { --tech-accent: #2563eb; }
.tech-card--internal { --tech-accent: #7c3aed; }
.tech-card--services { --tech-accent: #059669; }
.tech-card--platform { --tech-accent: #ea580c; }

.tech-card__head {
  padding: 14px 16px 10px 18px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tech-card__layer {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #94a3b8;
  margin-bottom: 6px;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
}

.tech-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tech-card__role {
  margin: 6px 0 0;
  font-size: 12px;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.35;
}

.tech-card__body {
  flex: 1;
  padding: 0 16px 4px 18px;
}

.tech-card__thead {
  display: grid;
  grid-template-columns: minmax(108px, 32%) 1fr;
  gap: 12px;
  padding: 10px 0 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  border-bottom: 1px solid #f1f5f9;
}

.tech-card__row {
  display: grid;
  grid-template-columns: minmax(108px, 32%) 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.tech-card__row--last {
  border-bottom: none;
  padding-bottom: 14px;
}

.tech-card__artifact {
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  line-height: 1.3;
  word-break: break-word;
}

.tech-card__detail {
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
}

.tech-card__hint {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.tech-card__hint code {
  font-size: 10px;
}

.tech-card__tags {
  padding: 12px 16px 14px 18px;
  border-top: 1px solid #f1f5f9;
  background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 48px;
}

.tech-pill {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 4px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-family: ui-monospace, Menlo, Monaco, Consolas, monospace;
}

.tech-card--internal .tech-pill {
  background: #f5f3ff;
  color: #5b21b6;
  border-color: #ddd6fe;
}

.tech-card--services .tech-pill {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.tech-card--platform .tech-pill {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-box {
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th, td {
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  padding: 9px 10px;
  font-size: 14px;
}

th { background: #eff6ff; }

code {
  background: #eaf1ff;
  color: #1d4ed8;
  padding: 2px 6px;
  border-radius: 6px;
}

.diagram {
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
}

.diagram pre {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.arch-diagram {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  padding: 10px;
  overflow-x: auto;
}

.arch-diagram--aws {
  background: #f4f4f4;
  border-color: #d5dbdb;
}

.deck-slide--aws-arch .aws-arch-lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #545b64;
  max-width: 58rem;
}

.deck-slide--aws-arch .aws-arch-lead em {
  color: #232f3e;
  font-style: normal;
  font-weight: 600;
}

.arch-diagram svg {
  min-width: 1100px;
  width: 100%;
  height: auto;
}

.arch-diagram--aws svg {
  min-width: 900px;
}

.group-box { fill: rgba(255, 255, 255, 0.75); stroke-width: 2; }
.zone-box { fill: none; stroke: #bfdbfe; stroke-width: 1.5; stroke-dasharray: 7 7; }
.zone-title { font-size: 16px; font-weight: 700; fill: #1e3a8a; letter-spacing: 0.02em; }
.group-channel { stroke: #60a5fa; }
.group-admin { stroke: #a78bfa; }
.group-api { stroke: #4ade80; }
.group-db { stroke: #fb923c; }

.group-title {
  font-size: 19px;
  letter-spacing: 0.12em;
  font-weight: 800;
  fill: #0f172a;
}

.node { stroke: #cbd5e1; stroke-width: 1.5; }
.node.web { fill: #eff6ff; }
.node.app { fill: #ecfeff; }
.node.admin { fill: #f5f3ff; }
.node.api { fill: #ecfdf5; }
.node.db { fill: #fff7ed; }

.node-title {
  font-size: 24px;
  font-weight: 800;
  fill: #111827;
}

.node-sub {
  font-size: 17px;
  fill: #475569;
}

.flow-line {
  stroke: #4b5563;
  stroke-width: 3;
  stroke-dasharray: 10 8;
}

.link-label {
  font-size: 14px;
  font-weight: 700;
  fill: #334155;
}

.note-box {
  fill: #0f172a;
  stroke: #334155;
  stroke-width: 1.5;
}

.note-title {
  font-size: 23px;
  font-weight: 700;
  fill: #f8fafc;
}

.note-sub {
  font-size: 16px;
  fill: #cbd5e1;
}

.edge-box {
  fill: #0f172a;
  stroke: #1d4ed8;
  stroke-width: 1.6;
}

.edge-title { fill: #f8fafc; }
.edge-sub { fill: #cbd5e1; }

.slideshow-root {
  min-height: 100vh;
}

.slideshow-root:fullscreen {
  background: var(--bg);
  overflow: auto;
}

.slideshow-root:-webkit-full-screen {
  background: var(--bg);
  overflow: auto;
}

.slideshow-root:fullscreen .layout {
  grid-template-columns: 1fr;
  min-height: 100vh;
}

.slideshow-root:fullscreen .sidebar {
  display: none;
}

.slideshow-root:fullscreen .deck-slide {
  min-height: calc(100vh - 160px);
}

.slide-controls {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  border-radius: 999px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.slideshow-btn {
  background: #0ea5e9 !important;
}

.slideshow-btn[aria-pressed="true"] {
  background: #64748b !important;
}

.slide-controls button {
  border: none;
  background: #1d4ed8;
  color: #fff;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}

.slide-controls button:disabled {
  background: #334155;
  color: #94a3b8;
  cursor: not-allowed;
}

#slideCounter { min-width: 200px; text-align: center; font-size: 12px; }

@media (max-width: 980px) {
  .tech-cards { grid-template-columns: 1fr; }
  .tech-card__thead,
  .tech-card__row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .tech-card__thead span:last-child { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -320px;
    width: 300px;
    z-index: 30;
    transition: left 0.2s ease;
  }
  .sidebar.open { left: 0; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .grid.two { grid-template-columns: 1fr; }
  .arch-diagram svg { min-width: 780px; }
  .node-title { font-size: 20px; }
  .node-sub { font-size: 15px; }
  .deck-slide { min-height: calc(100vh - 210px); padding: 18px; }
  .deck-slide h3 { font-size: 22px; }
}
