/* ==========================================================================
   THEME 1: CORE DATA TABLES
   All layout rules handling width distribution inside grid blocks and matrices.
   ========================================================================== */

/* --- Left Table Layout (Tight Columns + Stretched Last Column) --- */
.dual-table-grid .grid-item:first-child .md-typeset__table,
.dual-table-grid .grid-item:first-child table {
  display: table !important;
  width: 100% !important;
  table-layout: auto !important;
}

.dual-table-grid .grid-item:first-child table th:not(:last-child),
.dual-table-grid .grid-item:first-child table td:not(:last-child) {
  width: 1% !important;
  white-space: nowrap !important;
}

.dual-table-grid .grid-item:first-child table th:last-child,
.dual-table-grid .grid-item:first-child table td:last-child {
  width: auto !important;
  white-space: normal !important;
}

/* --- Right Table Layout ("Goals" Table: Squeezed First Column + Stretched Last Column) --- */
.dual-table-grid .grid-item:last-child .md-typeset__table,
.dual-table-grid .grid-item:last-child table {
  display: table !important;
  width: 100% !important;
  table-layout: auto !important; /* Changed from fixed to auto to allow dynamic sizing */
}

/* Squeezes the left keyword column to its absolute minimum width and stops text wrapping */
.dual-table-grid .grid-item:last-child table th:not(:last-child),
.dual-table-grid .grid-item:last-child table td:not(:last-child) {
  width: 1% !important;
  white-space: nowrap !important;
}

/* Forces the right text column to take up all remaining space and wrap rows naturally */
.dual-table-grid .grid-item:last-child table th:last-child,
.dual-table-grid .grid-item:last-child table td:last-child {
  width: auto !important;
  white-space: normal !important;
}

/* --- Global Matrix/Network Table Utility --- */
/* Prevents IPs, hostnames, and network tags from awkwardly wrapping on small screens */
.md-typeset table.matrix-table th,
.md-typeset table.matrix-table td {
    white-space: nowrap !important;
}
/* Allows only the Access/Role or note column to wrap naturally if needed */
.md-typeset table.matrix-table td:last-child {
    white-space: normal !important;
}



/* ==========================================================================
   THEME 2: SECURITY CLASSIFICATION SYSTEM
   Manages color identities, badge tags, and right-aligned header icons.
   ========================================================================== */

/* --- Base System Colors --- */
.private  { color: #d93025; } /* Crimson Red: Restricted Data */
.internal { color: #f2994a; } /* Amber Orange: Staff / VPN Access */
.public   { color: #1e8e3e; } /* Forest Green: Open Internet */

/* --- Inline Tag Badges --- */
.md-tag--private {
    background-color: #fce8e6 !important;
    color: #a51d24 !important;
    border: 1px solid #d93025 !important;
}

.md-tag--internal {
    background-color: #fef7e0 !important;
    color: #b06000 !important;
    border: 1px solid #f2994a !important;
}

.md-tag--public {
    background-color: #e6f4ea !important;
    color: #137333 !important;
    border: 1px solid #1e8e3e !important;
}

/* --- H1 Title Anchor Icons --- */
h1 {
    position: relative;
    padding-right: 40px; /* Protects icon from text overlap */
}

h1 .private, h1 .internal, h1 .public {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%); 
}

h1 .private svg, h1 .internal svg, h1 .public svg {
    fill: currentColor !important;
}


/* ==========================================================================
   THEME 3: STATUS UTILITIES (DIMMING & DEPRECATION)
   Consolidated rules to fade out, grey-out, and desaturate legacy items.
   ========================================================================== */

/* --- Table Row Dimming --- */
tr:has(.dim-row) {
    opacity: 0.4 !important;                  
    background-color: transparent !important; 
}

/* --- Dashboard Card Dimming --- */
.card.dim-row {
    background-color: var(--md-code-bg-color, #f8f9fa) !important; 
    border-color: var(--md-typeset-color, #e0e0e0) !important;
    opacity: 0.35 !important;
    filter: grayscale(100%) !important; 
}

/* --- Shared Element Cleanup (Badges & Links) --- */
tr:has(.dim-row) .md-tag,
tr:has(.dim-row) a,
.card.dim-row .md-tag,
.card.dim-row a {
    filter: grayscale(100%) !important;
}


/* ==========================================================================
   THEME 4: CODE BLOCKS & TEXT TYPOGRAPHY
   ========================================================================== */

/* --- Typography Alignment --- */
.justify {
  text-align: justify !important;
  text-justify: inter-word !important;
}

.dual-table-grid .grid-item p {
  text-align: justify !important;
  text-justify: inter-word !important; 
}

/* --- Code Containers & Annotations --- */
.md-typeset .highlight, 
.md-typeset .inlineblocks {
    max-height: 450px; 
    overflow-y: auto;
    display: block;    
}

/* INTEGRATED HOTFIX: Allows code annotations to float and spill over tab limits smoothly */
.md-typeset pre {
    overflow: visible !important;
}

/* Fixes spacing inside line highlights (hl_lines) so tooltips don't clip text boundaries */
.md-typeset .md-code__link, 
.md-typeset .hll .md-code__link {
    margin-right: 1.5rem !important;
    position: relative;
}


/* ==========================================================================
   THEME 5: EXPANDABLE COMPONENT LAYOUTS
   ========================================================================== */

/* --- Standalone Core <details> Blocks --- */
details {
    display: table;
    width: max-content;
    margin-bottom: 1em;
}

details[open] {
    display: block;
    width: 100%;
}

details summary {
    cursor: pointer;
    padding: 6px 12px;
    background-color: var(--md-code-bg-color, #f5f5f5); 
    border-radius: 4px;
    font-weight: bold;
}

/* --- Horizontal Side-by-Side Expandables --- */
.side-by-side-docs {
    display: flex;
    flex-wrap: wrap; 
    gap: 16px;       
    margin: 1.5em 0;
}

.side-by-side-admonitions {
    gap: 16px;
    margin-bottom: 1em;
}

.side-by-side-docs details {
    display: inline-block;
    flex: 0 1 auto; 
}

.side-by-side-docs details[open] {
    flex: 1 0 100%; 
}

.side-by-side-docs details summary {
    cursor: pointer;
    padding: 8px 16px;
    background-color: var(--md-code-bg-color, #f8f9fa);
    border: 1px solid var(--md-typeset-color, #e0e0e0);
    border-radius: 6px;
    font-weight: bold;
    user-select: none;
}


/* ==========================================================================
   THEME 6: STRUCTURAL LAYOUT GRIDS & CARDS
   ========================================================================== */

.triple-grid {
    display: grid;
    gap: 16px;
    margin: 1.5em 0;
    grid-template-columns: repeat(3, 1fr); 
}

.triple-grid .card {
    padding: 16px;
    border: 1px solid var(--md-typeset-color, #e0e0e0);
    border-radius: 6px;
    background-color: var(--md-code-bg-color, #f8f9fa);
}

/* Tablet & Mobile Breakpoint */
@media screen and (max-width: 768px) {
    .triple-grid {
        grid-template-columns: 1fr;
    }
}

