/* ========================================
   double-standard.org - Styles
   Flat-design administrative archive
   ======================================== */

/* ========================================
   Color Reference (from DESIGN.md)
   ------------------------------------------
   Parchment Fog:    #F4F0E8  (primary bg)
   Warm Dust:        #EFEBE3  (alt bg, hover)
   Dark Loam:        #3D3630  (sidebar, footer)
   Charred Earth:    #2B2622  (primary text)
   Weathered Stone:  #8A8478  (secondary text)
   Oxidized Copper:  #7A8C72  (accent, links)
   Fired Clay:       #B0876E  (secondary accent)
   Silt Line:        #D4CFC6  (borders, dividers)
   Muted Carmine:    #A65D50  (error/contradiction)
   Mid Silt:         #C8C3BA  (dual-color dividers)
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.65;
    color: #2B2622;
    background-color: #F4F0E8;
    overflow-x: hidden;
    display: flex;
    min-height: 100vh;
}

/* ========================================
   Particle Canvas
   ======================================== */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ========================================
   Sidebar
   ======================================== */
#sidebar {
    position: sticky;
    top: 0;
    left: 0;
    width: 280px;
    min-width: 280px;
    height: 100vh;
    background-color: #3D3630;
    z-index: 10;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px 32px;
}

.logo-icon {
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 16px;
    position: relative;
}

.active-indicator {
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 48px;
    background-color: #7A8C72;
    transition: top 300ms ease;
    border-radius: 0 2px 2px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #8A8478;
    text-decoration: none;
    transition: color 150ms linear;
    position: relative;
}

.nav-item:hover {
    color: #7A8C72;
}

.nav-item.active {
    color: #7A8C72;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-footer {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-version,
.sidebar-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #8A8478;
    letter-spacing: 0.03em;
    opacity: 0.6;
}

/* ========================================
   Main Content
   ======================================== */
#main-content {
    flex: 1;
    position: relative;
    z-index: 1;
    padding-left: 32px;
    padding-right: 48px;
    max-width: calc(100vw - 280px);
}

/* ========================================
   Content Sections
   ======================================== */
.content-section {
    margin-bottom: 48px;
}

/* Double-standard rupture: every 3rd section gets 24px spacing instead of 48px */
.content-section:nth-child(3n) {
    margin-bottom: 24px;
}

.content-section:first-child .plate {
    opacity: 0;
    animation: fadeInPlate 400ms linear forwards;
}

@keyframes fadeInPlate {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   Plates
   ======================================== */
.plate {
    background-color: #F4F0E8;
    padding: 40px 48px;
    position: relative;
    overflow: hidden;
    transition: background-color 200ms linear;
}

.plate.bg-alt {
    background-color: #EFEBE3;
}

.plate.plate-wide {
    width: 100%;
}

.plate:hover {
    background-color: #EFEBE3;
}

.plate.bg-alt:hover {
    background-color: #F4F0E8;
}

/* Rupture plates - deliberate grid break */
.plate.rupture {
    margin-left: 0;
    transition: margin-left 600ms linear, background-color 200ms linear;
}

.plate.rupture.rupture-active {
    margin-left: 8px;
}

/* ========================================
   Skeleton Loading Overlay
   ======================================== */
.skeleton-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #EFEBE3;
    z-index: 5;
    overflow: hidden;
    pointer-events: none;
}

.skeleton-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #EFEBE3 25%, #F4F0E8 50%, #EFEBE3 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.skeleton-overlay.revealed {
    opacity: 0;
    transition: opacity 200ms linear;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   Measurement Marks
   ======================================== */
.plate-measurement-marks {
    position: absolute;
    left: 0;
    top: 0;
    width: 8px;
    height: 100%;
    pointer-events: none;
}

/* Vertical line with irregular tick marks */
.plate-measurement-marks::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 0;
    width: 1px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        #D4CFC6 0px,
        #D4CFC6 1px,
        transparent 1px,
        transparent 16px,
        #D4CFC6 16px,
        #D4CFC6 17px,
        transparent 17px,
        transparent 34px,
        #D4CFC6 34px,
        #D4CFC6 35px,
        transparent 35px,
        transparent 50px
    );
}

/* Horizontal tick marks at irregular intervals (16, 18, 15 px) */
.plate-measurement-marks::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 15px,
        #D4CFC6 15px,
        #D4CFC6 16px,
        transparent 16px,
        transparent 34px,
        #D4CFC6 34px,
        #D4CFC6 35px,
        transparent 35px,
        transparent 49px,
        #D4CFC6 49px,
        #D4CFC6 50px
    );
}

/* ========================================
   Stamp Marks
   ======================================== */
.plate-stamp {
    position: absolute;
    top: 50%;
    right: 40px;
    transform: translate(0, -50%) rotate(-15deg);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #8A8478;
    opacity: 0.08;
    pointer-events: none;
    white-space: nowrap;
}

.plate-stamp::before {
    content: attr(data-stamp);
}

/* ========================================
   Plate Header
   ======================================== */
.plate-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    letter-spacing: 0.01em;
    color: #2B2622;
    line-height: 1.2;
}

.section-ref {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    color: #8A8478;
    letter-spacing: 0.03em;
    margin-left: auto;
}

/* ========================================
   Double Icons
   ======================================== */
.double-icon {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.double-icon .icon-left,
.double-icon .icon-right {
    display: block;
}

/* Snap back instantly on leave (no transition) */
.double-icon .icon-right {
    transition: transform 0ms;
}

/* Animate only on hover enter - 300ms linear */
.double-icon:hover .icon-right {
    transition: transform 300ms linear;
}

.double-icon:hover .icon-left {
    transform: none;
}

/* Pan difference - scale pans shift */
.double-icon[data-diff="pan"]:hover .icon-right {
    transform: translateY(2px);
}

/* Stroke difference - slight scale up */
.double-icon[data-diff="stroke"]:hover .icon-right {
    transform: scale(1.05);
}

/* Size difference - more scale */
.double-icon[data-diff="size"]:hover .icon-right {
    transform: scale(1.1);
}

/* Gap difference - horizontal shift */
.double-icon[data-diff="gap"]:hover .icon-right {
    transform: translateX(3px);
}

/* Tick difference - horizontal stretch */
.double-icon[data-diff="tick"]:hover .icon-right {
    transform: scaleX(1.05);
}

/* Check difference - vertical shift */
.double-icon[data-diff="check"]:hover .icon-right {
    transform: translateY(1px);
}

/* Rotate difference - rotation */
.double-icon[data-diff="rotate"]:hover .icon-right {
    transform: rotate(12deg);
}

/* Line difference - vertical shift */
.double-icon[data-diff="line"]:hover .icon-right {
    transform: translateY(-2px);
}

/* ========================================
   Plate Body
   ======================================== */
.plate-body {
    max-width: 800px;
}

.plate-body p {
    margin-bottom: 16px;
}

.plate-body p:last-child {
    margin-bottom: 0;
}

.plate-note {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    color: #8A8478;
    line-height: 1.6;
    padding: 16px;
    border-left: 2px solid #B0876E;
    margin-top: 24px;
}

/* ========================================
   Definition List
   ======================================== */
.definition-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.definition-list dt {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    color: #2B2622;
    margin-bottom: 4px;
}

.definition-list dd {
    color: #2B2622;
    padding-left: 0;
    line-height: 1.65;
}

/* ========================================
   Criteria Grid
   ======================================== */
.criteria-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 24px 0;
}

.criteria-item {
    padding: 24px;
    background-color: rgba(244, 240, 232, 0.5);
    position: relative;
}

.rupture .criteria-item {
    background-color: rgba(239, 235, 227, 0.5);
}

.criteria-number {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #8A8478;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 8px;
}

.criteria-item h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: #2B2622;
    margin-bottom: 8px;
}

.criteria-item p {
    font-size: 0.9rem;
    color: #2B2622;
    line-height: 1.6;
}

/* ========================================
   Application Table
   ======================================== */
.application-table {
    margin: 24px 0;
    overflow-x: auto;
}

.application-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.application-table th {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #8A8478;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #D4CFC6;
}

.application-table td {
    padding: 12px 16px;
    color: #2B2622;
    border-bottom: 1px solid #D4CFC6;
}

/* Dual-color divider for table rows */
.application-table td {
    border-image: linear-gradient(to right, #D4CFC6 50%, #C8C3BA 50%) 1;
}

.application-table tbody tr:last-child td {
    border-bottom: none;
    border-image: none;
}

/* ========================================
   Measurement Grid
   ======================================== */
.measurement-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 24px 0;
}

.measurement-item {
    padding: 20px;
    background-color: rgba(239, 235, 227, 0.6);
}

.measurement-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1.8rem;
    color: #2B2622;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.measurement-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #8A8478;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

/* ========================================
   Compliance Status Grid
   ======================================== */
.compliance-status-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 24px 0;
}

.status-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background-color: rgba(244, 240, 232, 0.5);
}

.status-indicator {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-top: 4px;
}

.status-compliant .status-indicator {
    background-color: #7A8C72;
}

.status-conditional .status-indicator {
    background-color: #B0876E;
}

.status-review .status-indicator {
    background-color: #8A8478;
}

.status-noncompliant .status-indicator {
    background-color: #A65D50;
}

.status-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: #2B2622;
    min-width: 180px;
}

.status-description {
    font-size: 0.9rem;
    color: #2B2622;
    line-height: 1.6;
}

/* ========================================
   Exception List
   ======================================== */
.exception-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: 24px 0;
}

.exception-item {
    padding-left: 20px;
    border-left: 2px solid #D4CFC6;
}

.exception-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #B0876E;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 8px;
}

.exception-item p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: #2B2622;
}

/* ========================================
   Appendix Timeline
   ======================================== */
.appendix-timeline {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 24px;
}

/* Dual-color vertical line */
.appendix-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: linear-gradient(to bottom, #D4CFC6 50%, #C8C3BA 50%);
}

.timeline-item {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -23px;
    top: 14px;
    width: 7px;
    height: 7px;
    background-color: #7A8C72;
}

.timeline-year {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    font-weight: 400;
    color: #8A8478;
    letter-spacing: 0.03em;
    min-width: 48px;
}

.timeline-event {
    font-size: 0.9rem;
    color: #2B2622;
    line-height: 1.5;
}

/* ========================================
   Divider Lines (dual-color)
   ======================================== */
.content-section + .content-section::before {
    content: '';
    display: block;
    height: 1px;
    margin: 0 48px 48px 0;
    background: linear-gradient(to right, #D4CFC6 50%, #C8C3BA 50%);
}

/* ========================================
   Footer
   ======================================== */
#site-footer {
    background-color: #3D3630;
    padding: 40px 48px;
    margin-top: 48px;
}

.footer-content {
    max-width: 800px;
}

.footer-left,
.footer-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
}

.footer-org {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: #C8C3BA;
}

.footer-meta {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: #8A8478;
    letter-spacing: 0.03em;
}

.footer-divider {
    height: 1px;
    background: linear-gradient(to right, #8A8478 50%, #3D3630 50%);
    margin: 16px 0;
}

.footer-bottom {
    padding-top: 8px;
}

.footer-disclaimer {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: #8A8478;
    line-height: 1.6;
    opacity: 0.7;
}

/* ========================================
   Scrollbar Styling
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #F4F0E8;
}

::-webkit-scrollbar-thumb {
    background: #D4CFC6;
}

::-webkit-scrollbar-thumb:hover {
    background: #C8C3BA;
}

/* ========================================
   Links
   ======================================== */
a {
    color: #7A8C72;
    text-decoration: none;
}

a:hover {
    color: #7A8C72;
    text-decoration: underline;
}

/* ========================================
   Media Queries
   ======================================== */

/* Tablet and below: sidebar collapses to icon rail */
@media (max-width: 1023px) {
    #sidebar {
        width: 48px;
        min-width: 48px;
    }

    .sidebar-logo {
        padding: 12px 8px 24px;
    }

    .logo-icon {
        width: 24px;
        height: 24px;
    }

    .sidebar-nav {
        padding: 0;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .nav-label {
        display: none;
    }

    .sidebar-footer {
        padding: 12px 4px;
        align-items: center;
    }

    .sidebar-version {
        font-size: 0.55rem;
    }

    .sidebar-date {
        display: none;
    }

    #main-content {
        padding-left: 24px;
        padding-right: 24px;
        max-width: calc(100vw - 48px);
    }

    .active-indicator {
        left: 0;
    }

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

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

/* Mobile */
@media (max-width: 640px) {
    .plate {
        padding: 24px 20px;
    }

    .plate-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .section-ref {
        margin-left: 0;
    }

    .plate-stamp {
        font-size: 1.5rem;
        right: 16px;
    }

    .status-item {
        flex-direction: column;
        gap: 8px;
    }

    .status-label {
        min-width: auto;
    }

    .application-table {
        font-size: 0.8rem;
    }

    .application-table th,
    .application-table td {
        padding: 8px;
    }

    .footer-content {
        max-width: 100%;
    }

    #site-footer {
        padding: 24px 20px;
    }
}
