/* ================================================
   Incepto House — Bento-style Widget Layout
   ================================================ */

/* CSS Variables */
:root {
    --bg: #f0f0f0;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #565656;
    --text-tertiary: #8e8e8e;
    --accent: #0066ff;
    --border: #e8e8e8;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.1);
    --radius: 16px;
    --radius-sm: 12px;
    --gap: 12px;
    --sidebar-width: 280px;

    /* Brand colors */
    --spotify: #1DB954;
    --spotify-bg: #e8f8ef;
    --youtube: #FF0000;
    --youtube-bg: #fff0f0;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg: #0e0e0e;
    --card-bg: #1c1c1c;
    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #777;
    --border: #2a2a2a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
    --spotify-bg: #132e1c;
    --youtube-bg: #2e1313;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ================================================
   Page Layout: Sidebar + Grid
   ================================================ */

.bento-page {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ================================================
   Sidebar
   ================================================ */

.bento-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    position: sticky;
    top: 32px;
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 8px;
}

.avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    margin-bottom: 16px;
}

.sidebar-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.sidebar-bio {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.sidebar-contact {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

.sidebar-contact a {
    color: var(--accent);
    text-decoration: underline;
}

.sidebar-contact a:hover {
    opacity: 0.8;
}

.sidebar-footer {
    margin-top: auto;
}

/* ================================================
   Content Grid
   ================================================ */

.bento-grid {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    align-content: start;
}

/* ================================================
   Base Widget Card
   ================================================ */

.widget {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 150ms ease, box-shadow 150ms ease;
    position: relative;
}

.widget:hover {
    box-shadow: var(--shadow-hover);
}

a.widget:active {
    transform: scale(0.97);
}

/* ================================================
   Widget Sizing
   ================================================ */

.widget--wide {
    grid-column: span 2;
}

.widget--tall {
    grid-row: span 2;
}

.widget--2x2 {
    grid-column: span 2;
    grid-row: span 2;
}

.widget--full {
    grid-column: 1 / -1;
}

/* ================================================
   Photo Widget
   ================================================ */

.widget--photo {
    cursor: pointer;
    padding: 0;
}

.widget--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    min-height: 120px;
}

.widget--photo:hover img {
    filter: brightness(1.05);
}

.widget__caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 12px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
    color: #fff;
    font-size: 12px;
    font-weight: 500;
}

/* ================================================
   Map Widget
   ================================================ */

.widget--map {
    position: relative;
    min-height: 160px;
}

.widget--map img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 160px;
}

.widget__map-label {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ================================================
   Link Widget
   ================================================ */

.widget--link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
}

.widget__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.widget__link-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.widget__link-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget__link-host {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================
   Header Widget (Section Labels)
   ================================================ */

.widget--header {
    background: transparent;
    border: none;
    padding: 16px 4px 4px;
    box-shadow: none;
}

.widget--header:hover {
    box-shadow: none;
}

.widget--header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: -0.3px;
}

/* ================================================
   Quote Widget
   ================================================ */

.widget--quote {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 24px;
    text-align: center;
}

.widget__quote-mark {
    font-size: 48px;
    line-height: 1;
    color: var(--text-tertiary);
    opacity: 0.4;
    margin-bottom: 4px;
}

.widget__quote-text {
    font-size: 18px;
    font-weight: 500;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.5;
    max-width: 360px;
    margin-bottom: 8px;
}

.widget__quote-cite {
    font-size: 13px;
    font-style: normal;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ================================================
   YouTube Widget
   ================================================ */

.widget--youtube {
    position: relative;
    min-height: 120px;
    background: var(--youtube-bg);
}

.widget--youtube img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 120px;
}

.widget__play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: var(--youtube);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 150ms ease;
}

.widget__play-btn svg {
    width: 24px;
    height: 24px;
}

.widget--youtube:hover .widget__play-btn {
    transform: translate(-50%, -50%) scale(1.1);
}

/* ================================================
   Spotify Widget
   ================================================ */

.widget--spotify {
    background: var(--spotify-bg);
    border-color: transparent;
}

.widget__spotify-inner {
    display: flex;
    gap: 12px;
    padding: 14px;
    height: 100%;
}

.widget__spotify-cover {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.widget__spotify-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.widget__spotify-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.widget__spotify-artist {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.widget__spotify-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
    font-size: 11px;
    font-weight: 600;
    color: var(--spotify);
}

.widget__spotify-badge svg {
    width: 16px;
    height: 16px;
    fill: var(--spotify);
}

/* ================================================
   Theme Toggle
   ================================================ */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
    transition: all 150ms ease;
    font-family: inherit;
}

.theme-toggle:hover {
    color: var(--text-secondary);
    border-color: var(--text-tertiary);
}

.theme-toggle-icon {
    font-size: 14px;
    line-height: 1;
}

/* ================================================
   Footer
   ================================================ */

.bento-footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--text-tertiary);
    font-size: 13px;
}

.bento-footer p {
    margin-bottom: 4px;
}

.bento-footer a {
    color: var(--accent);
    text-decoration: underline;
}

.bento-footer a:hover {
    opacity: 0.8;
}

/* ================================================
   Animations
   ================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.widget {
    animation: fadeIn 0.4s ease-out both;
}

.widget:nth-child(1)  { animation-delay: 0.00s; }
.widget:nth-child(2)  { animation-delay: 0.03s; }
.widget:nth-child(3)  { animation-delay: 0.06s; }
.widget:nth-child(4)  { animation-delay: 0.09s; }
.widget:nth-child(5)  { animation-delay: 0.12s; }
.widget:nth-child(6)  { animation-delay: 0.15s; }
.widget:nth-child(7)  { animation-delay: 0.18s; }
.widget:nth-child(8)  { animation-delay: 0.21s; }
.widget:nth-child(9)  { animation-delay: 0.24s; }
.widget:nth-child(10) { animation-delay: 0.27s; }

.widget--deferred {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.widget--deferred.widget--visible {
    opacity: 1;
    transform: translateY(0);
}

::selection {
    background: var(--accent);
    color: white;
}

/* ================================================
   Responsive: Tablet (collapse sidebar to top)
   ================================================ */

@media (max-width: 1024px) {
    .bento-page {
        flex-direction: column;
        align-items: center;
        padding: 24px 16px;
    }

    .bento-sidebar {
        position: static;
        width: 100%;
        max-width: 480px;
        min-width: unset;
        margin-bottom: 16px;
    }

    .bento-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 700px;
        width: 100%;
    }
}

/* ================================================
   Responsive: Mobile (2-col grid, stacked cards)
   ================================================ */

@media (max-width: 640px) {
    .bento-page {
        padding: 16px 12px;
    }

    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .widget--2x2 {
        grid-column: span 2;
        grid-row: span 1;
    }

    .avatar {
        width: 80px;
        height: 80px;
    }

    .sidebar-title {
        font-size: 24px;
    }

    .widget__quote-text {
        font-size: 16px;
    }

    .widget__spotify-inner {
        padding: 10px;
    }

    .widget__spotify-cover {
        width: 60px;
        height: 60px;
    }
}
