/* filepath: css/erasmus.css */
/* Uses color variables from css/style.css (root vars) */

:root {
    --article-max: 980px; /* fallback for article width if not defined elsewhere */
    --shark: #222; /* default text color fallback */
    --pizazz: #ff7a59; /* default accent color fallback */
}

.erasmus-hero {
    position: relative;
    overflow: hidden;
    /* Comfortable left gutter; slightly less vertical padding so the hero fits one viewport */
    padding: 160px 20px 80px clamp(40px, 4vw, 56px);
    background: linear-gradient(180deg, rgba(31, 43, 59, 0.06) 0%, rgba(244, 243, 240, 0.02) 100%);
    min-height: 100vh;
    box-sizing: border-box;
    z-index: 2;
}

.erasmus-inner {
    /* Left-aligned (not centered 980px), but with room for the map */
    max-width: none;
    margin: 0;
    display: block;
    position: relative;
    z-index: 3;
    /* Inner stretches full width; let clicks pass through empty space to the map */
    pointer-events: none;
    width: fit-content;
    max-width: min(520px, 46vw);
}

.erasmus-copy {
    /* Wide enough for KA buttons in one row; leaves ~half the viewport for the map */
    max-width: 100%;
    pointer-events: auto;
}

.erasmus-copy h1 {
    color: var(--mirage);
    font-size: clamp(1.6rem, 2.8vw, 3rem);
    margin-bottom: 12px;
}

.erasmus-copy p {
    color: var(--shuttle-gray);
    line-height: 1.5;
    margin-bottom: 20px;
}

.erasmus-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.erasmus-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 12px;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    color: white;
    text-decoration: none;
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
    box-shadow: 0 8px 20px var(--shadow-color);
}

/* Variants */
.btn-ka1 {
    background: #001c5d;
}

.btn-ka2 {
    background: #003399;
;
}

.btn-ka3 {
    background: #0c4bbe;
}

.btn-eventos {
    background: rgba(41, 98, 243, 0.85);
}

.btn-noticias {
    /* fixed typo and improved visuals */
    color: #fff;
    display: block; /* make it occupy its own line so it can be centered */
    width: max-content; /* shrink to content so margin:auto centers it properly */
    margin: 20px auto 0; /* space above to separate from "Impacto" and center horizontally */
    padding: 14px 26px;
    border-radius: 12px;
    border: 0;
    box-shadow: 0 12px 28px rgba(239,54,45,0.14);
    text-align: center;
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: 0.4px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), opacity 120ms ease;
}

.erasmus-copy .erasmus-btn.btn-noticias {
    display: block !important;
    margin: 26px auto 0 !important; /* space above to separate from "Impacto" */
    width: max-content;
    min-width: 220px; /* make button legible */
    padding: 14px 34px;
    border-radius: 14px;
    font-size: 1.06rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border: 1px solid rgba(255,255,255,0.06);
    background-image: linear-gradient(90deg, rgba(0, 51, 153, 0.76), rgba(33, 29, 141, 0.78));
    color: #fff;
}

/* Responsive: full-width on narrow viewports for touch friendliness */
@media (max-width: 960px) {
    .erasmus-btn.btn-noticias {
        width: 100% !important;
        box-sizing: border-box;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 18px;
        padding-right: 18px;
    }

    .erasmus-copy .erasmus-btn.btn-noticias {
        width: 100% !important;
        min-width: 0 !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
    }
}

/* Back button variant */
.btn-back {
    background: var(--glass, #f3f4f6);
    color: var(--mirage, #1f2b3b);
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: fit-content;
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

.erasmus-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.18);
}

.erasmus-btn.btn-noticias:hover,
.erasmus-btn.btn-noticias:focus {
    transform: translateY(-4px);
    box-shadow: 0 20px 36px rgba(239,54,45,0.18);
    outline: none;
    opacity: 0.98;
}

.erasmus-btn.btn-noticias:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(239,54,45,0.12);
}

.erasmus-btn.btn-noticias:focus-visible {
    outline: 3px solid rgba(255,122,89,0.18);
    outline-offset: 4px;
}

/* Responsive media block (replaces parallax column) */
.erasmus-media {
    width: 100%;
    max-width: 420px; /* Restore max-width to contain it in the column */
    margin: 0 auto;
    display: block;
    overflow: hidden; /* Hide overflow to create cropping effect */
    position: relative;
}

.erasmus-media img:not(.europe-map) {
    display: block;
    width: 100%;
    height: auto;
    max-width: 420px;
    margin: 0 auto 12px;
    pointer-events: auto;
}

/* Small visual helpers */
.erasmus-features {
    margin-top: 30px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.feature {
    background: var(--glass);
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

/* Europe map container - positioned outside grid */
.europe-map-container {
    position: absolute;
    top: 0;
    right: 0;
    /* Wide enough that Atlantic/RUP (left of SVG) sit inside this box, not clipped */
    width: 60vw;
    height: 100%;
    overflow: hidden;
    pointer-events: auto;
    z-index: 1;
}

/* Europe map styling */
.europe-map-container .europe-map {
    display: block;
    height: 110%;
    width: auto;
    max-width: none;
    object-fit: contain;
    object-position: left bottom;
    opacity: 0.6;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
    transition: opacity 300ms ease;
    margin: 0;
    position: absolute;
    /* Anchor SW corner: RUP live at bottom-left of the SVG */
    left: 0;
    right: auto;
    bottom: 0;
    top: auto;
    transform: none;
}

.europe-map-container .europe-map:hover {
    opacity: 0.8;
}

/* Interactive Europe map (inline SVG) */
.europe-map-container svg {
    display: block;
    height: 110%;
    width: auto;
    max-width: none;
    position: absolute;
    left: 0;
    right: auto;
    bottom: 0;
    top: auto;
    transform: none;
    pointer-events: auto;
}

.europe-map-container .eu-country {
    cursor: pointer;
    transition: fill 160ms ease, filter 160ms ease;
}

.europe-map-container .eu-country.is-hover {
    fill: #ff7a59 !important;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

/* Keyboard focus for interactive countries */
.europe-map-container .eu-country:focus {
    outline: 2px solid #ff7a59;
    outline-offset: 2px;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}

/* Tooltip for country names */
#map-tooltip {
    position: fixed;
    z-index: 9999;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(22, 27, 34, 0.9);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    pointer-events: none;
    display: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* small helper for the buttons row */
.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* News grid and cards for Erasmus country page */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.news-card {
    background: var(--glass, #fff);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.news-card h3 a {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.news-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    background-color: #f3f4f6;
}

.news-card-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.news-card-body h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--mirage, #1f2b3b);
}

.news-date {
    font-size: 0.82rem;
    color: var(--shuttle-gray, #6b7280);
}

.news-card-body p {
    margin: 0;
    color: var(--shuttle-gray, #6b7280);
    line-height: 1.4;
}

.news-link {
    align-self: flex-start;
    margin-top: 6px;
    font-weight: 600;
    color: var(--dtim-red, #ef362d);
    text-decoration: none;
}

.news-link:hover {
    text-decoration: underline;
}

/* Erasmus news detail page */
.news-hero {
    position: relative;
    background: #0d1b2a;
    color: #fff;
    margin-top: 150px;
}

.news-hero-inner {
    max-width: var(--article-max);
    margin: 0 auto;
    padding: 24px 16px;
    display: grid;
    gap: 16px;
}

.news-hero .back {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: #fff;
    text-decoration: none;
    opacity: .9;
}

.news-hero .back:hover {
    opacity: 1;
}

.news-hero .title {
    font-size: clamp(1.6rem, 2.5vw, 2.4rem);
    line-height: 1.15;
    margin: 4px 0;
}

.news-hero .meta {
    color: rgba(255, 255, 255, .85);
    font-size: .95rem;
}

.news-cover {
    width: 100%;
    height: clamp(260px, 48vh, 620px); /* controlled height to show more of the image */
    object-fit: cover;
    object-position: center; /* center focal point */
    display: block;
}

@media (min-width: 1024px) and (min-aspect-ratio: 16/9) {
    .news-cover {
        object-fit: contain; /* avoid excessive crop on very wide screens */
        background-color: #0d1b2a; /* subtle bars match hero background */
    }
}

.news-body {
    max-width: var(--article-max);
    margin: 24px auto;
    padding: 0 16px 48px;
    color: var(--shark, #222);
}

.news-body .content {
    font-size: 1.05rem;
    line-height: 1.7;
}

.news-body .content img {
    max-width: 100%;
    height: auto;
}

.news-body .content p {
    margin: 1em 0;
}

.news-body .content h2, .news-body .content h3, .news-body .content h4 {
    margin-top: 1.2em;
}

.news-body .content a {
    color: var(--pizazz, #ff7a59);
}

.news-footer {
    max-width: var(--article-max);
    margin: 0 auto 48px;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.news-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--pizazz, #ff7a59);
    color: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    text-decoration: none;
    font-weight: 600;
}

.news-footer .btn:hover {
    filter: brightness(0.95);
}

/* News detail two-column article layout */
.news-article {
    max-width: var(--article-max);
    margin: 24px auto 48px;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr 40%;
    gap: 24px;
    align-items: start;
}

.news-article .content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--shark, #222);
}

.news-article .content img {
    max-width: 100%;
    height: auto;
}

.news-media img {
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #0d1b2a;
}

@media (min-width: 768px) {
    .news-hero-inner {
        padding: 40px 16px;
    }
}

/* Responsive: stack on smaller screens */
@media (max-width: 960px) {
    .erasmus-hero {
        padding: 160px 18px 100px;
    }

    .erasmus-inner {
        width: 100%;
        max-width: 100%;
        pointer-events: auto;
    }

    .erasmus-copy {
        max-width: 100%;
    }

    .europe-map-container {
        position: static;
        width: 100%;
        margin-top: 30px;
        overflow: visible;
        height: auto; /* allow SVG to define height */
    }

    .europe-map-container .europe-map {
        position: relative;
        width: 100%;
        height: auto; /* keep aspect ratio */
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
        object-fit: contain;
        object-position: center;
        opacity: 0.7;
    }

    .europe-map-container svg {
        position: relative;
        left: auto;
        right: auto;
        top: auto;
        bottom: auto;
        transform: none;
        width: 100%;
        height: auto; /* scale by width */
        display: block;
        margin: 0 auto;
    }

    /* News detail two-column article layout */
    .news-article {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .news-media {
        margin-top: 8px;
    }
}

/* Override global main defaults for news detail */
main.news-article {
    height: auto !important;
    min-height: 0 !important;
    margin-top: 32px !important; /* add breathing room below hero */
    text-align: left;
}

/* Estilos para o Editor de Texto Personalizado */
.custom-editor-container {
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.custom-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 8px;
    background-color: #f7f7f7;
    border-bottom: 1px solid #ccc;
}

.custom-editor-toolbar button,
.custom-editor-toolbar select,
.custom-editor-toolbar input {
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
}

.custom-editor-toolbar button:hover,
.custom-editor-toolbar select:hover {
    background-color: #e9e9e9;
}

.custom-editor-toolbar button.active {
    background-color: #d1e7fd;
    border-color: #0d6efd;
}

.custom-editor-toolbar input[type="color"] {
    width: 32px;
    padding: 2px;
}

.editor-area {
    min-height: 300px;
    padding: 15px;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
    background-color: #fff;
}

.editor-area p {
    margin: 0 0 1em 0;
}

/* KA1 Projects listing (used in erasmus-ka1.php) */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--gap, 18px);
    margin-top: 18px;
}

.project-card {
    background: var(--glass, #fff);
    border-radius: var(--radius, 12px);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 8px 18px var(--shadow-color, rgba(0, 0, 0, 0.08));
    transition: transform 180ms var(--ease, ease), box-shadow 180ms var(--ease, ease);
    display: flex;
    flex-direction: column;
    text-decoration: none; /* when used as <a> */
    color: inherit; /* when used as <a> */
}

/* Keep images neatly inside the card without cropping; adds subtle letterboxing if needed */
.project-card img {
    width: 100%;
    display: block;
    aspect-ratio: 129/50; /* ~2.58:1, close to 413x160 */
    object-fit: contain; /* show the whole image without distortion */
    object-position: center;
    background-color: #f3f4f6; /* neutral backdrop for letterboxing */
}

.project-info {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.project-info h3 {
    font-size: 1rem;
    margin: 0;
    color: var(--mirage, #1f2b3b);
}

.project-year {
    font-size: 0.85rem;
    color: var(--shuttle-gray, #6b7280);
}

@media (max-width: 520px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* Simple reveal-in animation for hero text */
.reveal {
    opacity: 0;
    transform: translateY(8px);
    animation: revealFadeUp 520ms var(--ease, ease) forwards;
}

@keyframes revealFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsiveness tweaks for tighter screens */
@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-info {
        padding: 10px 12px;
    }
}

/* KA1 sections sub-navigation */
.ka1-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 18px;
}

.ka1-subnav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--glass, #f3f4f6);
    color: var(--mirage, #1f2b3b);
    text-decoration: none;
    border: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 600;
}

.ka1-subnav a:hover {
    filter: brightness(0.98);
}

/* KA1 sections layout */
.ka1-sections {
    margin-top: 10px;
}

.ka1-section {
    margin: 22px 0 8px;
    scroll-margin-top: 90px;
}

.ka1-section h2 {
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
    color: var(--mirage, #1f2b3b);
    margin: 0 0 6px 0;
}

.section-intro {
    color: var(--shuttle-gray, #6b7280);
    margin: 0 0 10px 0;
}

/* Cards grid for section content */
.ka1-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.info-card {
    background: var(--glass, #fff);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    padding: 12px 14px;
}

.info-card h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--mirage, #1f2b3b);
}

.info-card p {
    margin: 0;
    color: var(--shuttle-gray, #6b7280);
}

.info-card ul {
    margin: 0;
    padding-left: 18px;
    color: var(--shuttle-gray, #6b7280);
}

.info-card li {
    margin: 4px 0;
}

@media (max-width: 520px) {
    .ka1-subnav {
        gap: 8px;
    }

    .ka1-subnav a {
        padding: 7px 10px;
    }
}

/* Hover lift for project card */
.project-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

/* Courses grid/cards (KA1 Projetos) */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.eras-course-card {
    background: var(--glass, #fff);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none; /* when used as <a> */
    color: inherit; /* when used as <a> */
    transition: transform 160ms var(--ease, ease), box-shadow 160ms var(--ease, ease);
}

.eras-course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.course-thumb {
    position: relative;
    background: #f3f4f6;
}

.course-thumb img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    object-position: center;
    display: block;
    background: #f3f4f6;
}

.course-title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.54) 100%);
}

/* Content area inside Erasmus course cards (missing style added) */
.eras-course-body {
    padding: 12px 14px;
    color: var(--shuttle-gray, #6b7280);
}

/* ==== Curso Estruturado (detail page) styles ==== */
.course-hero {
    padding-top: 160px; /* lower top space for detail */
    padding-bottom: 80px;
}

/* Breadcrumb back link */
.eras-breadcrumb {
    margin: 8px 0 12px;
}

.eras-breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--glass, #f3f4f6);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--mirage, #1f2b3b);
    text-decoration: none;
    font-weight: 600;
}

.eras-breadcrumb a:hover {
    filter: brightness(0.98);
    text-decoration: none;
}

.course-hero h1 {
    margin: 6px 0 10px;
}

/* slightly increase section spacing for visual rhythm */
.course-section {
    margin-top: 24px;
}

.course-header {
    gap: 18px;
}

/* Carousel (Erasmus course) */
.eras-course-carousel {
    position: relative;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

/* Scoped carousel styles */
.eras-course-carousel .carousel-viewport {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: #0d1b2a;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.12);
}

.eras-course-carousel .carousel-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #0d1b2a;
    filter: none; /* ensure no grayscale/brightness filter is applied */
    opacity: 1;
}

/* Prev/Next buttons (scoped) */
.eras-course-carousel .carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    transition: background 140ms ease, transform 140ms ease;
}

.eras-course-carousel .carousel-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.eras-course-carousel .carousel-btn.prev {
    left: 8px;
}

.eras-course-carousel .carousel-btn.next {
    right: 8px;
}

/* Thumbnails (if ever used) */
.eras-course-carousel .carousel-thumbs {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.eras-course-carousel .carousel-thumbs button {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    outline: 2px solid transparent;
}

.eras-course-carousel .carousel-thumbs button.active {
    outline-color: var(--pomegranate);
}

.eras-course-carousel .carousel-thumbs img {
    display: block;
    width: 140px;
    height: auto;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #f3f4f6;
}

/* Fix auto-scrolling from global .carousel on course page */
.course-hero .eras-course-carousel {
    display: block;
    width: 100%;
    animation: none !important;
}

/* Cleanup: remove previously added placeholder scoped selectors */
/* removed: .course-hero .carousel-viewport { ... } and similar placeholder blocks */

/* Ensure full width content for course page */
.course-hero .erasmus-copy {
    max-width: 100%;
}

/* ============================================= */
/* === CURSO ESTRUTURADO (curso-estruturado.php) */
/* ============================================= */

/* --- Layout Geral do Curso --- */
.course-hero .erasmus-copy {
    padding-top: 2rem;
    padding-bottom: 4rem;
}

.eras-breadcrumb {
    margin-bottom: 1.5rem;
}

.eras-breadcrumb a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.eras-breadcrumb a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* --- Cabeçalho do Curso (Imagem + Metadados) --- */
.course-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 3rem;
    align-items: flex-start;
}

.course-header img {
    width: 100%;
    max-width: 450px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    object-fit: cover;
    justify-self: center;
}

.course-meta.eras-info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0;
}

.course-meta .eras-info-item {
    align-items: flex-start;
}

.course-meta .eras-info-item i {
    background-color: transparent;
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-top: 2px;
}

/* --- Secções de Conteúdo (Objetivos, Programa, etc.) --- */
.course-section {
    margin-top: 3.5rem;
    border-top: 1px solid #eee;
    padding-top: 2rem;
}

.eras-section-title {
    font-size: 1.8rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.eras-section-title i {
    margin-right: 0.75rem;
}

.eras-section-divider {
    height: 3px;
    width: 80px;
    background: var(--primary-color);
    margin-bottom: 1.5rem;
    border: none;
}

.course-section > div:last-child {
    line-height: 1.7;
    color: var(--text-color-light);
}

/* --- Carrossel da Galeria --- */
.eras-course-carousel {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.carousel-viewport {
    width: 100%;
    aspect-ratio: 16 / 9; /* Proporção da imagem */
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.4s ease-in-out;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 10;
}

.carousel-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.carousel-btn.prev {
    left: 10px;
}

.carousel-btn.next {
    right: 10px;
}

/* --- Lista de Média (Vídeos e Ficheiros) --- */
.eras-media-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.eras-media-list .video-embed {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 8px;
}

.eras-media-list a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 500;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    border: 1px solid #eee;
}

.eras-media-list a:hover {
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
    color: var(--primary-color);
}

.eras-media-list a i {
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* --- Media Queries para Responsividade --- */
@media (min-width: 768px) {
    .course-header {
        grid-template-columns: 350px 1fr; /* Imagem à esquerda, texto à direita */
    }

    .course-header img {
        justify-self: start;
    }
}

@media (min-width: 1024px) {
    .course-header {
        grid-template-columns: 450px 1fr;
    }
}


/* Keep styles scoped and minimal to avoid interfering with site-wide CSS */
.erasmus-logo-wrap {
    display: flex;
    justify-content: center; /* center above title */
    align-items: center;
    margin-bottom: 0.9rem; /* small gap between logo and heading */
}
.erasmus-logo {
    display: block;
    width: clamp(80px, 18vw, 160px); /* responsive size */
    height: auto;
    max-height: 110px;
    object-fit: contain;
}
/* Small screens: slightly smaller spacing to avoid pushing content */
@media (max-width: 420px) {
    .erasmus-logo-wrap { margin-bottom: 0.6rem; }
    .erasmus-logo { width: clamp(64px, 28vw, 120px); }
}
