/*
 * CyberNexus IT Portfolio Platform
 * Project: IT Portfolio
 * Brand: CyberNexus PH
 * Engineer: Mark C. Pangilinan
 *
 * File: frontend/css/layout.css
 *
 * Responsibility:
 * - Full-screen application structure
 * - Header / sticker structure
 * - Page navigation structure
 * - Side panel structure
 * - Main content structure
 * - Flexbox / Grid structure
 * - Footer structural alignment
 * - Structural curves and shapes
 * - Overlay / drawer / modal structure
 * - Technology / tool grouping structure
 *
 * Does NOT own:
 * - Colors
 * - Visual theme tokens
 * - Typography
 * - Shared spacing tokens
 * - Responsive breakpoints
 * - Application behavior
 * - Print styling
 * - Component visual styling
 */


/* ============================================================
   1. STRUCTURAL TOKENS
   ============================================================ */

:root {

    /* --------------------------------------------------------
       Application
       -------------------------------------------------------- */

    --cn-header-height: 70px;
    --cn-header-min-height: 60px;


    /* --------------------------------------------------------
       Side Panel
       -------------------------------------------------------- */

    --cn-side-panel-width: 280px;
    --cn-side-panel-min-width: 240px;
    --cn-side-panel-collapsed-width: 72px;


    /* --------------------------------------------------------
       Content Widths
       -------------------------------------------------------- */

    --cn-content-max-width: 1440px;
    --cn-content-wide-width: 1680px;

    --cn-content-narrow-width: 960px;
    --cn-content-readable-width: 780px;


    /* --------------------------------------------------------
       Grid Minimums
       -------------------------------------------------------- */

    --cn-grid-min-sm: 180px;
    --cn-grid-min-md: 240px;
    --cn-grid-min-lg: 320px;


    /* --------------------------------------------------------
       Split Layout
       -------------------------------------------------------- */

    --cn-split-side-width: 380px;
    --cn-split-side-min-width: 280px;


    /* --------------------------------------------------------
       Overlay Components
       -------------------------------------------------------- */

    --cn-drawer-width: 420px;
    --cn-modal-width: 640px;


    /* --------------------------------------------------------
       Structural Layers
       -------------------------------------------------------- */

    --cn-layer-base: 1;
    --cn-layer-content: 10;
    --cn-layer-header: 100;
    --cn-layer-side-panel: 110;
    --cn-layer-overlay: 200;
}


/* ============================================================
   2. GLOBAL STRUCTURAL BOX MODEL
   ============================================================ */

html,
body,
#app,
.app,
.application,
.app-shell,
.page,
.page-shell {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}


/* ============================================================
   3. ROOT DOCUMENT STRUCTURE
   ============================================================ */

html {
    width: 100%;
    min-height: 100%;

    overflow-x: hidden;
}

body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;

    margin: 0;

    overflow-x: hidden;
}


/* ============================================================
   4. APPLICATION SHELL
   ============================================================ */

#app,
.app,
.application,
.app-shell {
    position: relative;

    display: flex;
    flex-direction: column;

    width: 100%;
    min-width: 0;

    min-height: 100vh;
    min-height: 100dvh;
}


/* ============================================================
   5. GENERIC PAGE SHELL
   ============================================================ */

.page,
.page-shell {
    position: relative;

    display: flex;
    flex-direction: column;

    width: 100%;
    min-width: 0;

    min-height: 100vh;
    min-height: 100dvh;
}


/* ============================================================
   6. APPLICATION BODY
   ============================================================

   Canonical structure:

   .app-shell
       |
       +-- .site-header
       |
       +-- .app-body
       |      |
       |      +-- .side-panel
       |      |
       |      +-- .main-content
       |
       +-- .site-footer

   The side panel and main content remain siblings.
   ============================================================ */

.app-body,
.page-body,
.page-layout {
    position: relative;

    display: flex;
    flex: 1 1 auto;

    flex-direction: row;
    align-items: stretch;

    width: 100%;
    min-width: 0;
    min-height: 0;
}


/* ============================================================
   7. PAGE MAIN STRUCTURE
   ============================================================ */

.page-main,
.main-area,
.content-area,
.main-content {
    position: relative;

    display: flex;
    flex: 1 1 auto;

    flex-direction: column;

    width: auto;
    min-width: 0;
    min-height: 0;

    overflow-x: hidden;
}

.page-content {
    position: relative;

    flex: 1 1 auto;

    width: 100%;
    min-width: 0;
    min-height: 0;
}

.main-inner {
    position: relative;

    display: block;
    flex: 1 1 auto;

    width: 100%;
    min-width: 0;
    min-height: 0;
}


/* ============================================================
   8. CONTENT CONTAINERS
   ============================================================ */

.container,
.container-wide,
.container-fluid,
.content,
.content-narrow,
.content-readable {
    position: relative;

    width: 100%;
    min-width: 0;
}

.container {
    max-width:
        var(--cn-content-max-width);

    margin-inline: auto;
}

.container-wide {
    max-width:
        var(--cn-content-wide-width);

    margin-inline: auto;
}

.container-fluid {
    max-width: none;
}

.content-narrow {
    max-width:
        var(--cn-content-narrow-width);

    margin-inline: auto;
}

.content-readable {
    max-width:
        var(--cn-content-readable-width);

    margin-inline: auto;
}


/* ============================================================
   9. HEADER / STICKER STRUCTURE
   ============================================================ */

.site-header,
.app-header,
.cn-header {
    position: sticky;

    top: 0;

    z-index:
        var(--cn-layer-header);

    display: flex;
    flex: 0 0 var(--cn-header-height);

    align-items: center;

    width: 100%;
    min-width: 0;

    height:
        var(--cn-header-height);

    min-height:
        var(--cn-header-height);

    max-height:
        var(--cn-header-height);
}

.header-inner,
.site-header-inner,
.app-header-inner,
.cn-header-inner {
    display: flex;

    align-items: center;

    width: 100%;
    min-width: 0;
    min-height: 0;
}


/* ============================================================
   10. HEADER REGIONS
   ============================================================ */

.header-brand,
.app-brand,
.cn-brand,
.brand {
    display: inline-flex;

    flex: 0 1 auto;

    align-items: center;

    min-width: 0;
}

.header-nav,
.primary-nav,
.page-nav {
    display: flex;

    flex: 1 1 auto;

    align-items: center;

    min-width: 0;
}

.header-status,
.app-status,
.cn-status,
.system-status,
.status {
    display: inline-flex;

    flex: 0 0 auto;

    align-items: center;

    min-width: max-content;
}

.side-panel-toggle {
    display: inline-flex;

    flex: 0 0 auto;

    align-items: center;
    justify-content: center;
}


/* ============================================================
   11. HEADER BRAND STRUCTURE
   ============================================================ */

.header-brand a,
.app-brand a,
.cn-brand a,
.brand {
    min-width: 0;
}

.brand-mark {
    display: inline-flex;

    flex: 0 0 auto;

    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 12px;
}

.brand-text,
.brand-content {
    display: flex;

    flex-direction: column;

    min-width: 0;
}

.brand-name,
.brand-subtitle,
.brand-description {
    display: block;

    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ============================================================
   12. HEADER STATUS STRUCTURE
   ============================================================ */

.status,
.header-status,
.app-status,
.cn-status,
.system-status {
    width: max-content;
    max-width: none;
    min-width: max-content;

    overflow: visible;

    white-space: nowrap;
}

.status-indicator {
    display: inline-flex;

    flex: 0 0 auto;

    align-items: center;
    justify-content: center;

    width: 8px;
    height: 8px;

    border-radius: 50%;
}

.status-content {
    display: inline-flex;

    flex: 0 0 auto;

    align-items: center;

    width: max-content;
    max-width: none;
    min-width: max-content;

    overflow: visible;
}

.status-label {
    display: inline-block;

    flex: 0 0 auto;

    width: auto;
    max-width: none;
    min-width: max-content;

    overflow: visible;

    text-overflow: clip;

    white-space: nowrap;
}


/* ============================================================
   13. PRIMARY NAVIGATION STRUCTURE
   ============================================================ */

.header-nav-list,
.primary-nav-list,
.page-nav-list {
    display: flex;

    flex: 1 1 auto;

    align-items: stretch;
    justify-content: space-evenly;

    width: 100%;
    min-width: 0;

    margin: 0;
    padding: 0;

    list-style: none;
}

.header-nav-item,
.primary-nav-item,
.page-nav-item {
    display: flex;

    flex: 1 1 0;

    min-width: 0;
}

.header-nav-link,
.primary-nav-link,
.page-nav-link {
    display: flex;

    align-items: center;
    justify-content: center;

    width: 100%;
    min-width: 0;
    min-height: 44px;

    text-align: center;

    white-space: nowrap;
}


/* ============================================================
   14. SCROLL STRUCTURE
   ============================================================ */

.app-body,
.page-layout,
.page-content,
.page-main,
.main-area,
.content-area,
.main-content {
    scroll-padding-top:
        var(--cn-header-height);
}

.app-body [id],
.page-layout [id],
.page-content [id],
.page-main [id],
.main-area [id],
.content-area [id],
.main-content [id],
.section[id] {
    scroll-margin-top:
        var(--cn-header-height);
}


/* ============================================================
   15. SIDE PANEL
   ============================================================ */

.side-panel {
    position: sticky;

    top:
        var(--cn-header-height);

    z-index:
        var(--cn-layer-side-panel);

    display: flex;

    flex: 0 0 var(--cn-side-panel-width);

    flex-direction: column;

    width:
        var(--cn-side-panel-width);

    min-width:
        var(--cn-side-panel-min-width);

    max-width:
        var(--cn-side-panel-width);

    height:
        calc(100vh - var(--cn-header-height));

    height:
        calc(100dvh - var(--cn-header-height));

    min-height: 0;

    align-self: flex-start;

    overflow: hidden;
}

.side-panel-inner {
    display: flex;

    flex: 1 1 auto;

    flex-direction: column;

    width: 100%;
    min-width: 0;
    min-height: 0;
}

.side-panel-header {
    display: flex;

    flex: 0 0 auto;

    align-items: center;
    justify-content: space-between;

    width: 100%;
    min-width: 0;
}

.side-panel-content {
    flex: 1 1 auto;

    width: 100%;
    min-width: 0;
    min-height: 0;

    overflow-x: hidden;
    overflow-y: auto;
}

.side-panel-footer {
    display: flex;

    flex: 0 0 auto;

    align-items: center;

    width: 100%;
    min-width: 0;
}


/* ============================================================
   16. SIDE NAVIGATION
   ============================================================ */

.side-nav {
    display: flex;

    flex-direction: column;

    width: 100%;
    min-width: 0;
}

.side-nav-list {
    display: flex;

    flex-direction: column;

    width: 100%;
    min-width: 0;

    margin: 0;
    padding: 0;

    list-style: none;
}

.side-nav-item {
    display: flex;

    width: 100%;
    min-width: 0;
}

.side-nav-link {
    display: flex;

    align-items: center;

    width: 100%;
    min-width: 0;
}

.side-nav-index,
.side-nav-icon {
    display: inline-flex;

    flex: 0 0 auto;

    align-items: center;
    justify-content: center;
}

.side-nav-label {
    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ============================================================
   17. SIDE PANEL STATES
   ============================================================ */

.side-panel.is-collapsed,
.side-panel.collapsed {
    flex-basis:
        var(--cn-side-panel-collapsed-width);

    width:
        var(--cn-side-panel-collapsed-width);

    min-width:
        var(--cn-side-panel-collapsed-width);

    max-width:
        var(--cn-side-panel-collapsed-width);
}

.side-panel.is-collapsed .side-panel-header,
.side-panel.collapsed .side-panel-header {
    justify-content: center;
}

.side-panel.is-collapsed .side-nav-link,
.side-panel.collapsed .side-nav-link {
    justify-content: center;
}

.side-panel.is-collapsed .side-nav-label,
.side-panel.is-collapsed .side-panel-title,
.side-panel.is-collapsed .side-panel-description,
.side-panel.collapsed .side-nav-label,
.side-panel.collapsed .side-panel-title,
.side-panel.collapsed .side-panel-description {
    display: none;
}

.side-panel.is-open,
.side-panel.open {
    visibility: visible;
}

.side-panel.is-closed,
.side-panel.closed {
    visibility: hidden;
}


/* ============================================================
   18. SECTION STRUCTURE
   ============================================================ */

.section {
    position: relative;

    display: block;

    width: 100%;
    min-width: 0;

    scroll-margin-top:
        var(--cn-header-height);
}

.section-inner {
    position: relative;

    width: 100%;
    min-width: 0;

    margin-inline: auto;
}

.section-header {
    display: flex;

    flex-direction: column;

    width: 100%;
    min-width: 0;
}

.section-heading {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    width: 100%;
    min-width: 0;
}

.section-title,
.section-subtitle {
    min-width: 0;
}

.section-actions {
    display: flex;

    flex: 0 0 auto;

    align-items: center;
}

.section-content {
    width: 100%;
    min-width: 0;
}

.section-footer {
    display: flex;

    align-items: center;
    justify-content: space-between;

    width: 100%;
    min-width: 0;
}


/* ============================================================
   19. HERO STRUCTURE
   ============================================================ */

.hero {
    position: relative;

    display: flex;

    flex-direction: column;
    justify-content: center;

    width: 100%;
    min-width: 0;

    min-height:
        min(
            760px,
            calc(100vh - var(--cn-header-height))
        );

    min-height:
        min(
            760px,
            calc(100dvh - var(--cn-header-height))
        );

    overflow: hidden;

    scroll-margin-top:
        var(--cn-header-height);
}

.hero-inner {
    position: relative;

    display: flex;

    flex-direction: column;

    width: 100%;
    min-width: 0;

    z-index:
        var(--cn-layer-content);
}

.hero-content {
    position: relative;

    width: 100%;
    max-width: 980px;
    min-width: 0;
}

.hero-actions {
    display: flex;

    align-items: center;

    flex-wrap: wrap;
}


/* ============================================================
   20. GENERAL GRID STRUCTURE
   ============================================================ */

.grid {
    display: grid;

    width: 100%;
    min-width: 0;
}

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

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

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

.grid-auto {
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                var(--cn-grid-min-md),
                1fr
            )
        );
}

.grid-auto-sm {
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                var(--cn-grid-min-sm),
                1fr
            )
        );
}

.grid-auto-lg {
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                var(--cn-grid-min-lg),
                1fr
            )
        );
}


/* ============================================================
   21. TECHNOLOGY / TOOL GROUPING
   ============================================================ */

.technology-grid,
.tech-grid,
.tool-grid,
.stack-grid {
    display: grid;

    width: 100%;
    min-width: 0;

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

.technology-group,
.tech-group,
.tool-group,
.stack-group {
    position: relative;

    display: flex;

    flex-direction: column;

    width: 100%;
    min-width: 0;
}

.technology-group-header,
.tech-group-header,
.tool-group-header,
.stack-group-header {
    display: flex;

    align-items: flex-start;

    width: 100%;
    min-width: 0;
}

.technology-group-header > *,
.tech-group-header > *,
.tool-group-header > *,
.stack-group-header > * {
    min-width: 0;
}

.technology-group-header > div,
.tech-group-header > div,
.tool-group-header > div,
.stack-group-header > div {
    flex: 1 1 auto;

    min-width: 0;
}

.technology-group-content,
.tech-group-content,
.tool-group-content,
.stack-group-content {
    width: 100%;
    min-width: 0;
}

.technology-group .tag-list,
.tech-group .tag-list,
.tool-group .tag-list,
.stack-group .tag-list {
    display: flex;

    flex-wrap: wrap;

    width: 100%;
    min-width: 0;
}

.technology-group .tag,
.technology-group .chip,
.technology-group .badge,
.tech-group .tag,
.tech-group .chip,
.tech-group .badge,
.tool-group .tag,
.tool-group .chip,
.tool-group .badge,
.stack-group .tag,
.stack-group .chip,
.stack-group .badge {
    min-width: 0;
    max-width: 100%;

    overflow-wrap: anywhere;
}


/* ============================================================
   22. CARD STRUCTURE
   ============================================================ */

.card-grid {
    display: grid;

    width: 100%;
    min-width: 0;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(
                var(--cn-grid-min-md),
                1fr
            )
        );
}

.card {
    position: relative;

    width: 100%;
    min-width: 0;
}

.card-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    width: 100%;
    min-width: 0;
}

.card-body {
    width: 100%;
    min-width: 0;
}

.card-footer {
    display: flex;

    align-items: center;
    justify-content: space-between;

    width: 100%;
    min-width: 0;
}


/* ============================================================
   23. SPLIT LAYOUT
   ============================================================ */

.split-layout {
    display: grid;

    width: 100%;
    min-width: 0;

    grid-template-columns:
        minmax(0, 1fr)
        minmax(
            var(--cn-split-side-min-width),
            var(--cn-split-side-width)
        );
}

.split-layout.reverse {
    grid-template-columns:
        minmax(
            var(--cn-split-side-min-width),
            var(--cn-split-side-width)
        )
        minmax(0, 1fr);
}


/* ============================================================
   24. FORM STRUCTURE
   ============================================================ */

.form {
    display: flex;

    flex-direction: column;

    width: 100%;
    min-width: 0;
}

.form-row {
    display: grid;

    width: 100%;
    min-width: 0;

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

.form-group {
    display: flex;

    flex-direction: column;

    min-width: 0;
}

.form-actions {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    flex-wrap: wrap;
}


/* ============================================================
   25. TABLE STRUCTURE
   ============================================================ */

.table-wrapper {
    width: 100%;
    min-width: 0;

    overflow-x: auto;
    overflow-y: hidden;
}

.table {
    width: 100%;

    min-width: 640px;

    border-collapse: collapse;
}

.table th,
.table td {
    vertical-align: middle;
}


/* ============================================================
   26. FOOTER STRUCTURE
   ============================================================ */

.site-footer,
.app-footer,
.cn-footer {
    position: relative;

    flex: 0 0 auto;

    width: 100%;
    min-width: 0;
}

.footer-inner {
    display: grid;

    align-items: center;

    width: 100%;
    min-width: 0;

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

.footer-brand {
    display: flex;

    flex-direction: column;

    align-items: flex-start;
    justify-content: center;

    min-width: 0;
}

.footer-brand > * {
    min-width: 0;
    max-width: 100%;
}

.footer-meta {
    display: flex;

    align-items: center;
    justify-content: center;

    min-width: 0;

    text-align: center;
}

.footer-meta > * {
    min-width: 0;
    max-width: 100%;
}

.footer-nav {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    min-width: 0;
}

.footer-links {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    width: 100%;
    min-width: 0;

    margin: 0;
    padding: 0;

    list-style: none;
}

.footer-links > a {
    display: inline-flex;

    flex: 0 0 auto;

    align-items: center;
    justify-content: center;

    min-width: 0;

    white-space: nowrap;
}


/* ============================================================
   27. STRUCTURAL DECORATIVE LAYERS
   ============================================================ */

.shape-layer {
    position: absolute;

    inset: 0;

    z-index:
        var(--cn-layer-base);

    overflow: hidden;

    pointer-events: none;
}

.shape {
    position: absolute;

    pointer-events: none;
}

.shape-circle {
    width: 280px;
    height: 280px;

    border-radius: 50%;
}

.shape-square {
    width: 240px;
    height: 240px;

    border-radius: 28px;
}

.shape-line {
    width: 100%;
    height: 1px;
}

.shape-orb {
    width: 180px;
    height: 180px;

    border-radius: 50%;
}

.shape-top-right {
    top: 0;
    right: 0;
}

.shape-top-left {
    top: 0;
    left: 0;
}

.shape-bottom-right {
    right: 0;
    bottom: 0;
}

.shape-bottom-left {
    bottom: 0;
    left: 0;
}


/* ============================================================
   28. STRUCTURAL CURVES
   ============================================================ */

.curve-top {
    border-radius:
        0
        0
        48px
        48px;
}

.curve-bottom {
    border-radius:
        48px
        48px
        0
        0;
}

.curve-all {
    border-radius:
        48px;
}

.curve-soft {
    border-radius:
        28px;
}

.clip-curve {
    overflow: hidden;

    border-radius:
        48px;
}


/* ============================================================
   29. OVERLAY STRUCTURE
   ============================================================ */

.overlay {
    position: fixed;

    inset: 0;

    z-index:
        var(--cn-layer-overlay);

    display: flex;

    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
}


/* ============================================================
   30. DRAWER STRUCTURE
   ============================================================ */

.drawer {
    position: fixed;

    top: 0;
    bottom: 0;

    z-index:
        var(--cn-layer-overlay);

    display: flex;

    flex-direction: column;

    width:
        min(
            var(--cn-drawer-width),
            92vw
        );

    height: 100%;

    min-width: 0;

    overflow: hidden;
}

.drawer-left {
    left: 0;
}

.drawer-right {
    right: 0;
}


/* ============================================================
   31. MODAL STRUCTURE
   ============================================================ */

.modal {
    position: relative;

    width:
        min(
            var(--cn-modal-width),
            92vw
        );

    max-height:
        min(
            840px,
            90vh
        );

    max-height:
        min(
            840px,
            90dvh
        );

    overflow-x: hidden;
    overflow-y: auto;
}


/* ============================================================
   32. STRUCTURAL VISIBILITY
   ============================================================ */

.is-hidden {
    display: none !important;
}

.is-visible {
    display: block !important;
}

.is-flex {
    display: flex !important;
}

.is-grid {
    display: grid !important;
}

[hidden] {
    display: none !important;
}
