/* Maiastra - Shared Design System */
/* ============================================================================= */

/* Google Fonts - Stick No Bills (fallback when no parent theme) */
@import url('https://fonts.googleapis.com/css2?family=Stick+No+Bills:wght@400;500;600;700&display=swap');

/* CSS Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties */
/* ============================================================================= */

:root {
    /* Typography */
    /* Stick No Bills: stencil display font - overridden when parent theme detected */
    --notion-font-family: 'Stick No Bills', sans-serif;
    --notion-font-mono: monospace;
    --notion-font-size-xs: 10px;
    --notion-font-size-sm: 11px;
    --notion-font-size-base: 12px;
    --notion-font-size-md: 13px;
    --notion-font-size-lg: 14px;
    --notion-font-size-xl: 1.25rem;
    --notion-font-size-2xl: 1.5rem;
    
    /* Spacing */
    --notion-spacing-xs: 4px;
    --notion-spacing-sm: 6px;
    --notion-spacing-md: 8px;
    --notion-spacing-lg: 12px;
    --notion-spacing-xl: 16px;
    --notion-spacing-2xl: 20px;
    --notion-spacing-3xl: 32px;
    
    /* Border Radius */
    --notion-radius-sm: 3px;
    --notion-radius-md: 4px;
    --notion-radius-lg: 6px;
    --notion-radius-xl: 8px;
    --notion-radius-2xl: 12px;
    --notion-radius-3xl: 16px;
    
    /* Transitions */
    --notion-transition-fast: 0.15s ease;
    --notion-transition-base: 0.2s ease;
    --notion-transition-slow: 0.3s ease;
    
    /* Z-index */
    --notion-z-base: 100;
    --notion-z-tooltip: 1000;
    --notion-z-loader: 1000;
    --notion-z-panel: 1000;
    
    /* Notion/Super parent theme variables - Dark Mode defaults */
    /* These are overridden when embedded in Super.so or Notion-based sites */
    /* Reference: https://docs.super.so/notion-colors */
    /* Maiastra standalone palette - visible when not embedded */
    --color-text-default: #d9d9d9;    /* gray - main text */
    --color-text-gray: #d9d9d9;       /* gray */
    --color-text-brown: #fdb462;      /* orange (warm brown) */
    --color-text-orange: #fdb462;     /* orange */
    --color-text-yellow: #ffed6f;     /* yellow */
    --color-text-green: #8dd3c7;      /* green (teal) */
    --color-text-blue: #80b1d3;       /* blue */
    --color-text-purple: #bebada;     /* purple (lavender) */
    --color-text-pink: #fccde5;       /* light pink */
    --color-text-red: #fb8072;        /* pink/coral (red) */
    
    --color-bg-gray: #454B4E;
    --color-bg-brown: #434040;
    --color-bg-orange: #594A3A;
    --color-bg-yellow: #59563B;
    --color-bg-green: #354C4B;
    --color-bg-blue: #364954;
    --color-bg-purple: #443F57;
    --color-bg-pink: #533B4C;
    --color-bg-red: #594141;
    
    /* Colors - Dark Mode (default) */
    --notion-bg-primary: #000000;
    --notion-bg-secondary: rgba(25, 25, 25, 0.9);
    --notion-bg-tertiary: rgba(25, 25, 25, 0.95);
    --notion-bg-hover: rgba(255, 255, 255, 0.1);
    --notion-bg-hover-light: rgba(255, 255, 255, 0.05);
    
    --notion-text-primary: var(--color-text-default);
    /* Derived text colors using color-mix() with opacity */
    --notion-text-secondary: color-mix(in srgb, var(--color-text-default) 70%, transparent);
    --notion-text-tertiary: color-mix(in srgb, var(--color-text-default) 60%, transparent);
    --notion-text-muted: color-mix(in srgb, var(--color-text-default) 50%, transparent);
    --notion-text-placeholder: color-mix(in srgb, var(--color-text-default) 40%, transparent);
    
    --notion-border-primary: rgba(255, 255, 255, 0.1);
    --notion-border-secondary: rgba(255, 255, 255, 0.05);
    
    --notion-accent: var(--color-text-blue);
    --notion-error: var(--color-text-red);
    --notion-success: var(--color-text-green);
    --notion-warning: var(--color-text-yellow);
    
    /* Notion semantic colors - mapped from parent variables */
    --notion-color-gray: var(--color-text-gray);
    --notion-color-brown: var(--color-text-brown);
    --notion-color-orange: var(--color-text-orange);
    --notion-color-yellow: var(--color-text-yellow);
    --notion-color-green: var(--color-text-green);
    --notion-color-blue: var(--color-text-blue);
    --notion-color-purple: var(--color-text-purple);
    --notion-color-pink: var(--color-text-pink);
    --notion-color-red: var(--color-text-red);
    
    --notion-bg-color-gray: var(--color-bg-gray);
    --notion-bg-color-brown: var(--color-bg-brown);
    --notion-bg-color-orange: var(--color-bg-orange);
    --notion-bg-color-yellow: var(--color-bg-yellow);
    --notion-bg-color-green: var(--color-bg-green);
    --notion-bg-color-blue: var(--color-bg-blue);
    --notion-bg-color-purple: var(--color-bg-purple);
    --notion-bg-color-pink: var(--color-bg-pink);
    --notion-bg-color-red: var(--color-bg-red);
    
    /* Backdrop blur */
    --notion-backdrop-blur: blur(8px);
    --notion-backdrop-blur-strong: blur(10px);
}

/* Transparent when embedded */
html[data-embedded="true"],
:root[data-embedded="true"] {
    --notion-bg-primary: transparent !important;
}

/* Light Mode */
[data-notion-theme="light"] {
    /* Override Notion parent variables for light mode */
    /* Maiastra standalone palette - darker versions for light backgrounds */
    --color-text-default: #37352f;    /* dark gray - main text */
    --color-text-gray: #9B9A97;       /* gray */
    --color-text-brown: #b87333;      /* darker orange/brown */
    --color-text-orange: #d97706;     /* darker orange */
    --color-text-yellow: #ca8a04;     /* darker yellow (gold) */
    --color-text-green: #059669;      /* darker teal green */
    --color-text-blue: #0284c7;       /* darker blue */
    --color-text-purple: #7c3aed;     /* darker purple */
    --color-text-pink: #db2777;       /* darker pink */
    --color-text-red: #dc2626;        /* red */
    
    --color-bg-gray: #EBECED;
    --color-bg-brown: #E9E5E3;
    --color-bg-orange: #FAEBDD;
    --color-bg-yellow: #FBF3DB;
    --color-bg-green: #DDEDEA;
    --color-bg-blue: #DDEBF1;
    --color-bg-purple: #EAE4F2;
    --color-bg-pink: #F4DFEB;
    --color-bg-red: #FBE4E4;
    
    /* Light mode backgrounds */
    --notion-bg-primary: #ffffff;
    --notion-bg-secondary: rgba(255, 255, 255, 0.95);
    --notion-bg-tertiary: rgba(255, 255, 255, 0.95);
    --notion-bg-hover: rgba(0, 0, 0, 0.05);
    --notion-bg-hover-light: rgba(0, 0, 0, 0.05);
    
    /* Derived text colors using color-mix() with opacity - inherits from --color-text-default */
    --notion-text-secondary: color-mix(in srgb, var(--color-text-default) 90%, transparent);
    --notion-text-tertiary: color-mix(in srgb, var(--color-text-default) 70%, transparent);
    --notion-text-muted: color-mix(in srgb, var(--color-text-default) 60%, transparent);
    --notion-text-placeholder: color-mix(in srgb, var(--color-text-default) 40%, transparent);
    
    --notion-border-primary: rgba(0, 0, 0, 0.1);
    --notion-border-secondary: rgba(0, 0, 0, 0.05);
}

/* Base Styles */
/* ============================================================================= */

html, body {
    font-family: var(--notion-font-family);
    background: var(--notion-bg-primary);
    color: var(--notion-text-primary);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--notion-text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--notion-font-size-2xl); }
h2 { font-size: var(--notion-font-size-xl); }
h3 { font-size: var(--notion-font-size-lg); }

a {
    color: var(--notion-accent);
    text-decoration: none;
    transition: color var(--notion-transition-fast);
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--notion-font-mono);
    font-size: 0.9em;
    background: rgba(135, 131, 116, 0.15);
    padding: 2px 4px;
    border-radius: var(--notion-radius-sm);
}

/* Custom Scrollbar - Minimal & Elegant */
/* ============================================================================= */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Chrome, Safari, Edge */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Light theme scrollbar */
[data-theme="light"] * {
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Utility Classes */
/* ============================================================================= */

.hidden {
    display: none !important;
}

/* =============================================================================
   Maiastra UI Components (maia-* prefix)
   Custom components that don't conflict with Notion classes
   ============================================================================= */

/* Loader: maia-loader */
.maia-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--notion-spacing-xl);
    z-index: var(--notion-z-loader);
}

.maia-loader__dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--notion-text-tertiary);
    animation: maia-loader-pulse 1.2s infinite ease-in-out;
    margin: 0 var(--notion-spacing-md);
}

.maia-loader__dot:nth-child(1) { animation-delay: -0.32s; }
.maia-loader__dot:nth-child(2) { animation-delay: -0.16s; }
.maia-loader__dot:nth-child(3) { animation-delay: 0s; }

@keyframes maia-loader-pulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.maia-loader__text {
    color: var(--notion-text-tertiary);
    font-size: var(--notion-font-size-md);
}

/* Message: maia-message */
.maia-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--notion-text-secondary);
    font-size: var(--notion-font-size-lg);
    text-align: center;
    padding: var(--notion-spacing-2xl);
    z-index: var(--notion-z-base);
}

.maia-message--error {
    color: var(--notion-error);
}

/* Card: maia-card */
.maia-card {
    background: var(--notion-bg-secondary);
    border: 1px solid var(--notion-border-primary);
    border-radius: var(--notion-radius-3xl);
    padding: var(--notion-spacing-3xl);
    backdrop-filter: var(--notion-backdrop-blur-strong);
}

/* Button: maia-btn */
.maia-btn {
    padding: var(--notion-spacing-md) var(--notion-spacing-xl);
    background: var(--notion-accent);
    color: #fff;
    border: none;
    border-radius: var(--notion-radius-md);
    font-size: var(--notion-font-size-md);
    cursor: pointer;
    transition: filter var(--notion-transition-fast);
}

.maia-btn:hover {
    filter: brightness(1.1);
}

.maia-btn--secondary {
    background: var(--notion-bg-secondary);
    color: var(--notion-text-primary);
    border: 1px solid var(--notion-border-primary);
}

.maia-btn--secondary:hover {
    background: var(--notion-bg-hover);
}

/* Notion Text Colors - uses parent theme when available */
.notion-text-gray { color: var(--notion-color-gray); }
.notion-text-brown { color: var(--notion-color-brown); }
.notion-text-orange { color: var(--notion-color-orange); }
.notion-text-yellow { color: var(--notion-color-yellow); }
.notion-text-green { color: var(--notion-color-green); }
.notion-text-blue { color: var(--notion-color-blue); }
.notion-text-purple { color: var(--notion-color-purple); }
.notion-text-pink { color: var(--notion-color-pink); }
.notion-text-red { color: var(--notion-color-red); }

/* Notion Background Colors - uses parent theme when available */
.notion-bg { padding: 0 2px; border-radius: 3px; }
.notion-bg-gray { background-color: var(--notion-bg-color-gray); }
.notion-bg-brown { background-color: var(--notion-bg-color-brown); }
.notion-bg-orange { background-color: var(--notion-bg-color-orange); }
.notion-bg-yellow { background-color: var(--notion-bg-color-yellow); }
.notion-bg-green { background-color: var(--notion-bg-color-green); }
.notion-bg-blue { background-color: var(--notion-bg-color-blue); }
.notion-bg-purple { background-color: var(--notion-bg-color-purple); }
.notion-bg-pink { background-color: var(--notion-bg-color-pink); }
.notion-bg-red { background-color: var(--notion-bg-color-red); }

/* Text Formatting */
.notion-bold { font-weight: bold; }
.notion-italic { font-style: italic; }
.notion-strikethrough { text-decoration: line-through; }
.notion-underline { text-decoration: underline; }
.notion-code {
    font-family: var(--notion-font-mono);
    background-color: rgba(135, 131, 116, 0.15);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Links */
.notion-link {
    color: inherit;
    text-decoration: none;
    transition: all var(--notion-transition-base);
}

.notion-link:hover {
    text-decoration: underline;
}

/* =============================================================================
   Maiastra Icons (maia-icon-* prefix)
   ============================================================================= */

/* Default Page Icon */
.maia-icon-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.maia-icon-page::before {
    content: '';
    width: 14px;
    height: 14px;
    background: url("https://www.notion.so/icons/document_lightgray.svg") no-repeat center;
    background-size: contain;
}

/* Default Database Icon */
.maia-icon-database {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.maia-icon-database::before {
    content: '';
    width: 14px;
    height: 14px;
    background: url("https://www.notion.so/icons/database_lightgray.svg") no-repeat center;
    background-size: contain;
}

/* Maiastra Badge */
/* ============================================================================= */

.maiastra-badge {
    position: fixed;
    bottom: 12px;
    right: 12px;
    padding: 6px 10px;
    background: var(--notion-bg-secondary);
    border: 1px solid var(--notion-border-primary);
    border-radius: var(--notion-radius-lg);
    backdrop-filter: var(--notion-backdrop-blur);
    font-size: var(--notion-font-size-xs);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--notion-text-muted);
    text-decoration: none;
    z-index: var(--notion-z-base);
    opacity: 0.6;
    transition: opacity var(--notion-transition-fast);
}

.maiastra-badge:hover {
    opacity: 1;
    text-decoration: none;
}
