:root {
    /* Typography compliance notes: (Google Fonts with `textPath` on a circular `<path>`. Colors: `#B5654A` strokes on `#EDE3D4` backgrounds. Interaction:** Interaction* IntersectionObserver`. */
    --dark-umber: #2C2016;
    --terracotta: #B5654A;
    --clay-rose: #C4876E;
    --walnut: #5C4A3A;
    --espresso: #3B2F20;
    --sage: #7A8B6D;
    --parchment: #EDE3D4;
    --concrete: #A49E93;
    --camel: #8B7355;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    background: #EDE3D4;
    background-image: repeating-linear-gradient(0deg, rgba(44, 32, 22, 0.04) 0 1px, transparent 1px 40px), repeating-linear-gradient(90deg, rgba(44, 32, 22, 0.04) 0 1px, transparent 1px 40px);
    color: #5C4A3A;
    font-family: "Work Sans", sans-serif;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    line-height: 1.65;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
    width: 100vw;
    height: 100vh;
    background: #2C2016;
}

.bento-cell {
    position: relative;
    overflow: hidden;
    background: #EDE3D4;
    box-shadow: 0 1px 3px rgba(44, 32, 22, 0.15);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    isolation: isolate;
}

.bento-cell:hover {
    transform: scale(1.008);
    z-index: 6;
}

.bento-cell:hover .bento-cell-border rect {
    animation-name: draw-border, border-pulse;
    animation-duration: 1.2s, 0.3s;
    animation-timing-function: ease-out, ease-in-out;
    animation-fill-mode: forwards, none;
}

.bento-content {
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: clamp(1rem, 2.6vw, 2.8rem);
    display: flex;
    flex-direction: column;
}

.bento-cell-border {
    position: absolute;
    inset: 0;
    z-index: 4;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bento-cell-border rect {
    fill: none;
    stroke: #B5654A;
    stroke-width: 1.5;
    stroke-dasharray: var(--perimeter, 1000);
    stroke-dashoffset: var(--perimeter, 1000);
    vector-effect: non-scaling-stroke;
    animation: draw-border 1.2s ease-out forwards;
    animation-delay: calc(var(--cell-index) * 0.15s);
}

@keyframes draw-border { to { stroke-dashoffset: 0; } }
@keyframes border-pulse { 50% { opacity: 0.6; } }

.hero-cell { grid-column: 1 / 7; grid-row: 1 / 5; }
.city-cell { grid-column: 7 / 10; grid-row: 1 / 6; background: #EDE3D4; }
.stat-active { grid-column: 10 / 13; grid-row: 1 / 3; }
.stat-pending { grid-column: 10 / 13; grid-row: 3 / 5; }
.seal-cell { grid-column: 10 / 13; grid-row: 5 / 7; }
.permit-a { grid-column: 1 / 4; grid-row: 5 / 7; }
.permit-b { grid-column: 4 / 7; grid-row: 5 / 7; }
.timeline-cell { grid-column: 1 / 7; grid-row: 7 / 9; }
.dataflow-cell { grid-column: 7 / 13; grid-row: 6 / 9; }

.hero-content {
    justify-content: center;
    align-items: flex-start;
}

.mono-kicker,
.cell-label,
.permit-code,
.dataflow-diagram text {
    margin: 0;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: #B5654A;
}

.hero-title {
    margin: 0.35rem 0 0;
    color: #3B2F20;
    font-family: "Josefin Sans", sans-serif;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 600;
    line-height: 0.92;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-tagline {
    max-width: 24rem;
    margin: 1.2rem 0 0;
    color: #5C4A3A;
    font-weight: 300;
    letter-spacing: 0.03em;
}

.city-skyline-backdrop,
.city-skyline-main {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    box-sizing: border-box;
}

.city-skyline-backdrop {
    z-index: 1;
    height: 62%;
    padding: 0 clamp(1rem, 3vw, 2.2rem);
}

.city-skyline-main {
    height: 86%;
    padding: 0 10% 12%;
    gap: 7px;
}

.building {
    flex: 1;
    height: var(--building-height, 44%);
    min-width: 8px;
    min-height: 12px;
    background: #2C2016;
    border-radius: 2px 2px 0 0;
    opacity: 0.08;
    transform-origin: bottom;
    transform: scaleY(0);
    animation: building-rise 1.5s ease-out forwards;
    animation-delay: calc(1.9s + var(--cell-index) * 0.15s + var(--building-delay, 0s));
}

.city-cell .building { opacity: 0.16; background: #5C4A3A; }
.building:nth-child(1) { --building-height: 30%; --building-delay: 0.02s; }
.building:nth-child(2) { --building-height: 56%; --building-delay: 0.09s; }
.building:nth-child(3) { --building-height: 38%; --building-delay: 0.14s; }
.building:nth-child(4) { --building-height: 74%; --building-delay: 0.04s; }
.building:nth-child(5) { --building-height: 47%; --building-delay: 0.18s; }
.building:nth-child(6) { --building-height: 64%; --building-delay: 0.11s; }
.building:nth-child(7) { --building-height: 35%; --building-delay: 0.22s; }
.building:nth-child(8) { --building-height: 82%; --building-delay: 0.16s; }
.building:nth-child(9) { --building-height: 52%; --building-delay: 0.2s; }
.building:nth-child(10) { --building-height: 70%; --building-delay: 0.12s; }
.building:nth-child(11) { --building-height: 42%; --building-delay: 0.25s; }
.building:nth-child(12) { --building-height: 60%; --building-delay: 0.07s; }

@keyframes building-rise { to { transform: scaleY(1); } }

.city-content { justify-content: flex-start; }
.scan-line {
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 22%;
    height: 1px;
    background: #B5654A;
    opacity: 0.65;
    animation: scan 4s ease-in-out 2.2s infinite;
}

@keyframes scan { 50% { transform: translateY(-34vh); opacity: 0.25; } }

.stat-content,
.seal-content,
.permit-content,
.timeline-content,
.dataflow-content {
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-label {
    margin: 0.45rem 0 0;
    color: #5C4A3A;
    font-size: clamp(0.75rem, 0.9vw, 0.95rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.stat-number {
    margin: 0.25rem 0 0;
    color: #B5654A;
    font-family: "IBM Plex Mono", monospace;
    font-size: clamp(1.6rem, 3vw, 3rem);
    font-weight: 400;
    letter-spacing: 0.04em;
}

.status-mark {
    width: 22px;
    height: 22px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    color: #7A8B6D;
    position: relative;
}

.approved-mark::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 4px;
    width: 7px;
    height: 11px;
    border: solid #7A8B6D;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.pending-mark { color: #C4876E; animation: pending-spin 3s linear infinite; }
.pending-mark::after {
    content: "";
    position: absolute;
    right: -3px;
    top: 2px;
    width: 8px;
    height: 8px;
    border-top: 2px solid #C4876E;
    border-right: 2px solid #C4876E;
}
@keyframes pending-spin { to { transform: rotate(360deg); } }

.official-seal {
    width: min(74%, 150px);
    overflow: visible;
    animation: seal-spin 20s linear infinite;
    animation-delay: 2s;
}

.seal-ring,
.seal-check {
    fill: none;
    stroke: #B5654A;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.seal-ring { stroke-dasharray: 8 7; }
.seal-ring.middle { stroke: #7A8B6D; stroke-dasharray: 3 6; }
.seal-ring.inner { stroke-dasharray: none; }
.seal-text { fill: #B5654A; font-family: "IBM Plex Mono", monospace; font-size: 9px; letter-spacing: 2px; }
.seal-check { stroke: #7A8B6D; stroke-width: 6; }
@keyframes seal-spin { to { transform: rotate(360deg); } }

.permit-title,
.timeline-title,
.dataflow-title {
    margin: 0;
    color: #3B2F20;
    font-family: "Josefin Sans", sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.5rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1.1;
    text-transform: uppercase;
}

.permit-code { margin-top: 0.65rem; color: #B5654A; }
.sankey-flow { width: 100%; height: min(46%, 112px); margin-top: 0.8rem; overflow: visible; }
.sankey-path,
.flow-path {
    fill: none;
    stroke: #B5654A;
    stroke-linecap: round;
    stroke-dasharray: var(--path-length, 700);
    stroke-dashoffset: var(--path-length, 700);
    animation: sankey-draw 3s ease-out forwards;
    animation-delay: calc(2s + var(--cell-index) * 0.15s);
}
.sankey-path.thick { stroke-width: 7; opacity: 0.72; }
.sankey-path.thin { stroke-width: 3; opacity: 0.58; }
@keyframes sankey-draw { to { stroke-dashoffset: 0; } }
.sankey-node,
.flow-node { opacity: 0; transform-box: fill-box; transform-origin: center; animation: node-appear 0.55s ease-out forwards; animation-delay: calc(3s + var(--cell-index) * 0.15s); }
.approved { fill: #7A8B6D; }
.pending { fill: #C4876E; }
.expired { fill: #A49E93; }
@keyframes node-appear { from { transform: scale(0); } to { opacity: 1; transform: scale(1); } }

.timeline { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; width: 100%; margin-top: 1.3rem; }
.timeline::before { content: ""; position: absolute; left: 12%; right: 12%; top: 11px; height: 2px; background: #A49E93; opacity: 0.45; }
.timeline-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.65rem; }
.timeline-marker { width: 18px; height: 18px; border-radius: 50%; background: #7A8B6D; box-shadow: 0 0 0 4px #EDE3D4, 0 0 0 5px #7A8B6D; opacity: 0; animation: marker-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; animation-delay: calc(2s + var(--cell-index) * 0.15s); }
.timeline-marker.pending { background: #C4876E; box-shadow: 0 0 0 4px #EDE3D4, 0 0 0 5px #C4876E; }
.timeline-label { color: #5C4A3A; font-size: 0.85rem; }
@keyframes marker-pop { to { opacity: 1; transform: scale(1); } }

.dataflow-content { align-items: stretch; }
.dataflow-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.25rem; }
.dataflow-head .permit-code { margin: 0; color: #7A8B6D; }
.dataflow-diagram { flex: 1; width: 100%; min-height: 0; }
.flow-path.main { stroke-width: 10; opacity: 0.52; }
.flow-path.branch { stroke-width: 5; stroke: #C4876E; opacity: 0.62; }
.flow-path.muted { stroke: #A49E93; stroke-width: 3; }
.flow-node.secondary { fill: #C4876E; }
.dataflow-diagram text { fill: #5C4A3A; font-size: 12px; }

@media (max-width: 767px) {
    html,
    body { height: auto; overflow-y: auto; }
    .bento-grid { grid-template-columns: 1fr; grid-template-rows: none; width: 100%; height: auto; min-height: 100vh; }
    .bento-cell { grid-column: 1 !important; grid-row: auto !important; min-height: 300px; aspect-ratio: 1 / 0.72; }
    .hero-cell { aspect-ratio: 1 / 0.86; }
    .stat-cell { min-height: 220px; aspect-ratio: 1 / 0.48; }
    .dataflow-cell { aspect-ratio: 1 / 0.94; }
    .bento-content { padding: clamp(1rem, 6vw, 2rem); }
    .hero-title { font-size: clamp(2.35rem, 13vw, 4rem); }
    .timeline { gap: 0.4rem; }
    .timeline-label { font-size: 0.72rem; }
    .dataflow-head { flex-direction: column; align-items: center; }
}
