/* ==========================================================================
   Printable A4 project sheet (UC14) — standalone page.
   NOT imported into app.css; linked directly on templates/project/print.html.twig.
   Ported from docs/mockup/src/pages/projects/[id]/print.astro, mapped onto the
   app's design tokens (assets/styles/variables.css). All selectors are
   print-sheet specific (`sheet-*`, `print-*`) so nothing leaks into the app.
   ========================================================================== */

body {
    margin: 0;
    background: #e5e7eb;
    font-family: var(--font-family-base, system-ui, sans-serif);
    color: var(--color-text-primary, #1f2937);
}

/* ----- Action bar (screen only) ----- */
.print-action-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #fff;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md, 0.5rem);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.print-btn--primary {
    /* Accessible cyan: white on #00708F is 5.6:1; the raw brand #0096BE was 3.4:1. */
    background: var(--color-primary-text, #00708f);
    color: #fff;
}

.print-btn--primary:hover {
    background: var(--color-primary-text-hover, #005266);
    color: #fff;
}

.print-btn--ghost {
    background: #fff;
    color: var(--color-text-secondary, #6b7280);
    border-color: var(--color-border, #e5e7eb);
}

.print-btn--ghost:hover {
    background: var(--color-bg-light, #f9fafb);
    color: var(--color-text-primary, #1f2937);
}

/* ----- Sheet ----- */
.sheet {
    max-width: 210mm;
    min-height: 297mm;
    margin: 2rem auto;
    padding: 20mm;
    background: #fff;
    box-shadow: var(--shadow-card, 0 2px 16px rgba(0, 0, 0, 0.1));
    display: flex;
    flex-direction: column;
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sheet-logo {
    height: 2rem;
}

.sheet-kicker {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary, #6b7280);
}

.sheet-rule {
    height: 3px;
    margin: 0.75rem 0 1.25rem;
    background: var(--color-primary, #0096be);
    border-radius: 2px;
}

/* ----- Title ----- */
.sheet-title h1 {
    margin: 0 0 0.5rem;
    font-size: 1.375rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--color-text-primary, #111827);
}

.sheet-title-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.sheet-country {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary, #374151);
}

.sheet-country .fi {
    border-radius: 2px;
}

.sheet-code {
    font-size: 0.8125rem;
    padding: 0.125rem 0.5rem;
    background: var(--color-bg-light, #f3f4f6);
    border-radius: 0.25rem;
    color: var(--color-text-secondary, #6b7280);
}

/* Status badge — variants mirror the public buckets without pulling app.css. */
.print-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    color: #fff;
    background: var(--color-primary-text, #00708f);
}

/* Mirror the public status-badge palette (assets/styles/components/shared.css):
   white on accessible cyan / dark green passes 4.5:1; amber needs dark navy text. */
.print-badge--ongoing { background: var(--color-primary-text, #00708f); }
.print-badge--completed { background: var(--status-completed, #066649); }
.print-badge--suspended { background: var(--status-suspended, #f59e0b); color: var(--color-navy, #012d3a); }

/* ----- Shared section label ----- */
.sheet-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    /* Sheet labels sit on grey panels (#F3F4F6) where slate-500 muted only
       reaches 4.32:1 — use slate-600 (≥6:1 on grey and white). WCAG 1.4.3. */
    color: var(--color-text-secondary, #475569);
}

/* ----- Description + Key facts ----- */
.sheet-main {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.sheet-main-left {
    min-width: 0;
}

.sheet-description {
    margin: 0;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--color-text-secondary, #374151);
    background: var(--color-primary-subtle, #f0f9ff);
    border-left: 3px solid var(--color-primary, #0096be);
    border-radius: 0 0.375rem 0.375rem 0;
}

.sheet-description :first-child { margin-top: 0; }
.sheet-description :last-child { margin-bottom: 0; }
.sheet-description--empty { color: var(--color-text-muted, #9ca3af); font-style: italic; }

.sheet-main-right {
    padding: 1rem;
    background: var(--color-bg-light, #f9fafb);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-md, 0.5rem);
}

.sheet-facts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
}

.sheet-fact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}

.sheet-fact:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.sheet-fact dt {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* On the grey key-facts panel; slate-600 clears 4.5:1 where muted didn't. */
    color: var(--color-text-secondary, #475569);
}

.sheet-fact dd {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary, #1f2937);
    text-align: right;
}

.sheet-fact dd code {
    font-size: 0.8125rem;
    padding: 0.1rem 0.4rem;
    background: var(--color-border, #e5e7eb);
    border-radius: 0.25rem;
    color: var(--color-text-secondary, #6b7280);
}

/* Compact timeline inside key facts */
.sheet-timeline {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border, #e5e7eb);
}

.sheet-timeline-track {
    position: relative;
    height: 0.375rem;
    background: var(--color-border, #e5e7eb);
    border-radius: 0.25rem;
}

.sheet-timeline-elapsed {
    height: 100%;
    border-radius: 0.25rem;
    background: linear-gradient(90deg, var(--color-primary, #0096be), var(--color-secondary, #14b8a6));
}

.sheet-timeline-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 0.625rem;
    height: 0.625rem;
    background: #fff;
    border: 2px solid var(--color-primary, #0096be);
    border-radius: 50%;
}

.sheet-timeline-dates {
    display: flex;
    justify-content: space-between;
    margin-top: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 500;
    /* On the grey key-facts panel; slate-600 clears 4.5:1 where muted didn't. */
    color: var(--color-text-secondary, #475569);
}

/* ----- Classifications ----- */
.sheet-classifications {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--color-bg-light, #f9fafb);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-md, 0.5rem);
}

.sheet-gc-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary, #374151);
    background: #fff;
    border-left: 3px solid var(--color-primary, #0096be);
    border-radius: 0.375rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sheet-domain-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.25rem 0 0.25rem 1.5rem;
    padding: 0.3rem 0.6rem;
    position: relative;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary, #6b7280);
    background: #fff;
    border-radius: 0.375rem;
}

.sheet-domain-badge::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    width: 0.5rem;
    height: 1px;
    background: var(--color-border, #d1d5db);
}

.sheet-domain-badge svg { color: var(--color-primary, #0096be); }

.sheet-dac-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sheet-dac-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
    border-radius: 0.25rem;
}

.sheet-dac-row--primary {
    background: #fff;
    border-left: 3px solid var(--color-success, #10b981);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sheet-dac-row--sub {
    position: relative;
    margin-left: 1.5rem;
    background: #fff;
}

.sheet-dac-row--sub::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    width: 0.5rem;
    height: 1px;
    background: var(--color-border, #d1d5db);
}

.sheet-dac-code {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    color: var(--color-text-muted, #9ca3af);
}

.sheet-dac-row--primary .sheet-dac-code { color: var(--color-success, #10b981); }
.sheet-dac-name { font-weight: 500; color: var(--color-text-secondary, #6b7280); }
.sheet-dac-row--primary .sheet-dac-name { font-weight: 600; color: var(--color-text-secondary, #374151); }

/* ----- SDGs ----- */
.sheet-sdgs {
    margin-top: 1.25rem;
}

.sheet-sdg-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.sheet-sdg-icons .sdg-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.25rem;
}

/* ----- Footer ----- */
.sheet-footer {
    margin-top: auto;
    padding-top: 1rem;
}

.sheet-footer-rule {
    height: 1px;
    margin-bottom: 0.75rem;
    background: var(--color-border, #e5e7eb);
}

.sheet-disclaimer {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    line-height: 1.5;
    color: var(--color-text-muted, #9ca3af);
}

.sheet-footer-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--color-text-muted, #9ca3af);
}

/* ----- Print ----- */
@page {
    size: A4 portrait;
    margin: 15mm;
}

@media print {
    body { background: #fff; }

    .no-print { display: none !important; }

    .sheet {
        max-width: none;
        min-height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }

    .sheet-main,
    .sheet-classifications,
    .sheet-sdgs,
    .sheet-title,
    .sheet-footer {
        break-inside: avoid;
    }

    * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
