@import url('https://fonts.googleapis.com/css2?family=Michroma&display=swap');
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=JetBrains+Mono:wght@100..800&display=swap');

/* 
 * Global Typography
 * -----------------
 * Body: DM Sans
 * Code: JetBrains Mono
 * Logo/Branding: Michroma
 */
html {
    --lumo-font-family: 'DM Sans', var(--lumo-font-family-sans-serif);
}

body {
    font-family: 'DM Sans', sans-serif;
}

code, pre, kbd, samp, .monospace {
    font-family: 'JetBrains Mono', monospace;
}

:root {
    --app-header-height: 72px;
    --app-footer-height: 40px;
    --app-sidebar-width: 240px;
    --app-logo-size: 28px;
    --ilionx-brand-color: #E8003D;
    --logo-color: #D4A537;
}

/* Main layout container */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Header - full width at top */
.app-header {
    display: flex;
    align-items: center;
    height: var(--app-header-height);
    min-height: var(--app-header-height);
    padding: var(--lumo-space-m) var(--lumo-space-l);
    background: var(--lumo-base-color);
    border-bottom: 1px solid var(--lumo-contrast-10pct);
    box-shadow: var(--lumo-box-shadow-s);
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    z-index: 100;
}

.app-header-content {
    display: flex;
    align-items: center;
    gap: var(--lumo-space-m);
}

.app-header-spacer {
    flex-grow: 1;
}

.app-logo {
    font-family: 'Michroma', sans-serif;
    font-size: 2.25rem;
    font-weight: normal;
    margin: 0;
    color: var(--lumo-body-text-color);
}

.app-logo-icon {
    font-size: 3.125rem;
    color: var(--logo-color);
    flex-shrink: 0;
}

[theme~="dark"] .app-logo-icon {
    color: var(--logo-color);
}

/* Footer Ilionx logo */
.app-footer-logo {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.app-footer-logo svg {
    width: 100%;
    height: 100%;
}

/* Light mode footer logo - Ilionx red */
.app-footer-logo .path {
    fill: var(--ilionx-brand-color);
}

/* Dark mode footer logo - white */
[theme~="dark"] .app-footer-logo .path {
    fill: var(--lumo-contrast-70pct);
}

/* Theme toggle */
.theme-toggle {
    display: flex;
    gap: var(--lumo-space-xs);
}

/* Menu toggle button */
.menu-toggle {
    margin-right: var(--lumo-space-s);
}

/* Middle section - sidebar + content */
.app-middle {
    display: flex;
    flex: 1;
    overflow: hidden;
    width: 100%;
}

/* Sidebar */
.app-sidebar {
    width: var(--app-sidebar-width);
    background: var(--lumo-contrast-5pct);
    border-right: 1px solid var(--lumo-contrast-10pct);
    padding: var(--lumo-space-m);
    box-sizing: border-box;
    overflow-y: auto;
    transition: margin-left 0.3s ease, opacity 0.3s ease;
}

.app-sidebar.hidden {
    margin-left: calc(-1 * var(--app-sidebar-width));
    opacity: 0;
    pointer-events: none;
}

/* Sidebar resize handle */
.sidebar-resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.sidebar-resize-handle:hover {
    background: var(--lumo-primary-color-50pct);
}

/* Sidebar navigation */
.app-sidebar vaadin-side-nav-item {
    font-size: 1rem;
    --_focus-ring-color: var(--lumo-primary-color-50pct);
}

.app-sidebar vaadin-side-nav-item::part(content) {
    padding: var(--lumo-space-xs) var(--lumo-space-s);
}

.app-sidebar vaadin-side-nav-item vaadin-icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* Content scroller */
.app-content-scroller {
    flex: 1;
    overflow: auto;
}

/* Content area */
.app-content {
    padding: var(--lumo-space-l);
    min-height: 100%;
    box-sizing: border-box;
}

/* Footer - full width at bottom */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--app-footer-height);
    min-height: var(--app-footer-height);
    padding: 0 var(--lumo-space-l);
    background: var(--lumo-base-color);
    border-top: 1px solid var(--lumo-contrast-10pct);
    font-family: 'Michroma', sans-serif;
    font-size: 0.75rem;
    color: var(--lumo-secondary-text-color);
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.app-footer-tagline {
    opacity: 0.9;
}

.app-footer-version {
    opacity: 0.75;
    font-size: 0.7rem;
}

/* Environment badge pills */
.env-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.env-badge-dev {
    background-color: #22C55E;
    color: white;
}

.env-badge-test {
    background-color: #EAB308;
    color: #1a1a1a;
}

.env-badge-staging {
    background-color: #F97316;
    color: white;
}

.env-badge-readonly {
    background-color: #6B7280;
    color: white;
}

/* Docs view — no overflow here; the Vaadin Scroller (.app-content-scroller) is
   the sole scroll container so that position:sticky works on the TOC sidebar.
   position:relative anchors the TOC which is absolutely placed in the right margin. */
.docs-view {
    width: 100%;
    padding: var(--lumo-space-l);
    box-sizing: border-box;
    position: relative;
}

.docs-content {
    max-width: 900px;
    margin: 0 auto;
}

/* Docs Book Icon - Animates on long-press to indicate reload */
.docs-book-icon {
    transition: transform 0.2s ease, color 0.2s ease;
}

/* Pulse animation while holding (300-800ms) - subtle glow effect */
.docs-book-pulsing {
    animation: bookPulse 0.4s ease-in-out infinite;
    color: var(--lumo-primary-color);
}

/* Flip animation when reload triggers */
.docs-book-triggered {
    animation: bookFlip 0.5s ease-out;
    color: var(--lumo-primary-color);
}

@keyframes bookPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
}

@keyframes bookFlip {
    0% {
        transform: rotateY(0deg) scale(1);
    }
    50% {
        transform: rotateY(90deg) scale(1.1);
    }
    100% {
        transform: rotateY(0deg) scale(1);
    }
}

/* Cursor hint that long-press is available */
.docs-parent-item::part(toggle),
.docs-parent-item::part(item) {
    cursor: pointer;
}

/* Theme segmented toggle */
.theme-segmented {
    overflow: hidden;
}

.theme-segmented vaadin-button {
    margin: 0 !important;
    border: none !important;
    border-right: 1px solid var(--lumo-contrast-20pct) !important;
}

.theme-segmented vaadin-button:last-child {
    border-right: none !important;
}
