/* ==========================================================================
   Yojaka AI — Material for MkDocs Custom Editorial Design System
   ========================================================================== */

:root {
  --md-primary-fg-color:        #2563eb;
  --md-primary-fg-color--light:  #3b82f6;
  --md-primary-fg-color--dark:   #1d4ed8;
  --md-accent-fg-color:         #7c3aed;
  --md-accent-fg-color--transparent: rgba(124, 58, 237, 0.1);
  --md-default-fg-color--lightest: rgba(148, 163, 184, 0.25);
}

[data-md-color-scheme="slate"] {
  --md-primary-fg-color:        #3b82f6;
  --md-primary-fg-color--light:  #60a5fa;
  --md-primary-fg-color--dark:   #1d4ed8;
  --md-accent-fg-color:         #a855f7;
  --md-default-bg-color:        #0f172a;
  --md-default-bg-color--light:  #1e293b;
  --md-default-bg-color--lighter:#334155;
  --md-default-fg-color:        #f1f5f9;
  --md-default-fg-color--light:  #cbd5e1;
  --md-default-fg-color--lighter:#94a3b8;
  --md-default-fg-color--lightest: rgba(148, 163, 184, 0.18);
}

/* --- Typography & Rhythm --- */
.md-typeset {
  font-size: 0.835rem;
  line-height: 1.7;
  color: var(--md-default-fg-color);
}

.md-typeset p {
  margin-top: 0;
  margin-bottom: 1.15rem;
  line-height: 1.7;
}

.md-typeset h1 {
  font-size: 1.65rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.25;
  color: var(--md-default-fg-color);
}

.md-typeset h2 {
  font-size: 1.28rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  color: var(--md-default-fg-color);
}

.md-typeset h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--md-default-fg-color);
}

.md-typeset h4 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

/* --- Hero Banner & Badges Alignment --- */
.hero-header {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-subtitle {
  font-size: 0.84rem !important;
  line-height: 1.6 !important;
  color: var(--md-default-fg-color--light) !important;
  text-align: center !important;
  max-width: 780px;
  margin: 0.4rem auto 1.35rem auto !important;
  font-weight: 400;
}

.hero-subtitle strong {
  color: var(--md-default-fg-color);
  font-weight: 600;
}

.hero-badges,
.hero-badges p,
.md-typeset .hero-badges p {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 8px 6px !important;
  margin: 0.5rem auto 1.25rem auto !important;
  max-width: 920px !important;
  padding: 0 !important;
}

.hero-badges a,
.md-typeset .hero-badges a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 1;
}

/* Specific Badge Image Resets (Eliminates block display, huge margins & borders) */
.hero-badges img,
.md-typeset .hero-badges img,
.md-typeset a img[src*="shields.io"],
.md-typeset a img[src*="badge"],
.md-typeset a img[src*="streamlit.io"] {
  display: inline-block !important;
  vertical-align: middle !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 4px !important;
  height: 20px !important;
  max-height: 20px !important;
  width: auto !important;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.hero-badges img:hover,
.md-typeset .hero-badges img:hover,
.md-typeset a:hover img[src*="shields.io"],
.md-typeset a:hover img[src*="badge"] {
  transform: translateY(-1px);
  opacity: 0.92;
}

/* --- Lists --- */
.md-typeset ul,
.md-typeset ol {
  margin-top: 0.35rem;
  margin-bottom: 1rem;
  padding-left: 1.35rem;
}

.md-typeset li {
  margin-bottom: 0.35rem;
  line-height: 1.65;
}

.md-typeset li > p {
  margin-top: 0;
  margin-bottom: 0.35rem;
}

/* Explicit nested sublist indentation, rhythm & list-style types */
.md-typeset li > ul,
.md-typeset li > ol {
  margin-top: 0.25rem;
  margin-bottom: 0.35rem;
  padding-left: 1.35rem;
}

.md-typeset ul {
  list-style-type: disc;
}

.md-typeset ul ul {
  list-style-type: circle;
}

.md-typeset ul ul ul {
  list-style-type: square;
}

.md-typeset ol {
  list-style-type: decimal;
}

.md-typeset ol ol {
  list-style-type: lower-alpha;
}

/* --- Content Images & Architecture Diagrams --- */
.md-typeset .diagram-image,
.md-typeset p > img:not([src*="badge"]):not([src*="shields.io"]):not([src*="streamlit.io"]) {
  border-radius: 8px;
  border: 1px solid var(--md-default-fg-color--lightest);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  max-width: 96%;
  width: auto;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  cursor: zoom-in;
}

.md-typeset .diagram-image:hover,
.md-typeset p > img:not([src*="badge"]):not([src*="shields.io"]):not([src*="streamlit.io"]):hover {
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.16);
  border-color: var(--md-primary-fg-color--light);
}

/* --- Admonitions & Callouts --- */
.md-typeset .admonition,
.md-typeset details {
  border-radius: 8px;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.35rem;
  font-size: 0.81rem;
  border-left-width: 4px;
}

.md-typeset .admonition-title,
.md-typeset summary {
  font-weight: 600;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

/* --- Data Tables --- */
.md-typeset__table {
  overflow-x: auto;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  border-radius: 6px;
  max-width: 100%;
}

.md-typeset table:not([class]) {
  border-collapse: collapse;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  box-shadow: none;
  font-size: 0.70rem; /* Compact typography fitting text easily in less width */
  line-height: 1.45;
  width: 100%;
  max-width: 100%;
  display: table;
  table-layout: auto;
}

.md-typeset table:not([class]) th {
  background-color: var(--md-default-bg-color--lighter);
  color: var(--md-default-fg-color);
  font-weight: 650;
  font-size: 0.68rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-bottom: 2px solid var(--md-default-fg-color--lightest);
  text-align: left;
}

.md-typeset table:not([class]) td {
  font-size: 0.72rem;
  line-height: 1.5;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  vertical-align: top;
  word-break: normal;
  overflow-wrap: break-word;
}

/* Keep identifier keys and node names unified */
.md-typeset table:not([class]) th:first-child,
.md-typeset table:not([class]) td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

.md-typeset table:not([class]) td:first-child code {
  white-space: nowrap;
}

/* Allow code in content cells to break gracefully without blowout */
.md-typeset table:not([class]) td:not(:first-child) code {
  font-size: 0.82em;
  padding: 0.08em 0.25em;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.md-typeset table:not([class]) tbody tr:hover {
  background-color: var(--md-accent-fg-color--transparent);
}

/* --- Code & Inline Tags --- */
.md-typeset code {
  border-radius: 4px;
  padding: 0.15em 0.35em;
  font-size: 0.84em;
  background-color: var(--md-default-bg-color--lighter);
  color: var(--md-default-fg-color);
}

.md-typeset pre > code {
  padding: 0.9rem;
  border-radius: 8px;
  font-size: 0.81rem;
  line-height: 1.55;
}

/* --- Content Tabs --- */
.md-typeset .tabbed-set {
  border-radius: 8px;
  margin-bottom: 1.35rem;
}

.md-typeset .tabbed-content {
  padding: 1rem 1.15rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-top: none;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* --- Compact Quotes & Admonitions --- */
.md-typeset .admonition.quote,
.md-typeset blockquote {
  font-size: 0.79rem;
  line-height: 1.55;
}

/* --- Header & Navigation Polish --- */
.md-header {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.md-tabs {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Native Lightbox & Fullscreen Viewer Styles
   ========================================================================== */

body.lightbox-open {
  overflow: hidden !important;
}

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox-dialog {
  position: relative;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  width: 96vw;
  height: 94vh;
  max-width: 1400px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-overlay.active .lightbox-dialog {
  transform: scale(1);
}

/* Lightbox Toolbar */
.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: rgba(30, 41, 59, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.lightbox-caption {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 65%;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  color: #e2e8f0;
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lightbox-btn:hover {
  background: var(--md-primary-fg-color);
  color: #ffffff;
  border-color: var(--md-primary-fg-color--light);
}

.lightbox-close-btn {
  padding: 5px 8px;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.lightbox-close-btn:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

/* Lightbox Stage */
.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: auto;
  position: relative;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: zoom-in;
  user-select: none;
}

.lightbox-img.zoomed {
  max-width: none;
  max-height: none;
  transform: scale(1.65);
  cursor: zoom-out;
  margin: 10% auto;
}

.lightbox-stage.is-zoomed {
  display: block;
}

/* Lightbox Footer */
.lightbox-footer {
  padding: 0.4rem 1rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.9);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.lightbox-hint {
  font-size: 0.72rem;
  color: #94a3b8;
}

.lightbox-hint kbd {
  background: rgba(51, 65, 85, 0.7);
  color: #f1f5f9;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 0.7rem;
}
