/* =============================================
   license.broker — Styles
   Municipal Licensing Operations
   Monochrome Wabi-Sabi Dashboard
   ============================================= */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: #0f0f0f;
    color: #909090;
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    position: relative;
}

/* --- City Grid Background --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(90deg, #151515 0px, #151515 1px, transparent 1px, transparent 80px),
        repeating-linear-gradient(0deg, #151515 0px, #151515 1px, transparent 1px, transparent 80px);
    opacity: 0.4;
}

/* --- Noise Overlay --- */
#noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* --- Scroll Progress --- */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background-color: #3a3a3a;
    z-index: 10000;
    transition: background-color 0.3s ease;
}

#scroll-progress.complete {
    background-color: #e0e0e0;
}

/* --- Registry Column (Left Sidebar) --- */
#registry-column {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 220px;
    background-color: #1a1a1a;
    border-right: 1px solid #3a3a3a;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding-top: 48px;
}

.registry-header {
    padding: 16px 0;
    text-align: center;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 16px;
}

.registry-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: #666666;
    text-transform: uppercase;
}

.registry-tab {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    text-decoration: none;
    color: #666666;
    background-color: transparent;
    border-left: 2px solid transparent;
    transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
    position: relative;
}

.registry-tab:hover {
    background-color: #222222;
    color: #b0b0b0;
}

.registry-tab.active {
    border-left-color: #ffffff;
    color: #b0b0b0;
    background-color: #1f1f1f;
}

.tab-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    white-space: nowrap;
}

/* --- Main Processing Area --- */
#processing-area {
    margin-left: 220px;
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* --- Stamp Marks (decorative) --- */
.stamp-mark {
    position: absolute;
    border: 1px dashed #1a1a1a;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.stamp-mark-1 {
    width: 200px;
    height: 200px;
    top: 120px;
    right: 40px;
}

.stamp-mark-2 {
    width: 120px;
    height: 120px;
    top: 800px;
    left: 30px;
}

.stamp-mark-3 {
    width: 160px;
    height: 160px;
    bottom: 300px;
    right: 100px;
}

/* --- Permit Grid --- */
.permit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1px;
    max-width: 1280px;
    background-color: #2a2a2a; /* border/rule between blocks; deep-ground: #0a0a0a */
    position: relative;
    z-index: 1;
}

/* --- Permit Block --- */
.permit-block {
    background-color: #0f0f0f;
    padding: 48px;
    position: relative;
    overflow: hidden;
    cursor: default;
}

.permit-block-wide {
    grid-column: 1 / -1;
}

/* --- Block Typography --- */
.block-headline {
    font-family: 'Archivo Black', sans-serif;
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e0e0e0;
    margin-bottom: 8px;
    line-height: 1.1;
}

.block-subheadline {
    font-family: 'Chivo', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2.2vw, 1.6rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #b0b0b0;
    margin-bottom: 24px;
    line-height: 1.2;
}

.block-body {
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #909090;
    max-width: 580px;
    margin-bottom: 24px;
}

.block-metadata {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: #666666;
    display: block;
    margin-top: 16px;
}

.block-metadata.typewriter-text {
    visibility: hidden;
}

.block-metadata.typewriter-text.revealed {
    visibility: visible;
}

/* --- Ripple Effect --- */
@keyframes stamp-ripple {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0.5;
        border-color: #3a3a3a;
    }
    70% {
        opacity: 0.15;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
        border-color: #2a2a2a;
    }
}

.ripple-ring {
    position: absolute;
    border: 1px solid #3a3a3a;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    pointer-events: none;
    animation: stamp-ripple 0.8s ease-out forwards;
    z-index: 2;
}

/* --- Isometric Icons --- */
.iso-icon {
    width: 64px;
    height: 64px;
    position: relative;
    margin-bottom: 24px;
    transform-style: preserve-3d;
    perspective: 400px;
}

.iso-face {
    position: absolute;
    transition: transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Building Icon --- */
.iso-building {
    width: 64px;
    height: 80px;
}

.iso-building .iso-face-top {
    width: 48px;
    height: 24px;
    background: #3a3a3a;
    transform: skewX(-30deg);
    top: 0;
    left: 12px;
}

.iso-building .iso-face-left {
    width: 36px;
    height: 56px;
    background: #2a2a2a;
    top: 16px;
    left: 0;
    transform: skewY(-15deg);
}

.iso-building .iso-face-right {
    width: 36px;
    height: 56px;
    background: #1a1a1a;
    top: 6px;
    left: 28px;
    transform: skewY(15deg);
}

.iso-building .iso-windows {
    position: absolute;
    top: 22px;
    left: 4px;
    width: 28px;
    height: 44px;
    border: 2px dashed #3a3a3a;
    opacity: 0.4;
    pointer-events: none;
}

.iso-building-small {
    transform: scale(0.75);
    transform-origin: top left;
}

/* --- Stamp Icon --- */
.iso-stamp {
    width: 56px;
    height: 56px;
}

.iso-stamp .iso-face-top {
    width: 40px;
    height: 40px;
    background: #3a3a3a;
    border-radius: 50%;
    top: 0;
    left: 8px;
}

.iso-stamp .iso-face-left {
    width: 24px;
    height: 16px;
    background: #2a2a2a;
    bottom: 0;
    left: 8px;
    transform: skewY(-10deg);
}

.iso-stamp .iso-face-right {
    width: 24px;
    height: 16px;
    background: #1a1a1a;
    bottom: 0;
    right: 8px;
    transform: skewY(10deg);
}

/* --- Clipboard Icon --- */
.iso-clipboard {
    width: 48px;
    height: 64px;
}

.iso-clipboard .iso-face-top {
    width: 40px;
    height: 8px;
    background: #3a3a3a;
    top: 0;
    left: 4px;
}

.iso-clipboard .iso-face-left {
    width: 2px;
    height: 56px;
    background: #2a2a2a;
    top: 8px;
    left: 4px;
}

.iso-clipboard .iso-face-right {
    width: 36px;
    height: 56px;
    background: #1a1a1a;
    top: 8px;
    left: 6px;
    border: 1px solid #2a2a2a;
}

.iso-clip {
    position: absolute;
    width: 16px;
    height: 8px;
    background: #3a3a3a;
    top: -2px;
    left: 16px;
    border-radius: 2px;
}

/* --- Key Icon --- */
.iso-key {
    width: 56px;
    height: 56px;
}

.iso-key .iso-face-top {
    width: 24px;
    height: 24px;
    background: #3a3a3a;
    border-radius: 50%;
    top: 0;
    left: 4px;
    border: 4px solid #2a2a2a;
}

.iso-key .iso-face-left {
    width: 4px;
    height: 28px;
    background: #2a2a2a;
    top: 20px;
    left: 14px;
}

.iso-key .iso-face-right {
    width: 12px;
    height: 4px;
    background: #3a3a3a;
    top: 36px;
    left: 18px;
}

/* --- Cabinet Icon --- */
.iso-cabinet {
    width: 56px;
    height: 72px;
}

.iso-cabinet .iso-face-top {
    width: 48px;
    height: 12px;
    background: #3a3a3a;
    top: 0;
    left: 4px;
    transform: skewX(-15deg);
}

.iso-cabinet .iso-face-left {
    width: 4px;
    height: 60px;
    background: #2a2a2a;
    top: 8px;
    left: 2px;
}

.iso-cabinet .iso-face-right {
    width: 44px;
    height: 60px;
    background: #1a1a1a;
    top: 8px;
    left: 6px;
    border: 1px solid #2a2a2a;
}

.iso-drawer {
    position: absolute;
    left: 10px;
    width: 36px;
    height: 2px;
    background: #3a3a3a;
}

.iso-drawer::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 2px;
    background: #666666;
    left: 50%;
    transform: translateX(-50%);
    top: 4px;
}

.iso-drawer-1 { top: 24px; }
.iso-drawer-2 { top: 40px; }
.iso-drawer-3 { top: 56px; }

/* --- Grid Icon --- */
.iso-grid {
    width: 64px;
    height: 64px;
}

.iso-grid .iso-face-top {
    width: 56px;
    height: 56px;
    background: #1a1a1a;
    top: 4px;
    left: 4px;
    border: 1px solid #2a2a2a;
}

.iso-grid .iso-face-left {
    width: 56px;
    height: 1px;
    background: #2a2a2a;
    top: 32px;
    left: 4px;
}

.iso-grid .iso-face-right {
    width: 1px;
    height: 56px;
    background: #2a2a2a;
    top: 4px;
    left: 32px;
}

.iso-grid-lines {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 56px;
    height: 56px;
    background:
        repeating-linear-gradient(90deg, transparent 0px, transparent 13px, #2a2a2a 13px, #2a2a2a 14px),
        repeating-linear-gradient(0deg, transparent 0px, transparent 13px, #2a2a2a 13px, #2a2a2a 14px);
    opacity: 0.5;
}

/* --- Icon Assembly Animation (pre-reveal state) --- */
.iso-icon.pre-reveal .iso-face-top {
    transform: translateY(-20px);
    opacity: 0;
}

.iso-icon.pre-reveal .iso-face-left {
    transform: translateX(-20px);
    opacity: 0;
}

.iso-icon.pre-reveal .iso-face-right {
    transform: translateX(20px);
    opacity: 0;
}

/* Building specific pre-reveal overrides */
.iso-building.pre-reveal .iso-face-top {
    transform: skewX(-30deg) translateY(-20px);
    opacity: 0;
}

.iso-building.pre-reveal .iso-face-left {
    transform: skewY(-15deg) translateX(-20px);
    opacity: 0;
}

.iso-building.pre-reveal .iso-face-right {
    transform: skewY(15deg) translateX(20px);
    opacity: 0;
}

/* Cabinet specific pre-reveal */
.iso-cabinet.pre-reveal .iso-face-top {
    transform: skewX(-15deg) translateY(-20px);
    opacity: 0;
}

/* Stamp specific pre-reveal */
.iso-stamp.pre-reveal .iso-face-left {
    transform: skewY(-10deg) translateX(-20px);
    opacity: 0;
}

.iso-stamp.pre-reveal .iso-face-right {
    transform: skewY(10deg) translateX(20px);
    opacity: 0;
}

/* Revealed state (assembles in) */
.iso-icon.revealed .iso-face-top,
.iso-icon.revealed .iso-face-left,
.iso-icon.revealed .iso-face-right {
    opacity: 1;
}

.iso-building.revealed .iso-face-top {
    transform: skewX(-30deg) translateY(0);
}

.iso-building.revealed .iso-face-left {
    transform: skewY(-15deg) translateX(0);
}

.iso-building.revealed .iso-face-right {
    transform: skewY(15deg) translateX(0);
}

.iso-cabinet.revealed .iso-face-top {
    transform: skewX(-15deg) translateY(0);
}

.iso-stamp.revealed .iso-face-left {
    transform: skewY(-10deg) translateX(0);
}

.iso-stamp.revealed .iso-face-right {
    transform: skewY(10deg) translateX(0);
}

.iso-icon.revealed .iso-face-top {
    transform: translateY(0);
}

.iso-icon.revealed .iso-face-left {
    transform: translateX(0);
}

.iso-icon.revealed .iso-face-right {
    transform: translateX(0);
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    #registry-column {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        width: 100%;
        height: 44px;
        flex-direction: row;
        padding-top: 0;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid #3a3a3a;
        -webkit-overflow-scrolling: touch;
    }

    .registry-header {
        display: flex;
        align-items: center;
        padding: 0 12px;
        border-bottom: none;
        border-right: 1px solid #2a2a2a;
        margin-bottom: 0;
        min-width: fit-content;
    }

    .registry-tab {
        padding: 0 16px;
        min-width: fit-content;
        border-left: none;
        border-bottom: 2px solid transparent;
        height: 44px;
        align-items: center;
    }

    .registry-tab.active {
        border-left-color: transparent;
        border-bottom-color: #ffffff;
    }

    .tab-label {
        writing-mode: horizontal-tb;
        transform: none;
    }

    #processing-area {
        margin-left: 0;
        margin-top: 44px;
    }

    .permit-grid {
        grid-template-columns: 1fr;
    }

    .permit-block {
        padding: 32px 24px;
    }

    .permit-block-wide {
        grid-column: 1;
    }

    .iso-icon {
        transform: scale(0.75);
        transform-origin: top left;
    }

    .iso-building-small {
        transform: scale(0.5625);
    }

    .stamp-mark {
        display: none;
    }

    /* Reduce animation distances on mobile */
    .iso-icon.pre-reveal .iso-face-top {
        transform: translateY(-10px);
    }

    .iso-icon.pre-reveal .iso-face-left {
        transform: translateX(-10px);
    }

    .iso-icon.pre-reveal .iso-face-right {
        transform: translateX(10px);
    }
}

/* --- Responsive: Tablet adjustments --- */
@media (min-width: 769px) and (max-width: 1024px) {
    #registry-column {
        width: 180px;
    }

    #processing-area {
        margin-left: 180px;
    }

    .permit-block {
        padding: 36px;
    }
}

/* --- Deep Ground Accent --- */
.permit-block-wide::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #0a0a0a;
    pointer-events: none;
}

/* --- Selection --- */
::selection {
    background-color: #3a3a3a;
    color: #e0e0e0;
}
