/* === Custom Properties === */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 135deg;
    inherits: false;
}

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

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

body {
    background-color: #0b1120;
    /* Secondary background used for deeper sections */
    background-image: linear-gradient(to bottom, #0b1120 0%, #131b2e 100%);
    color: #d8dce6;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* === Grid Lattice Background === */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, rgba(42, 58, 90, 0.15) 0px, rgba(42, 58, 90, 0.15) 1px, transparent 1px, transparent 64px),
        repeating-linear-gradient(90deg, rgba(42, 58, 90, 0.15) 0px, rgba(42, 58, 90, 0.15) 1px, transparent 1px, transparent 64px);
    pointer-events: none;
    z-index: 0;
}

/* === Bubble Field === */
.bubble-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(184, 196, 216, 0.04);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: none;
    will-change: transform;
}

.bubble--1 { width: 180px; height: 180px; top: 5%; left: 10%; animation: drift1 80s ease-in-out infinite; }
.bubble--2 { width: 60px; height: 60px; top: 15%; left: 75%; animation: drift2 100s ease-in-out infinite; }
.bubble--3 { width: 140px; height: 140px; top: 40%; left: 5%; animation: drift3 90s ease-in-out infinite; }
.bubble--4 { width: 90px; height: 90px; top: 60%; left: 85%; animation: drift4 70s ease-in-out infinite; }
.bubble--5 { width: 200px; height: 200px; top: 75%; left: 40%; animation: drift5 120s ease-in-out infinite; }
.bubble--6 { width: 50px; height: 50px; top: 25%; left: 55%; animation: drift6 95s ease-in-out infinite; }
.bubble--7 { width: 110px; height: 110px; top: 85%; left: 15%; animation: drift7 75s ease-in-out infinite; }
.bubble--8 { width: 70px; height: 70px; top: 10%; left: 40%; animation: drift8 110s ease-in-out infinite; }
.bubble--9 { width: 45px; height: 45px; top: 50%; left: 60%; animation: drift9 85s ease-in-out infinite; }
.bubble--10 { width: 160px; height: 160px; top: 30%; left: 90%; animation: drift10 65s ease-in-out infinite; }

@keyframes drift1 { 0%, 100% { transform: translate(0, 0) scale(1); } 25% { transform: translate(40px, -30px) scale(1.05); } 50% { transform: translate(-20px, 50px) scale(0.95); } 75% { transform: translate(30px, 20px) scale(1.02); } }
@keyframes drift2 { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(-50px, 40px) scale(1.1); } 66% { transform: translate(30px, -20px) scale(0.9); } }
@keyframes drift3 { 0%, 100% { transform: translate(0, 0) scale(1); } 25% { transform: translate(60px, 20px) scale(0.95); } 50% { transform: translate(-30px, -40px) scale(1.08); } 75% { transform: translate(20px, 60px) scale(0.98); } }
@keyframes drift4 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-40px, -30px) scale(1.06); } }
@keyframes drift5 { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(30px, -50px) scale(0.92); } 66% { transform: translate(-50px, 20px) scale(1.04); } }
@keyframes drift6 { 0%, 100% { transform: translate(0, 0) scale(1); } 25% { transform: translate(-30px, 50px) scale(1.12); } 75% { transform: translate(40px, -20px) scale(0.88); } }
@keyframes drift7 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(50px, -40px) scale(1.05); } }
@keyframes drift8 { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(-20px, -60px) scale(0.95); } 66% { transform: translate(40px, 30px) scale(1.08); } }
@keyframes drift9 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-60px, 40px) scale(1.1); } }
@keyframes drift10 { 0%, 100% { transform: translate(0, 0) scale(1); } 25% { transform: translate(-40px, 50px) scale(0.94); } 75% { transform: translate(30px, -30px) scale(1.06); } }

/* === Bento Grid === */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 100vh auto auto auto;
    gap: 1px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

/* === Cells === */
.cell {
    background: #1a2440;
    border: 1px solid transparent;
    border-image: linear-gradient(var(--border-angle), #2a3a5a, #4a5a7a) 1;
    padding: 2rem;
    transition: --border-angle 800ms ease-in-out, border-color 300ms ease;
    position: relative;
}

.cell:hover {
    --border-angle: 495deg;
}

/* === Hero Cell === */
.cell--hero {
    grid-column: 1 / 9;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 4rem;
    scroll-snap-align: start;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.monogram-seal {
    opacity: 0.9;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    color: #e0e8f4;
    line-height: 1.1;
}

.hero-tagline {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.25rem);
    color: #7b8da8;
    max-width: 480px;
}

/* === Accent Cells === */
.cell--accent {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
}

.cell--timestamp {
    grid-column: 9 / 12;
    grid-row: 1 / 2;
    align-self: start;
    margin-top: 4rem;
}

.cell--status {
    grid-column: 9 / 12;
    grid-row: 1 / 2;
    align-self: end;
    margin-bottom: 4rem;
}

.accent-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7b8da8;
}

.timestamp-value {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #b8c4d8;
    letter-spacing: 0.04em;
}

.status-indicator {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: #b8c4d8;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c49a6c;
    display: inline-block;
    animation: pulse-dot 3s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === Narrative Cells === */
.cell--narrative {
    scroll-snap-align: start;
}

.cell--about {
    grid-column: 1 / 7;
    grid-row: 2;
}

.cell--work {
    grid-column: 4 / 11;
    grid-row: 3;
}

.cell--contact {
    grid-column: 2 / 8;
    grid-row: 4;
}

.narrative-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    letter-spacing: -0.02em;
    color: #e0e8f4;
    margin-bottom: 1rem;
}

.narrative-text {
    color: #d8dce6;
    margin-bottom: 1rem;
    max-width: 560px;
}

.narrative-text:last-of-type {
    margin-bottom: 0;
}

/* === Work Tags === */
.work-tags {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.work-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #b8c4d8;
    border: 1px solid #2a3a5a;
    padding: 0.4rem 0.8rem;
}

/* === Contact Email === */
.contact-email {
    display: inline-block;
    margin-top: 1.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #c49a6c;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(196, 154, 108, 0.3);
    padding-bottom: 2px;
    transition: color 300ms ease, border-color 300ms ease;
}

.contact-email:hover {
    color: #e0e8f4;
    border-color: rgba(224, 232, 244, 0.3);
}

/* === Void Cells === */
.cell--void {
    border: 1px dashed #5a6a8a;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.cell--void::after {
    content: attr(data-label);
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5a6a8a;
    opacity: 0.6;
}

.cell--void:nth-of-type(1) {
    grid-column: 8 / 12;
    grid-row: 2;
}

.cell--void:nth-of-type(2) {
    grid-column: 1 / 4;
    grid-row: 3;
}

/* Provisional stamps inside void cells */
.cell--void::before {
    content: '臨時';
    position: absolute;
    font-family: 'DM Sans', sans-serif;
    font-size: 1.5rem;
    color: #1a2440;
    opacity: 0.3;
    transform: rotate(-15deg);
    pointer-events: none;
}

/* === Version Footer === */
.cell--version {
    grid-column: 10 / 13;
    grid-row: 4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.version-text {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: #5a6a8a;
}

/* === Shake Animation === */
@keyframes shake {
    0% { transform: translateX(0); }
    16% { transform: translateX(-8px); }
    33% { transform: translateX(8px); }
    50% { transform: translateX(-4px); }
    66% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

.cell--void.shaking {
    animation: shake 400ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
    border-color: #d4564e;
}

/* === Responsive === */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 100svh repeat(auto-fill, auto);
        padding: 1rem;
    }

    .cell--hero { grid-column: 1; grid-row: auto; padding: 2rem; }
    .cell--timestamp { grid-column: 1; grid-row: auto; margin-top: 0; align-self: auto; }
    .cell--status { grid-column: 1; grid-row: auto; margin-bottom: 0; align-self: auto; }
    .cell--about { grid-column: 1; grid-row: auto; }
    .cell--work { grid-column: 1; grid-row: auto; }
    .cell--contact { grid-column: 1; grid-row: auto; }
    .cell--version { grid-column: 1; grid-row: auto; }

    .cell--void { display: none; }

    .bubble:nth-child(n+5) { display: none; }
}
