/* ============================================
   simulai.net - Victorian Computing Cabinet
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #0B1026;
    color: #B8C4D8;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    letter-spacing: 0.01em;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* --- Hexagonal Lattice Background --- */
.hex-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66ZM28 100L0 84L0 50L28 34L56 50L56 84L28 100Z' fill='none' stroke='%233D4F7F' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 56px 100px;
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 1.2rem 2rem;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

#main-nav.scrolled {
    background: rgba(11, 16, 38, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: #C9A84C;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #C9A84C;
    opacity: 0.85;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.nav-links a:hover {
    opacity: 1;
}

/* --- Bento Sections --- */
.bento-section {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.bento-section:first-of-type {
    padding-top: 6rem;
}

/* --- Bento Grid --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

/* Hero grid layout */
.hero-grid .cell-hero {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}

.hero-grid .cell-gear {
    grid-column: 3;
    grid-row: 1 / 3;
}

.hero-grid .cell-sm:nth-child(3) {
    grid-column: 4;
    grid-row: 1;
}

.hero-grid .cell-wide {
    grid-column: 1 / 3;
    grid-row: 3;
}

.hero-grid .cell-sm:nth-child(5) {
    grid-column: 4;
    grid-row: 2;
}

/* Capabilities grid */
.capabilities-grid .cell-md:nth-child(1) {
    grid-column: 1 / 3;
    grid-row: 1;
}

.capabilities-grid .cell-md:nth-child(2) {
    grid-column: 3 / 5;
    grid-row: 1;
}

.capabilities-grid .cell-tall {
    grid-column: 4;
    grid-row: 2 / 4;
}

.capabilities-grid .cell-sm:nth-child(4) {
    grid-column: 1;
    grid-row: 2;
}

.capabilities-grid .cell-sm:nth-child(5) {
    grid-column: 2;
    grid-row: 2;
}

.capabilities-grid .cell-wide-full {
    grid-column: 1 / 4;
    grid-row: 3;
}

/* Applications grid */
.applications-grid .cell-wide {
    grid-column: 1 / 5;
    grid-row: 1;
}

.applications-grid .cell-sm:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}

.applications-grid .cell-sm:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
}

.applications-grid .cell-sm:nth-child(4) {
    grid-column: 3;
    grid-row: 2;
}

.applications-grid .cell-sm:nth-child(5) {
    grid-column: 4;
    grid-row: 2;
}

.applications-grid .cell-md:nth-child(6) {
    grid-column: 1 / 3;
    grid-row: 3;
}

.applications-grid .cell-md:nth-child(7) {
    grid-column: 3 / 5;
    grid-row: 3;
}

/* --- Bento Cell --- */
.bento-cell {
    border: 1px solid #3D4F7F;
    background: #0B1026;
    position: relative;
    min-height: 200px;
    transition: border-color 0.4s ease-out, background-color 0.4s ease-out;
    overflow: hidden;
    /* Slide reveal - initially hidden */
    opacity: 0;
    transform: translateY(60px);
}

.bento-cell[data-slide="left"] { transform: translateX(-60px); }
.bento-cell[data-slide="right"] { transform: translateX(60px); }
.bento-cell[data-slide="top"] { transform: translateY(-60px); }
.bento-cell[data-slide="bottom"] { transform: translateY(60px); }

.bento-cell.revealed {
    opacity: 1;
    transform: translate(0, 0);
    transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.4s ease-out,
                background-color 0.4s ease-out;
}

.bento-cell:hover {
    border-color: #C9A84C;
    background: #1A2647;
}

.bento-cell.alt-bg {
    background: #131B33;
}

.bento-cell.alt-bg:hover {
    background: #1A2647;
}

/* Cell sizes */
.cell-hero { min-height: 400px; }
.cell-gear { min-height: 400px; }
.cell-tall { min-height: 400px; }
.cell-md { min-height: 280px; }
.cell-wide, .cell-wide-full { min-height: 120px; }

/* --- Corner Brackets --- */
.cell-corners .corner {
    position: absolute;
    width: 20px;
    height: 20px;
    transition: transform 0.4s ease-out, border-color 0.4s ease-out;
}

.corner.tl { top: 6px; left: 6px; border-top: 1px solid #3D4F7F; border-left: 1px solid #3D4F7F; }
.corner.tr { top: 6px; right: 6px; border-top: 1px solid #3D4F7F; border-right: 1px solid #3D4F7F; }
.corner.bl { bottom: 6px; left: 6px; border-bottom: 1px solid #3D4F7F; border-left: 1px solid #3D4F7F; }
.corner.br { bottom: 6px; right: 6px; border-bottom: 1px solid #3D4F7F; border-right: 1px solid #3D4F7F; }

.bento-cell:hover .corner {
    transform: scale(1.1);
    border-color: #C9A84C;
}

/* --- Cell Content --- */
.cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

.cell-horizontal {
    flex-direction: row;
    text-align: left;
}

.cell-label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #C9A84C;
    opacity: 0.85;
    margin-top: 1rem;
}

.cell-desc {
    color: #8090A8;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.cell-text {
    color: #B8C4D8;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.7;
    max-width: 800px;
}

/* --- Hero Content --- */
.hero-content {
    align-items: flex-start;
    text-align: left;
    padding: 3rem;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: #C9A84C;
    animation: etchIn 2s ease-out forwards;
}

@keyframes etchIn {
    from { font-weight: 400; opacity: 0.6; }
    to { font-weight: 700; opacity: 1; }
}

.hero-subtitle {
    font-family: 'DM Sans', sans-serif;
    color: #E8DCC8;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 1.7;
    margin-top: 1.5rem;
    max-width: 520px;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #E8DCC8;
    letter-spacing: 0.02em;
    line-height: 1.1;
}

/* --- Guilloche Border --- */
.guilloche-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.guilloche-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: guillocheReveal 30s linear infinite;
}

@keyframes guillocheReveal {
    from { stroke-dashoffset: 2000; }
    to { stroke-dashoffset: 0; }
}

/* --- SVG Icons --- */
.icon-svg {
    width: 80px;
    height: 80px;
}

.icon-svg.icon-lg {
    width: 110px;
    height: 110px;
}

.draw-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.bento-cell.revealed .draw-path {
    stroke-dashoffset: 0;
}

/* --- Ornamental Dividers --- */
.ornamental-divider {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
}

.divider-svg {
    width: 100%;
    height: 60px;
}

/* --- Narrative Panels --- */
.narrative-panel {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.rosette-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    opacity: 0.1;
    pointer-events: none;
}

.rosette-watermark {
    width: 100%;
    height: 100%;
    animation: rosetteRotate 720s linear infinite;
}

@keyframes rosetteRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.narrative-text {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    color: #E8DCC8;
    line-height: 1.6;
    text-align: center;
    max-width: 700px;
    position: relative;
    z-index: 2;
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-mark {
    display: block;
    margin-top: 3rem;
    font-size: 2rem;
    color: #C9A84C;
    opacity: 0.6;
}

.narrative-final {
    padding-bottom: 8rem;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-grid .cell-hero { grid-column: 1 / 3; grid-row: 1; }
    .hero-grid .cell-gear { grid-column: 1; grid-row: 2; }
    .hero-grid .cell-sm:nth-child(3) { grid-column: 2; grid-row: 2; }
    .hero-grid .cell-wide { grid-column: 1 / 3; grid-row: 3; }
    .hero-grid .cell-sm:nth-child(5) { grid-column: 1; grid-row: 4; }

    .capabilities-grid .cell-md:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
    .capabilities-grid .cell-md:nth-child(2) { grid-column: 1 / 3; grid-row: 2; }
    .capabilities-grid .cell-tall { grid-column: 1 / 3; grid-row: 3; min-height: 280px; }
    .capabilities-grid .cell-sm:nth-child(4) { grid-column: 1; grid-row: 4; }
    .capabilities-grid .cell-sm:nth-child(5) { grid-column: 2; grid-row: 4; }
    .capabilities-grid .cell-wide-full { grid-column: 1 / 3; grid-row: 5; }

    .applications-grid .cell-wide { grid-column: 1 / 3; }
    .applications-grid .cell-sm:nth-child(2) { grid-column: 1; grid-row: 2; }
    .applications-grid .cell-sm:nth-child(3) { grid-column: 2; grid-row: 2; }
    .applications-grid .cell-sm:nth-child(4) { grid-column: 1; grid-row: 3; }
    .applications-grid .cell-sm:nth-child(5) { grid-column: 2; grid-row: 3; }
    .applications-grid .cell-md:nth-child(6) { grid-column: 1 / 3; grid-row: 4; }
    .applications-grid .cell-md:nth-child(7) { grid-column: 1 / 3; grid-row: 5; }
}

@media (max-width: 640px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }

    .hero-grid .cell-hero,
    .hero-grid .cell-gear,
    .hero-grid .cell-sm:nth-child(3),
    .hero-grid .cell-wide,
    .hero-grid .cell-sm:nth-child(5),
    .capabilities-grid .cell-md:nth-child(1),
    .capabilities-grid .cell-md:nth-child(2),
    .capabilities-grid .cell-tall,
    .capabilities-grid .cell-sm:nth-child(4),
    .capabilities-grid .cell-sm:nth-child(5),
    .capabilities-grid .cell-wide-full,
    .applications-grid .cell-wide,
    .applications-grid .cell-sm,
    .applications-grid .cell-md {
        grid-column: 1;
        grid-row: auto;
    }

    .nav-links { gap: 1.5rem; }
    .hero-content { padding: 2rem; }
    .cell-hero { min-height: 300px; }
}
