:root {
    --paper: #f2ece0;
    --filing: #e8e0d0;
    --red-ink: #c23b22;
    --blue-ink: #2b4570;
    --violet: #6b4c8a;
    --black-ink: #1e1e24;
    --manila: #d4b483;
    --dotted: #b0a898;
    --faded-anno: #8a7a6a;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    background-color: var(--paper);
    background-image: radial-gradient(var(--dotted) 0.5px, transparent 0.5px);
    background-size: 4px 4px;
    color: var(--blue-ink);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    line-height: 1.7;
    letter-spacing: 0.04em;
    overflow-x: hidden;
}

/* Scrollbar */
body::-webkit-scrollbar {
    width: 8px;
}
body::-webkit-scrollbar-track {
    background: var(--manila);
}
body::-webkit-scrollbar-thumb {
    background: var(--blue-ink);
}

/* ===================== COVER SHEET ===================== */
.cover-sheet {
    min-height: 100vh;
    display: flex;
    position: relative;
}

.cover-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem 3rem;
}

.form-header {
    font-family: 'Special Elite', cursive;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--blue-ink);
    margin-bottom: 0.5rem;
}

.form-title {
    font-family: 'Special Elite', cursive;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--black-ink);
    margin-bottom: 0.5rem;
}

.form-subtitle {
    font-family: 'Special Elite', cursive;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--blue-ink);
    margin-bottom: 2rem;
}

.cover-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1rem;
}

.cover-field {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--blue-ink);
}

.dotted-blank {
    display: inline-block;
    width: 120px;
    border-bottom: 1px dotted var(--dotted);
    margin-left: 0.3rem;
}

.pending-stamp {
    position: absolute;
    top: 15%;
    right: 10%;
    font-family: 'Archivo Black', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--red-ink);
    border: 4px solid var(--red-ink);
    padding: 0.5rem 1.5rem;
    transform: rotate(12deg);
    opacity: 0.85;
    filter: blur(0.3px);
}

/* ===================== MARGIN GUTTER ===================== */
.margin-gutter {
    width: 80px;
    min-width: 80px;
    background-color: var(--filing);
    position: relative;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.margin-gutter::after {
    content: '';
    position: absolute;
    top: 0;
    left: 60px;
    width: 1px;
    height: 100%;
    background-color: var(--red-ink);
}

.margin-anno {
    font-family: 'Courier Prime', monospace;
    font-size: 0.6rem;
    color: var(--faded-anno);
    writing-mode: horizontal-tb;
    white-space: nowrap;
}

.section-number {
    font-size: 0.65rem;
    color: var(--blue-ink);
    font-weight: 400;
}

/* ===================== FILING TABS ===================== */
.filing-tabs {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--paper);
    padding-left: 80px;
    border-bottom: 1px solid var(--dotted);
}

.tab {
    font-family: 'Special Elite', cursive;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.6rem 1.2rem;
    background-color: var(--manila);
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    margin-right: 2px;
    transition: background-color 300ms ease, transform 300ms ease;
}

.tab.active {
    background-color: var(--filing);
    transform: translateY(-4px);
    border-bottom: 2px solid var(--red-ink);
}

/* ===================== FORM BODY ===================== */
.form-body {
    /* Container for all sections */
}

.form-section {
    display: flex;
    min-height: auto;
}

.section-content {
    flex: 1;
    padding: 3rem;
    position: relative;
}

.section-heading {
    font-family: 'Special Elite', cursive;
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--black-ink);
    margin-bottom: 2rem;
}

.section-content p {
    margin-bottom: 1.2rem;
    text-align: justify;
}

.form-instruction {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--dotted);
    font-style: italic;
    margin-bottom: 1.5rem;
}

/* Tear line */
.tear-line {
    border-top: 2px dashed var(--dotted);
    margin: 3rem 0 0 0;
    padding-top: 0.5rem;
    position: relative;
    transition: border-color 300ms ease;
}

.tear-line:hover {
    border-color: var(--red-ink);
}

.scissors {
    position: absolute;
    top: -8px;
    left: 0;
}

/* ===================== CHECKLIST ===================== */
.checklist {
    margin: 1rem 0;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.checkbox {
    width: 16px;
    height: 16px;
    min-width: 16px;
    border: 2px solid var(--blue-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: border-width 200ms ease;
}

.checkbox:hover {
    border-width: 3px;
}

.checkmark {
    width: 16px;
    height: 16px;
    position: absolute;
    top: -1px;
    left: -1px;
}

.checkmark path {
    transition: stroke-dashoffset 300ms ease;
}

.checkbox.checked .checkmark path {
    stroke-dashoffset: 0;
}

.check-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
}

/* ===================== PROCESS FLOW ===================== */
.process-flow {
    margin: 1.5rem 0;
}

.process-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0;
    padding: 1rem 0;
    position: relative;
}

.step-num {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    color: var(--red-ink);
    min-width: 2rem;
    font-weight: 400;
}

.step-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
}

.step-line {
    position: absolute;
    bottom: 0;
    left: 0.9rem;
    width: 1px;
    height: 100%;
    background-color: var(--dotted);
    z-index: -1;
}

/* ===================== GENRE GRID ===================== */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.genre-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px dotted var(--dotted);
}

.genre-name {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
    flex: 1;
}

.genre-ref {
    font-family: 'Courier Prime', monospace;
    font-size: 0.65rem;
    color: var(--dotted);
}

/* ===================== STAMPS ===================== */
.section-stamp {
    position: absolute;
    bottom: 3rem;
    right: 3rem;
    opacity: 0.85;
    filter: blur(0.3px);
}

.stamp-circle {
    border: 3px solid var(--red-ink);
    border-radius: 50%;
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stamp-rect {
    border: 3px solid var(--red-ink);
    border-radius: 4px;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stamp-text {
    font-family: 'Archivo Black', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: inherit;
}

.stamp-red {
    border-color: var(--red-ink);
    color: var(--red-ink);
}

.stamp-blue {
    border-color: var(--blue-ink);
    color: var(--blue-ink);
}

.stamp-violet {
    border-color: var(--violet);
    color: var(--violet);
}

.stamp-black {
    border-color: var(--black-ink);
    color: var(--black-ink);
}

/* ===================== STAMP WALL ===================== */
.stamp-wall {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 2rem;
}

.wall-stamp {
    opacity: 0.85;
    filter: blur(0.3px);
    transition: transform 300ms ease, opacity 300ms ease;
    text-align: center;
}

.wall-stamp:nth-child(odd) {
    transform: rotate(-2deg);
}

.wall-stamp:nth-child(even) {
    transform: rotate(3deg);
}

.wall-stamp:hover {
    transform: scale(1.05) rotate(0deg);
    opacity: 1;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .margin-gutter {
        width: 40px;
        min-width: 40px;
    }

    .margin-gutter::after {
        left: 30px;
    }

    .margin-anno {
        display: none;
    }

    .section-number {
        display: block;
        font-size: 0.5rem;
    }

    .filing-tabs {
        padding-left: 40px;
        overflow-x: auto;
    }

    .section-content {
        padding: 2rem 1rem;
    }

    .pending-stamp {
        font-size: 1rem;
        padding: 0.3rem 0.8rem;
    }

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

    .stamp-wall {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
