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

/* CSS Variables */
:root {
    --bg: #ffffff;
    --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: 24px;
    --radius-sm: 12px;
    --gap: 40px;
    --sidebar-width: 235px;

    /* 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: 95px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 100px 64px 48px;
}

/* ================================================
   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: flex-start;
    text-align: left;
    padding: 0;
}

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

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

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

.sidebar-contact {
    font-size: 16px;
    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;
}

/* Original Bento hero: 4-column desktop and 2-column mobile placement. */
.house-gallery {
    grid-column: 1 / -1;
    container-type: inline-size;
    min-width: 0;
}

.house-gallery__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: calc((100cqw - 3 * var(--gap)) / 4);
    gap: var(--gap);
}

.gallery-intro { grid-area: 1 / 1 / 2 / 3; }
.gallery-living { grid-area: 2 / 1 / 4 / 3; }
.gallery-dining { grid-area: 4 / 1 / 5 / 3; }
.gallery-workspace { grid-area: 3 / 3 / 4 / 4; }
.gallery-kitchen { grid-area: 5 / 2 / 6 / 4; }
.gallery-backyard { grid-area: 3 / 4 / 5 / 5; }
.gallery-map { grid-area: 1 / 3 / 3 / 5; }
.gallery-quote { grid-area: 5 / 1 / 7 / 2; }

.house-gallery .widget--photo img { min-height: 0; }
.gallery-intro img { object-position: center; }
.house-gallery .gallery-quote { padding: clamp(16px, 3cqw, 24px); }
.gallery-quote .widget__quote-text { font-size: clamp(14px, 2.2cqw, 18px); }

/* Public neighborhood overview. The halo is approximate, never a house pin. */
.neighborhood-map { background: #f5f7f2; isolation: isolate; }
.neighborhood-map__link { position: absolute; inset: 0; display: block; }
.neighborhood-map__tiles { position: absolute; inset: 0; overflow: hidden; filter: saturate(.45) contrast(.72) brightness(1.18); opacity: .66; }
.neighborhood-map__tiles img { position: absolute; width: 50%; height: 50%; max-width: none; }
.neighborhood-map__halo {
    position: absolute;
    left: 50%; top: 50%; width: 76px; height: 76px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, #739df499 0%, #83aff275 38%, #95b8f42b 65%, transparent 75%);
}
.neighborhood-map__halo::after {
    content: "";
    position: absolute; inset: 23px;
    border: 2px solid #ffffffd9;
    border-radius: 50%;
    box-shadow: 0 0 0 5px #8eb0f64d;
}
.neighborhood-map__caption {
    position: absolute; left: 14px; right: 10px; bottom: 26px;
    color: #464f48; font-size: 12px; font-weight: 500;
    text-shadow: 0 1px 3px white, 0 0 8px white;
}
.neighborhood-map__attribution {
    position: absolute; bottom: 3px; right: 6px;
    font-size: 9px; line-height: 1.5; color: #39433b;
    background: #ffffffe6; border-radius: 3px; padding: 1px 3px;
}
.neighborhood-map__attribution:hover { text-decoration: underline; }
.neighborhood-map__link:focus-visible { outline: 3px solid var(--accent); outline-offset: -5px; border-radius: inherit; }

/* One compact four-column module across all lower sections. */
.link-section { grid-column: 1 / -1; min-width: 0; margin-top: 0; }
.bento-grid { row-gap: 24px; }
.link-section + .link-section { margin-top: 0; }
.link-section__header { margin-bottom: 8px; }
.link-section__header h2 { font-size: 15px; font-weight: 600; letter-spacing: -.2px; line-height: 1.4; color: var(--text-secondary); }
.link-section__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.link-section .widget { border-radius: 10px; min-width: 0; }
.link-section a.widget { transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.link-section a.widget:hover { border-color: var(--text-tertiary); transform: translateY(-2px); }
.link-section .widget:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.widget--link { position: relative; display: flex; flex-direction: row; align-items: center; gap: 8px; padding: 10px; height: auto; cursor: pointer; }
.widget__icon { width: 22px; height: 22px; border-radius: 6px; object-fit: contain; flex-shrink: 0; background: transparent; padding: 0; border: none; }
.widget__icon--line, .widget__icon--monogram { display: grid; place-items: center; color: var(--text-secondary); }
.widget__icon--line svg { width: 22px; height: 22px; }
.widget__icon--monogram { font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.widget__link-text { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.widget__link-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.widget__link-host { font-size: 11px; line-height: 1.3; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-section--community-projects .link-section__grid { grid-auto-rows: 72px; }
.link-section--community-projects .widget--photo,
.link-section--community-projects .widget--youtube { grid-column: span 2; grid-row: span 2; min-height: 0; }
.link-section--community-projects .widget--photo img,
.link-section--community-projects .widget--youtube img { position: absolute; inset: 0; min-height: 0; }
.link-section button.widget--photo { font: inherit; text-align: left; }
.link-section .widget__caption { font-size: 12px; padding: 32px 14px 12px; }


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

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

.widget__quote-mark {
    font-size: 40px;
    line-height: 1;
    color: var(--text-primary);
    opacity: 0.8;
    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 { grid-column: span 2; background: var(--card-bg); }
.widget__spotify-inner { display: flex; align-items: center; gap: 10px; padding: 10px; height: 100%; }
.widget__spotify-cover { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.widget__spotify-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.widget__spotify-title { font-size: 13px; font-weight: 600; line-height: 1.3; }
.widget__spotify-artist { font-size: 12px; color: var(--text-secondary); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.widget__spotify-badge { display: inline-flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 10px; color: var(--text-secondary); }
.widget__spotify-badge svg { width: 12px; height: 12px; 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) {
    :root { --gap: 24px; --radius: 22px; }
    .bento-page { flex-direction: column; align-items: center; gap: 40px; padding: 48px 24px; }
    .bento-sidebar { position: static; width: 100%; max-width: 390px; min-width: 0; padding: 0 24px; }
    .avatar { width: 120px; height: 120px; }
    .sidebar-title { font-size: 28px; }
    .sidebar-bio { font-size: 14px; }
    .sidebar-contact { font-size: 13px; }
    .bento-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 390px; width: 100%; }
    .house-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: calc((100cqw - var(--gap)) / 2); }
    .gallery-intro { grid-area: 1 / 1 / 2 / 3; }
    .gallery-living { grid-area: 2 / 1 / 4 / 3; }
    .gallery-dining { grid-area: 4 / 1 / 5 / 2; }
    .gallery-workspace { grid-area: 4 / 2 / 5 / 3; }
    .gallery-kitchen { grid-area: 5 / 1 / 6 / 2; }
    .gallery-backyard { grid-area: 5 / 2 / 6 / 3; }
    .gallery-map { grid-area: 6 / 1 / 8 / 3; }
    .gallery-quote { grid-area: 8 / 2 / 10 / 3; }
}

@media (max-width: 640px) {
    :root { --gap: 20px; }
    .bento-page { padding: 32px 24px; }
    .sidebar-title { font-size: 24px; }
    .widget--quote { padding: 20px; }
    .widget__quote-text { font-size: 15px; }
    .widget__quote-cite { font-size: 11px; }
    .widget--2x2 { grid-column: span 2; grid-row: span 1; }
}

@media (max-width: 1024px) {
    .bento-grid { row-gap: 20px; }
    .link-section, .link-section + .link-section { margin-top: 0; }
    .link-section__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .widget--link { padding: 8px; gap: 6px; }
    .widget__icon, .widget__icon--line svg { width: 20px; height: 20px; }
    .widget__link-title { font-size: 13px; }
    .link-section--community-projects .link-section__grid { grid-auto-rows: auto; }
    .link-section--community-projects .widget--photo,
    .link-section--community-projects .widget--youtube { grid-row: auto; aspect-ratio: 2 / 1; }
    .widget__spotify-inner { padding: 10px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .link-section a.widget:hover { transform: none; }
}
