/**
 * Sinnesskin: Den Levande Närvaron
 * Main Stylesheet - 2026 Design System
 * 
 * En frontend som andas med dig
 * © 2026 Mona AI
 */

/* ============================================
   ROOT VARIABLES - Sinnesskin Color Palette
   ============================================ */
:root {
    /* Sand/Beige Base Colors */
    --sand-light: #F5F0E8;
    --sand-dark: #E8DFD3;
    --sand-surface: #FFFCF9;
    /* Halvgenomskinlig ljus bakgrund för text */

    /* Text Colors - Varma grå toner */
    --text-primary: #2E2A28;
    /* Mörk, varm grå för rubriker */
    --text-secondary: #4A4542;
    /* Mjuk, djup grå för brödtext */
    --text-tertiary: #8B7F9E;
    /* Lavendel för mindre viktig text */

    /* Accent Colors - Från nervsystemet */
    --accent-terrakotta: #C97C5D;
    --accent-terrakotta-hover: #B56748;
    --accent-salvia: #9DBF9E;
    --accent-lavendel: #B8A9C9;
    --accent-barnsten: #F9B872;
    --accent-guld: #F9E2B7;

    /* Neural Colors (for special elements) */
    --neural-blue: rgba(124, 185, 232, 0.15);
    --neural-lavender: rgba(155, 139, 191, 0.6);
    --neural-gold: rgba(249, 226, 183, 0.7);

    /* Semantic Colors */
    --success: #9DBF9E;
    --warning: #F9B872;
    --error: #C97C5D;
    --info: #B8A9C9;

    /* Shadows - Mjuka, varma skuggor */
    --shadow-sm: 0 2px 8px rgba(46, 42, 40, 0.04);
    --shadow-md: 0 4px 16px rgba(46, 42, 40, 0.06);
    --shadow-lg: 0 8px 32px rgba(46, 42, 40, 0.08);

    /* Transitions */
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Typography */
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --line-height-relaxed: 1.8;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --sand-light: #1A1625;
    --sand-dark: #2A2435;
    --sand-surface: rgba(26, 22, 37, 0.85);

    --text-primary: #F5F0E8;
    --text-secondary: #D4CFC7;
    --text-tertiary: #B8A9C9;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    line-height: var(--line-height-relaxed);
    color: var(--text-secondary);
    background: var(--sand-light);
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent transitions on page load */
.preload * {
    transition: none !important;
    animation: none !important;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1em;
}

a {
    color: var(--accent-terrakotta);
    text-decoration: none;
    transition: color var(--transition-smooth);
    position: relative;
}

a:hover {
    color: var(--accent-terrakotta-hover);
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width var(--transition-smooth);
}

a:hover::after {
    width: 100%;
}

/* ============================================
   LAYOUT - CANVAS + CONTENT LAYERS
   ============================================ */
#sinnesskin-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Behind everything */
    pointer-events: none;
}

.content-layer {
    position: relative;
    z-index: 1;
    background: rgba(255, 252, 249, 0.70);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    margin: 1rem;
    transition: all var(--transition-smooth);
}

[data-theme="dark"] .content-layer {
    background: rgba(26, 22, 37, 0.75);
}

.content-layer:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* ============================================
   BUTTONS - Mjuka, organiska
   ============================================ */
button,
.btn {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

button:hover,
.btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-md);
}

button:active,
.btn:active {
    transform: translateY(0) scale(0.98);
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-terrakotta), var(--accent-lavendel));
    color: white;
}

.primary-btn:hover {
    background: linear-gradient(135deg, var(--accent-terrakotta-hover), var(--accent-lavendel));
}

.secondary-btn {
    background: var(--sand-surface);
    color: var(--text-primary);
    border: 1px solid var(--accent-terrakotta);
}

.secondary-btn:hover {
    background: var(--accent-terrakotta);
    color: white;
}

/* Pulse animation on hover */
button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: inherit;
    transition: transform 0.5s ease;
}

button:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

/* ============================================
   INPUT FIELDS - Warma och inbjudande
   ============================================ */
input,
textarea,
select {
    font-family: var(--font-sans);
    font-size: 1rem;
    padding: 0.875rem 1.25rem;
    border: 2px solid transparent;
    border-radius: 12px;
    background: var(--sand-surface);
    color: var(--text-primary);
    transition: all var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-lavendel);
    box-shadow: 0 0 0 3px rgba(184, 169, 201, 0.15), var(--shadow-md);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

/* ============================================
   ANIMATIONS - Mjuka övergångar
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* Apply animations */
.fade-in {
    animation: fadeIn 0.6s var(--transition-smooth);
}

.slide-in {
    animation: slideIn 0.6s var(--transition-smooth);
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.breathe {
    animation: breathe 4s ease-in-out infinite;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

/* ============================================
   RESPONSIVE - Mobile First
   ============================================ */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .content-layer {
        padding: 1.5rem;
        margin: 0.5rem;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--accent-lavendel);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01s !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #1A1A1A;
    }

    [data-theme="dark"] {
        --text-primary: #FFFFFF;
        --text-secondary: #F5F5F5;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
.skeleton {
    background: linear-gradient(90deg,
            var(--sand-dark) 25%,
            var(--sand-light) 50%,
            var(--sand-dark) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   SCROLLBAR - Custom, subtle
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--sand-light);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-lavendel);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-terrakotta);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-lavendel) var(--sand-light);
}