/* ECHO Romania: print-ready PDF pages (layouts/pdf.blade.php).
   A light A4 sheet so it reads and prints well, carrying the site's look:
   the dark purple hero as a masthead, Syne headings over DM Sans, and the
   same purple accents, section labels and event timeline. */

:root {
    --echo-purple: #7B2FFF;
    --echo-purple-mid: #9B5FFF;
    --echo-purple-light: #C49AFF;
    --echo-ink: #0A0A14;
    --pdf-text: #24222e;
    --pdf-muted: #5c5a6b;
    --pdf-rule: #e6e1f2;
    --pdf-tint: #f6f2ff;
    /* Darker purple for text on white (the site's #9B5FFF is too light). */
    --pdf-accent: #5d25bd;
}

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

/* Keep every background and tint when printing, even with the browser's
   "Background graphics" option off. */
* {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

html { background: var(--echo-ink); }

body {
    margin: 0;
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 10.5pt;
    line-height: 1.65;
    color: var(--pdf-text);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Syne', system-ui, sans-serif;
    letter-spacing: -0.02em;
    color: var(--echo-ink);
    line-height: 1.25;
    break-after: avoid;
}

a { color: var(--pdf-accent); }

.gradient-text {
    background: linear-gradient(135deg, var(--echo-purple-mid), var(--echo-purple-light) 60%, #E8CFFF);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.line-accent {
    display: block;
    width: 40px;
    height: 3px;
    margin-bottom: 0.75rem;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--echo-purple), var(--echo-purple-mid));
}

/* ─── Screen preview: toolbar over a centred A4 sheet ─── */
.pdf-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1.25rem;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    color: #DEDEDE;
    font-size: 0.9rem;
}

.pdf-toolbar .bi { margin-right: 0.45rem; }

.pdf-toolbar-back {
    color: var(--echo-purple-light);
    text-decoration: none;
    white-space: nowrap;
}
.pdf-toolbar-back:hover { color: #fff; }

.pdf-toolbar-hint {
    flex: 1;
    text-align: center;
    color: #a9a7b8;
    font-size: 0.82rem;
}

/* The site's primary button, 3D ledge included. */
.pdf-btn {
    font: inherit;
    font-weight: 500;
    white-space: nowrap;
    color: #fff;
    background: var(--echo-purple);
    border: 1px solid var(--echo-purple);
    border-radius: 0.375rem;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    box-shadow: 0 3px 0 #4b14ad, 0 8px 30px -10px rgba(123, 47, 255, 0.6);
    transition: background-color 0.15s ease, transform 0.08s ease, box-shadow 0.08s ease;
}
.pdf-btn:hover { background: var(--echo-purple-mid); border-color: var(--echo-purple-mid); }
.pdf-btn:active { transform: translateY(3px); box-shadow: 0 0 0 #4b14ad; }
.pdf-btn:focus-visible { outline: 2px solid var(--echo-purple-light); outline-offset: 2px; }

.pdf-sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 2rem auto 3rem;
    padding: 14mm;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(155, 95, 255, 0.2), 0 24px 60px -20px rgba(123, 47, 255, 0.45);
}

@media (max-width: 230mm) {
    .pdf-toolbar-hint { display: none; }
    .pdf-toolbar { justify-content: space-between; }
    .pdf-sheet { width: auto; min-height: 0; margin: 0; padding: 1rem; border-radius: 0; }
}

/* ─── Print ─── */
@page {
    size: A4;
    margin: 14mm 14mm 16mm;

    @bottom-right {
        font-family: 'DM Sans', system-ui, sans-serif;
        font-size: 8pt;
        color: #8a879a;
    }
}

@media print {
    html, body { background: #fff; }
    .pdf-toolbar { display: none; }
    .pdf-sheet {
        width: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ─── Masthead: the site hero as a dark band ─── */
.pdf-masthead {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 1.4rem 1.75rem 1.75rem;
    border-radius: 16px;
    color: #DEDEDE;
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(123, 47, 255, 0.55), transparent 60%),
        radial-gradient(80% 120% at 100% 100%, rgba(155, 95, 255, 0.22), transparent 65%),
        var(--echo-ink);
    border-bottom: 3px solid var(--echo-purple-mid);
    break-inside: avoid;
}

.pdf-masthead > * { position: relative; z-index: 1; }

.pdf-masthead-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 1.6rem;
    font-family: 'Syne', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    color: #fff;
}

.pdf-label,
.pdf-section-label {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.4;
}

.pdf-label { color: var(--echo-purple-light); margin-bottom: 0.35rem; }

.pdf-title {
    margin: 0;
    max-width: 26ch;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

.pdf-masthead-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.1rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
}

/* Same chip as the site's .badge-date. */
.pdf-masthead-meta li {
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    color: var(--echo-purple-light);
    background: rgba(123, 47, 255, 0.16);
    border: 1px solid rgba(155, 95, 255, 0.3);
}

.pdf-masthead-meta .bi,
.pdf-meta .bi,
.pdf-link .bi,
.pdf-note .bi { margin-right: 0.45rem; }

/* The page hero's UK↔RO map, still and faint, on the right of the band. */
.pdf-masthead > .hero-map {
    position: absolute;
    z-index: 0;
    top: -35%;
    right: -6%;
    width: 62%;
    height: 170%;
    opacity: 0.75;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(ellipse 60% 55% at 55% 45%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 60% 55% at 55% 45%, #000 40%, transparent 100%);
}
.pdf-masthead .hero-map svg { display: block; width: 100%; height: 100%; }
.pdf-masthead .hero-map .land {
    fill: rgba(255, 255, 255, 0.03);
    stroke: rgba(255, 255, 255, 0.22);
    stroke-width: 0.8;
    stroke-linejoin: round;
}
.pdf-masthead .hero-map :is(.arc, .flyway) {
    fill: none;
    stroke: url(#arcGrad);
    stroke-width: 1.4;
    stroke-linecap: round;
    opacity: 0.6;
}
.pdf-masthead .hero-map .core { fill: #E8CFFF; }
.pdf-masthead .hero-map :is(.pulse, .flow, .flyways) { display: none; }

/* ─── Sections ─── */
.pdf-section { margin-top: 1.75rem; }

.pdf-section-label { margin: 0 0 0.6rem; color: var(--pdf-accent); }

.pdf-section-title { margin: 0 0 1.25rem; font-size: 1.5rem; font-weight: 700; }

.pdf-events {
    padding-top: 1.5rem;
    border-top: 1px solid var(--pdf-rule);
}

.pdf-muted { color: var(--pdf-muted); }

.pdf-note {
    margin: 1rem 0 0;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    background: var(--pdf-tint);
    border: 1px solid rgba(155, 95, 255, 0.25);
    color: var(--pdf-accent);
    font-weight: 500;
}

.pdf-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 1rem;
    border-top: 1px solid var(--pdf-rule);
}

.pdf-link {
    font-size: 0.85rem;
    text-decoration: none;
    word-break: break-word;
}

/* ─── Rich text (rendered Markdown) ─── */
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p, .rich-text ul, .rich-text ol { margin: 0 0 0.75rem; }
.rich-text :is(ul, ol) { padding-left: 1.3rem; }
.rich-text li + li { margin-top: 0.2rem; }
.rich-text :is(h1, h2, h3, h4, h5, h6) { margin: 1.25rem 0 0.5rem; }
.rich-text h1 { font-size: 1.4rem; }
.rich-text h2 { font-size: 1.25rem; }
.rich-text h3 { font-size: 1.1rem; }
.rich-text :is(h4, h5, h6) { font-size: 1rem; }
.rich-text img { max-width: 100%; height: auto; border-radius: 10px; break-inside: avoid; }
.rich-text :not(pre) > code { color: var(--pdf-accent); font-size: 0.9em; }
.rich-text pre {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: var(--pdf-tint);
    border: 1px solid var(--pdf-rule);
    white-space: pre-wrap;
    break-inside: avoid;
}
.rich-text blockquote {
    margin: 0 0 0.75rem;
    padding-left: 1rem;
    border-left: 3px solid var(--echo-purple-mid);
    color: var(--pdf-muted);
}
.rich-text table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; }
.rich-text :is(th, td) { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--pdf-rule); text-align: left; }
.rich-text hr { border: 0; border-top: 1px solid var(--pdf-rule); margin: 1.25rem 0; }

/* ─── Events timeline (edition PDF) ─── */
/* Month dividers with a rail and dots, like the edition page's timeline. */
.pdf-timeline-month {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.75rem 0 1rem;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pdf-accent);
}
.pdf-timeline-month:first-child { margin-top: 0; }
.pdf-timeline-month::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--pdf-rule);
}

.pdf-timeline-list { list-style: none; margin: 0; padding: 0; }

.pdf-timeline-item {
    position: relative;
    padding-left: 1.75rem;
}
.pdf-timeline-item + .pdf-timeline-item { margin-top: 1rem; }

.pdf-timeline-item::before {
    content: "";
    position: absolute;
    left: calc(0.4rem - 1px);
    top: -0.5rem;
    bottom: -0.5rem;
    width: 2px;
    background: rgba(155, 95, 255, 0.35);
}
.pdf-timeline-item:first-child::before { top: 1.35rem; }
.pdf-timeline-item:last-child::before { bottom: auto; height: 1.85rem; }
.pdf-timeline-item:first-child:last-child::before { display: none; }

/* Dot level with the event's title band. */
.pdf-timeline-item::after {
    content: "";
    position: absolute;
    left: 0.4rem;
    top: 1.35rem;
    width: 12px;
    height: 12px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: var(--echo-purple-mid);
    box-shadow: 0 0 0 3px #fff, 0 0 10px rgba(123, 47, 255, 0.55);
}

/* ─── Event card ─── */
.pdf-event {
    overflow: hidden;
    border: 1px solid var(--pdf-rule);
    border-radius: 12px;
    background: #fff;
}

/* The site's purple-tinted card header, on white. */
.pdf-event-header {
    padding: 0.7rem 1.1rem;
    background:
        radial-gradient(140% 120% at 0% 0%, rgba(123, 47, 255, 0.16), transparent 70%),
        linear-gradient(135deg, rgba(123, 47, 255, 0.09), rgba(155, 95, 255, 0.02));
    border-bottom: 1px solid rgba(155, 95, 255, 0.3);
    break-inside: avoid;
    break-after: avoid;
}

.pdf-event-title { margin: 0; font-size: 1.05rem; font-weight: 700; }

.pdf-event-body { padding: 0.85rem 1.1rem 1rem; }

.pdf-event-body .pdf-link { display: inline-block; margin-top: 0.75rem; }

.pdf-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    margin: 0 0 0.75rem;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--pdf-muted);
    break-after: avoid;
}
.pdf-meta .bi { color: var(--echo-purple-mid); }

/* ─── Closing footer ─── */
.pdf-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-top: 2rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--pdf-rule);
    font-size: 0.78rem;
    color: var(--pdf-muted);
    break-inside: avoid;
}

.pdf-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: 'Syne', system-ui, sans-serif;
    font-weight: 700;
    color: var(--echo-ink);
}

/* The brand's "AI" gradient, darkened to stay legible on white. */
.pdf-footer .gradient-text {
    background-image: linear-gradient(135deg, var(--echo-purple), var(--echo-purple-mid));
}

/* The logo is white artwork; flip it to black on the white page. */
.pdf-footer-brand img { filter: invert(1); }
