/* =========================================================
   DAT Hole Punching Practice
   File: hole-punch.css
   ========================================================= */

:root {
    --hp-navy: #18324a;
    --hp-navy-dark: #10263a;
    --hp-teal: #1ea7a1;
    --hp-teal-dark: #16847f;
    --hp-bg: #f5f8fb;
    --hp-card: #ffffff;
    --hp-border: #d9e2ea;
    --hp-border-dark: #b7c4cf;
    --hp-text: #243746;
    --hp-muted: #667786;
    --hp-success: #2f9e62;
    --hp-success-bg: #eaf8f0;
    --hp-error: #c94a4a;
    --hp-error-bg: #fff0f0;
    --hp-warning: #c98a18;
    --hp-shadow: 0 18px 45px rgba(24, 50, 74, 0.1);
    --hp-radius-lg: 24px;
    --hp-radius-md: 16px;
    --hp-radius-sm: 10px;
}

.hole-punch-page {
    background: var(--hp-bg);
    color: var(--hp-text);
    font-family: "Inter", sans-serif;
}

.hole-punch-page *,
.hole-punch-page *::before,
.hole-punch-page *::after {
    box-sizing: border-box;
}

/* =========================================================
   Main practice section
   ========================================================= */

.hp-section {
    padding: 5rem 1.25rem 3rem;
}

.hp-app {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.hp-progress-area {
    margin-bottom: 1.5rem;
}

.hp-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.7rem;
    color: var(--hp-muted);
    font-size: 0.95rem;
    font-weight: 700;
}

.hp-progress-track {
    width: 100%;
    height: 12px;
    overflow: hidden;
    background: #dde6ed;
    border-radius: 999px;
}

.hp-progress-bar {
    width: 5%;
    height: 100%;
    background: linear-gradient(90deg, var(--hp-teal), var(--hp-teal-dark));
    border-radius: inherit;
    transition: width 0.35s ease;
}

/* =========================================================
   Main card
   ========================================================= */

.hp-card {
    background: var(--hp-card);
    border: 1px solid rgba(183, 196, 207, 0.7);
    border-radius: var(--hp-radius-lg);
    box-shadow: var(--hp-shadow);
    padding: clamp(1.4rem, 3vw, 2.5rem);
}

.hp-card-heading {
    max-width: 780px;
    margin: 0 auto 2rem;
    text-align: center;
}

.hp-card-label,
.hp-results-label {
    margin: 0 0 0.55rem;
    color: var(--hp-teal-dark);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.hp-card-heading h2,
.hp-results h2 {
    margin: 0;
    color: var(--hp-navy);
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    font-weight: 800;
    line-height: 1.2;
}

.hp-card-instructions {
    margin: 0.9rem auto 0;
    color: var(--hp-muted);
    font-size: 1rem;
    line-height: 1.7;
}

/* =========================================================
   Folding sequence
   ========================================================= */

.hp-fold-sequence {
    display: grid;
    grid-template-columns:
	    minmax(125px, 1fr)
	    auto
	    minmax(125px, 1fr)
	    auto
	    minmax(125px, 1fr)
	    auto
	    minmax(125px, 1fr)
	    auto
	    minmax(125px, 1fr);
    align-items: center;
    gap: clamp(0.45rem, 1.4vw, 1rem);
    margin: 0 auto 2.5rem;
    padding: 1.25rem;
    background: #f8fafc;
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius-md);
}

.hp-fold-step {
    min-width: 0;
    text-align: center;
}

.hp-fold-step-label {
    display: inline-block;
    margin-bottom: 0.6rem;
    color: var(--hp-navy);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hp-fold-svg {
    display: block;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1;
    margin: 0 auto;
    overflow: visible;
    background: #ffffff;
    border: 1px solid #d7e0e8;
    border-radius: 12px;
}

.hp-punch-step .hp-fold-svg {
    border-color: #bdc9d3;
}

.hp-sequence-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hp-teal-dark);
}

.hp-sequence-arrow svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

/* Generic SVG classes that the JavaScript can use */

.hp-paper-boundary {
    fill: none;
    stroke: #aeb9c3;
    stroke-width: 2;
    stroke-dasharray: 8 7;
}

.hp-paper-shape {
    fill: #ffffff;
    stroke: #263847;
    stroke-width: 2.8;
    stroke-linejoin: round;
}

.hp-paper-folded-area {
    fill: #edf2f6;
    stroke: #263847;
    stroke-width: 2.4;
    stroke-linejoin: round;
}

.hp-fold-line {
    fill: none;
    stroke: #607180;
    stroke-width: 2;
    stroke-dasharray: 7 6;
}

.hp-fold-arrow {
    fill: none;
    stroke: var(--hp-teal-dark);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hp-punch-hole {
    fill: #ffffff;
    stroke: #111111;
    stroke-width: 3;
}

.hp-punch-hole-filled {
    fill: #111111;
    stroke: #111111;
    stroke-width: 2;
}

/* =========================================================
   Answer choices
   ========================================================= */

.hp-answer-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.hp-answer-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.hp-answer-choice {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    padding: 0.85rem 0.85rem 1rem;
    overflow: hidden;
    background: #ffffff;
    border: 2px solid var(--hp-border);
    border-radius: 15px;
    cursor: pointer;
    user-select: none;
    transition:
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
}

.hp-answer-choice:hover {
    transform: translateY(-3px);
    border-color: #8ba2b3;
    box-shadow: 0 10px 25px rgba(24, 50, 74, 0.1);
}

.hp-answer-choice:focus-within {
    outline: 3px solid rgba(30, 167, 161, 0.2);
    outline-offset: 3px;
}

.hp-answer-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.hp-answer-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: 0.65rem;
    background: var(--hp-navy);
    color: #ffffff;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 800;
    transition:
        background-color 0.18s ease,
        transform 0.18s ease;
}

.hp-answer-svg {
    display: block;
    width: 100%;
    max-width: 180px;
    aspect-ratio: 1;
    background: #ffffff;
    border: 1px solid var(--hp-border-dark);
}

.hp-answer-choice:has(input:checked) {
    background: #edf9f8;
    border-color: var(--hp-teal);
    box-shadow: 0 12px 26px rgba(30, 167, 161, 0.16);
}

.hp-answer-choice:has(input:checked) .hp-answer-letter {
    background: var(--hp-teal-dark);
    transform: scale(1.06);
}

/* Feedback states added by JavaScript */

.hp-answer-choice.is-correct {
    background: var(--hp-success-bg);
    border-color: var(--hp-success);
    box-shadow: 0 10px 24px rgba(47, 158, 98, 0.14);
}

.hp-answer-choice.is-correct .hp-answer-letter {
    background: var(--hp-success);
}

.hp-answer-choice.is-incorrect {
    background: var(--hp-error-bg);
    border-color: var(--hp-error);
    box-shadow: 0 10px 24px rgba(201, 74, 74, 0.12);
}

.hp-answer-choice.is-incorrect .hp-answer-letter {
    background: var(--hp-error);
}

.hp-answer-choice.is-disabled {
    cursor: default;
}

.hp-answer-choice.is-disabled:hover {
    transform: none;
}

/* Generic answer SVG classes for JavaScript */

.hp-answer-border {
    fill: #ffffff;
    stroke: #263847;
    stroke-width: 3;
}

.hp-answer-guide {
    fill: none;
    stroke: #dbe2e8;
    stroke-width: 1.4;
}

.hp-answer-position {
    fill: #ffffff;
    stroke: #263847;
    stroke-width: 2.4;
}

.hp-answer-position.is-hole {
    fill: #111111;
    stroke: #111111;
}

/* =========================================================
   Controls and feedback
   ========================================================= */

.hp-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 2rem;
}

.hp-submit-button,
.hp-secondary-button {
    min-width: 180px;
    min-height: 50px;
    padding: 0.85rem 1.45rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease,
        border-color 0.18s ease;
}

.hp-submit-button {
    color: #ffffff;
    background: var(--hp-teal);
    border: 2px solid var(--hp-teal);
    box-shadow: 0 8px 20px rgba(30, 167, 161, 0.22);
}

.hp-submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    background: var(--hp-teal-dark);
    border-color: var(--hp-teal-dark);
    box-shadow: 0 11px 24px rgba(30, 167, 161, 0.28);
}

.hp-submit-button:focus-visible,
.hp-secondary-button:focus-visible {
    outline: 3px solid rgba(30, 167, 161, 0.25);
    outline-offset: 3px;
}

.hp-submit-button:disabled {
    color: #82909c;
    background: #dce4ea;
    border-color: #dce4ea;
    box-shadow: none;
    cursor: not-allowed;
}

.hp-secondary-button {
    color: var(--hp-navy);
    background: #ffffff;
    border: 2px solid var(--hp-border-dark);
}

.hp-secondary-button:hover {
    transform: translateY(-2px);
    border-color: var(--hp-navy);
}

.hp-feedback {
    min-height: 28px;
    margin-top: 1.25rem;
    color: var(--hp-muted);
    font-weight: 700;
    text-align: center;
}

.hp-feedback.is-correct {
    color: var(--hp-success);
}

.hp-feedback.is-incorrect {
    color: var(--hp-error);
}

.hp-feedback.is-warning {
    color: var(--hp-warning);
}

/* =========================================================
   Statistics
   ========================================================= */

.hp-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.hp-stat {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.15rem;
    background: #ffffff;
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius-md);
    box-shadow: 0 10px 28px rgba(24, 50, 74, 0.06);
    text-align: center;
}

.hp-stat span {
    color: var(--hp-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hp-stat strong {
    color: var(--hp-navy);
    font-size: 1.65rem;
    line-height: 1;
}

/* =========================================================
   Results
   ========================================================= */

.hp-results {
    margin-top: 1.5rem;
    padding: clamp(1.6rem, 3vw, 2.5rem);
    background: #ffffff;
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius-lg);
    box-shadow: var(--hp-shadow);
    text-align: center;
}

.hp-results[hidden] {
    display: none;
}

.hp-results > p:not(.hp-results-label) {
    max-width: 640px;
    margin: 0.9rem auto 0;
    color: var(--hp-muted);
    line-height: 1.7;
}

.hp-results-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.hp-result-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.15rem;
    background: #f7fafc;
    border: 1px solid var(--hp-border);
    border-radius: 14px;
}

.hp-result-item span {
    color: var(--hp-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hp-result-item strong {
    color: var(--hp-navy);
    font-size: 1.8rem;
}

/* =========================================================
   Information section
   ========================================================= */

.hp-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    padding-top: 3rem;
    padding-bottom: 4rem;
}

.hp-info article {
    padding: 1.6rem;
    background: #ffffff;
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-radius-md);
    box-shadow: 0 10px 28px rgba(24, 50, 74, 0.06);
}

.hp-info h2 {
    margin: 0 0 0.7rem;
    color: var(--hp-navy);
    font-size: 1.2rem;
    font-weight: 800;
}

.hp-info p {
    margin: 0;
    color: var(--hp-muted);
    line-height: 1.75;
}

/* =========================================================
   SEO section
   ========================================================= */

.hp-seo-section {
    padding: 4.5rem 0;
    background: #ffffff;
    border-top: 1px solid var(--hp-border);
}

.hp-seo-content {
    max-width: 860px;
    margin: 0 auto;
}

.hp-seo-content h2,
.hp-seo-content h3 {
    color: var(--hp-navy);
    font-weight: 800;
}

.hp-seo-content h2 {
    margin-bottom: 1.1rem;
    font-size: clamp(1.75rem, 3vw, 2.4rem);
}

.hp-seo-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.65rem;
    font-size: 1.25rem;
}

.hp-seo-content p {
    color: var(--hp-muted);
    line-height: 1.8;
}

.hp-seo-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem 1.3rem;
    margin-top: 2rem;
}

.hp-resource-link {
    color: var(--hp-teal-dark);
    font-weight: 800;
    text-decoration: none;
}

.hp-resource-link:hover {
    text-decoration: underline;
}

/* =========================================================
   Accessibility helpers
   ========================================================= */

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* =========================================================
   Responsive layout
   ========================================================= */

@media (max-width: 1050px) {
    .hp-fold-sequence {
        grid-template-columns:
            minmax(135px, 1fr)
            auto
            minmax(135px, 1fr)
            auto
            minmax(135px, 1fr)
            auto
            minmax(135px, 1fr);
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }

    .hp-fold-step {
        min-width: 145px;
    }

    .hp-answer-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hp-answer-choice:nth-child(4) {
        grid-column: 1 / 2;
    }

    .hp-answer-choice:nth-child(5) {
        grid-column: 2 / 3;
    }
}

@media (max-width: 800px) {
    .hp-section {
        padding-top: 3.5rem;
    }

    .hp-card {
        border-radius: 18px;
    }

    .hp-fold-sequence {
        display: flex;
        align-items: center;
        padding: 1rem;
    }

    .hp-fold-step {
        flex: 0 0 170px;
    }

    .hp-sequence-arrow {
        flex: 0 0 26px;
    }

    .hp-answer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hp-answer-choice:nth-child(4) {
        grid-column: auto;
    }

    .hp-answer-choice:nth-child(5) {
        grid-column: 1 / -1;
        width: calc(50% - 0.5rem);
        justify-self: center;
    }

    .hp-stats,
    .hp-results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hp-info {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .hp-section {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .hp-progress-text {
        font-size: 0.86rem;
    }

    .hp-card {
        padding: 1.15rem;
    }

    .hp-card-heading {
        margin-bottom: 1.35rem;
    }

    .hp-card-instructions {
        font-size: 0.94rem;
    }

    .hp-fold-sequence {
        margin-right: -0.2rem;
        margin-left: -0.2rem;
        border-radius: 12px;
    }

    .hp-fold-step {
        flex-basis: 155px;
    }

    .hp-answer-grid {
        gap: 0.75rem;
    }

    .hp-answer-choice {
        padding: 0.7rem;
        border-radius: 12px;
    }

    .hp-answer-letter {
        width: 30px;
        height: 30px;
        margin-bottom: 0.5rem;
        font-size: 0.82rem;
    }

    .hp-answer-choice:nth-child(5) {
        width: calc(50% - 0.375rem);
    }

    .hp-submit-button,
    .hp-secondary-button {
        width: 100%;
    }

    .hp-stat,
    .hp-result-item {
        padding: 1rem 0.7rem;
    }

    .hp-stat strong,
    .hp-result-item strong {
        font-size: 1.45rem;
    }

    .hp-seo-section {
        padding: 3.5rem 0;
    }

    .hp-seo-section .container {
        padding-right: 1.25rem !important;
        padding-left: 1.25rem !important;
    }
}

@media (max-width: 390px) {
    .hp-answer-grid {
        grid-template-columns: 1fr;
    }

    .hp-answer-choice:nth-child(5) {
        grid-column: auto;
        width: 100%;
    }

    .hp-answer-svg {
        max-width: 165px;
    }

    .hp-stats,
    .hp-results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem;
    }
}

/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .hp-progress-bar,
    .hp-answer-choice,
    .hp-answer-letter,
    .hp-submit-button,
    .hp-secondary-button {
        transition: none;
    }
}

/* =========================================================
   Improved mobile hole-punching layout
   ========================================================= */

@media (max-width: 700px) {
    .hp-section {
        padding: 2.5rem 0.75rem 3rem;
    }

    .hp-card {
        padding: 1rem;
        border-radius: 16px;
    }

    .hp-card-heading {
        margin-bottom: 1.25rem;
    }

    .hp-card-heading h2 {
        font-size: clamp(1.7rem, 7.5vw, 2.25rem);
        line-height: 1.15;
    }

    .hp-card-instructions {
        margin-top: 0.75rem;
        font-size: 0.95rem;
        line-height: 1.55;
    }

    /*
     * Replace horizontal scrolling with a compact
     * two-column folding sequence.
     */
    .hp-fold-sequence {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.85rem;
        width: 100%;
        margin: 0 0 1.75rem;
        padding: 0.85rem;
        overflow: visible;
    }

    .hp-fold-step {
        min-width: 0;
        width: 100%;
    }

    .hp-fold-step-label {
        margin-bottom: 0.4rem;
        font-size: 0.74rem;
    }

    .hp-fold-svg {
        width: 100%;
        max-width: none;
        border-radius: 10px;
    }

    /*
     * The labels already communicate the sequence,
     * so arrows are unnecessary on narrow screens.
     */
    .hp-sequence-arrow {
        display: none;
    }

    /*
     * Center the final punch diagram beneath the folds.
     */
    .hp-punch-step {
        grid-column: 1 / -1;
        width: calc(50% - 0.425rem);
        justify-self: center;
    }

    /*
     * Keep answer choices in two columns instead of
     * turning them into very tall full-width cards.
     */
    .hp-answer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.7rem;
    }

    .hp-answer-choice,
    .hp-answer-choice:nth-child(4) {
        grid-column: auto;
        width: 100%;
        padding: 0.65rem;
    }

    .hp-answer-choice:nth-child(5) {
        grid-column: 1 / -1;
        width: calc(50% - 0.35rem);
        justify-self: center;
    }

    .hp-answer-letter {
        width: 30px;
        height: 30px;
        margin-bottom: 0.45rem;
        font-size: 0.82rem;
    }

    .hp-answer-svg {
        width: 100%;
        max-width: 160px;
    }

    .hp-controls {
        margin-top: 1.4rem;
    }

    .hp-submit-button,
    .hp-secondary-button {
        width: 100%;
        min-width: 0;
    }
}