/**
 * UMBC Study Abroad — styles for the study-abroad CPT templates.
 * Covers: archive-study-abroad, single-study-abroad, and the destination,
 *         term, and theme taxonomy archives.
 *
 * Structure and spacing follow css/umbc-magazine.css so the two archives read
 * as siblings. Dark-theme overrides live at the bottom of the file, matching
 * the magazine convention.
 */

/* ============================================================
   ARCHIVE: HEADER
   ============================================================ */

.sa-archive-container,
.sa-single-container {
    padding-bottom: 4rem;
}

/* The shared back-link row is 1300px wide with no padding, so against these
   1200px containers it hangs outside the content frame. Re-align it to match. */
.sa-archive-container .magazine-back-link-row,
.sa-single-container .magazine-back-link-row {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

@media (max-width: 600px) {
    .sa-archive-container .magazine-back-link-row,
    .sa-single-container .magazine-back-link-row {
        padding: 0 1rem;
    }
}

.sa-archive-header {
    max-width: 1200px;
    margin: 0 auto 2.5rem;
    padding: 2rem;
    text-align: center;
}

.sa-archive-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.sa-archive-header p {
    max-width: 60ch;
    margin: 0 auto;
    color: #4a4a4a;
}

.sa-archive-count {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b6b6b;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   ARCHIVE: ROTATING REGIONAL FEATURE
   ============================================================ */

.sa-hero {
    position: relative;
    max-width: 1200px;
    margin: 0 auto 3rem;
    background: linear-gradient(135deg, #007176 0%, #004a4e 100%);
    border-radius: 12px;
    color: #fff;
    overflow: hidden;
}

.sa-hero-region-label {
    position: absolute;
    top: 1.25rem;
    left: 1.5rem;
    z-index: 3;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fdb515;
}

.sa-hero-slides {
    display: grid;
}

/* Slides stack so the hero keeps one height and never reflows on rotate. */
.sa-hero-slide {
    grid-area: 1 / 1;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 0;
    align-items: stretch;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.45s ease;
}

.sa-hero-slide.is-active {
    opacity: 1;
    visibility: visible;
}

.sa-hero-media {
    position: relative;
    min-height: 380px;
    overflow: hidden;
}

.sa-hero-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sa-hero-body {
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.85rem;
}

.sa-hero-place {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #fdb515;
}

.sa-hero-body h2 {
    font-size: 2rem;
    line-height: 1.15;
    margin: 0;
    color: #fff;
    text-wrap: balance;
}

.sa-hero-body h2 a {
    color: #fff;
    text-decoration: none;
}

.sa-hero-body h2 a:hover,
.sa-hero-body h2 a:focus {
    text-decoration: underline;
}

.sa-hero-excerpt {
    font-size: 1rem;
    line-height: 1.6;
    opacity: 0.95;
    margin: 0;
    max-width: 46ch;
}

.sa-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    margin-top: 0.25rem;
}

.sa-hero-student {
    font-size: 0.9rem;
    line-height: 1.35;
}

.sa-hero-student span {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
}

.sa-hero-cta {
    align-self: flex-start;
    margin-top: 0.75rem;
    padding: 0.85rem 1.75rem;
    background: #fff;
    color: #005155;
    border-radius: 6px;
    font-weight: 700;
    text-decoration: none;
    transition:
        transform 0.3s,
        box-shadow 0.3s;
}

.sa-hero-cta:hover,
.sa-hero-cta:focus {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
    color: #005155;
}

/* Term stamp — carried through hero, cards, and single so the date reads fast */
.sa-stamp {
    display: inline-block;
    padding: 0.28rem 0.6rem;
    background: #fdb515;
    color: #17150f;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sa-hero-controls {
    position: absolute;
    right: 1.5rem;
    bottom: 1.25rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sa-hero-arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    transition: background 0.2s;
}

.sa-hero-arrow:hover,
.sa-hero-arrow:focus {
    background: rgba(255, 255, 255, 0.25);
}

.sa-hero-dots {
    display: flex;
    gap: 0.4rem;
}

.sa-hero-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s;
}

.sa-hero-dot.is-active {
    background: #fdb515;
    border-color: #fdb515;
}

/* ============================================================
   ARCHIVE: FILTERS
   ============================================================ */

.sa-filters {
    max-width: 1200px;
    margin: 0 auto 2.5rem;
    padding: 1.25rem 2rem;
    border: 2px solid #f3f3f3;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.sa-filter-row {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.sa-filter-legend {
    flex: 0 0 4.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b6b6b;
}

.sa-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.sa-chip {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    border: 1px solid #d8d8d8;
    border-radius: 999px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #333;
    transition:
        background 0.2s,
        border-color 0.2s,
        color 0.2s;
}

.sa-chip:hover,
.sa-chip:focus {
    border-color: #007176;
    color: #007176;
}

.sa-chip.is-active {
    background: #007176;
    border-color: #007176;
    color: #fff;
}

/* ============================================================
   ARCHIVE: CARD GRID
   ============================================================ */

.sa-grid {
    max-width: 1200px;
    margin: 0 auto 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
}

.sa-card {
    border: 2px solid #f3f3f3;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition:
        transform 0.3s,
        box-shadow 0.3s;
}

.sa-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.sa-card-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #f3f3f3;
}

.sa-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.sa-card:hover .sa-card-media img {
    transform: scale(1.05);
}

/* Six posts lost every image to link rot on the source site. */
.sa-card-noimage {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #007176 0%, #004a4e 100%);
    color: #fdb515;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sa-card-media .sa-stamp {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 2;
}

.sa-card-body {
    padding: 1.25rem 1.35rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sa-card-place {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5f5b54;
}

.sa-card-body h2 {
    font-size: 1.25rem;
    line-height: 1.25;
    margin: 0;
}

.sa-card-body h2 a {
    text-decoration: none;
    color: inherit;
}

.sa-card-body h2 a:hover,
.sa-card-body h2 a:focus {
    text-decoration: underline;
}

.sa-card-excerpt {
    font-size: 0.92rem;
    line-height: 1.55;
    color: #4a4a4a;
    margin: 0;
}

.sa-card-byline {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid #eee;
}

.sa-card-byline img,
.sa-card-initials {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}

.sa-card-initials {
    display: grid;
    place-items: center;
    background: #f3f3f3;
    color: #6b6b6b;
    font-size: 0.75rem;
    font-weight: 700;
}

.sa-card-who {
    font-size: 0.88rem;
    line-height: 1.3;
}

.sa-card-who span {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #6b6b6b;
}

.sa-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
}

.sa-pagination {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 2rem;
    text-align: center;
}

/* ============================================================
   SINGLE
   ============================================================ */

.sa-single-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 3rem;
    align-items: start;
}

.sa-rail {
    position: sticky;
    top: 2rem;
    border: 2px solid #f3f3f3;
    border-radius: 8px;
    padding: 1.5rem;
}

.sa-rail-portrait {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    margin-bottom: 1rem;
}

.sa-rail-name {
    font-size: 1.35rem;
    margin: 0 0 1rem;
}

.sa-facts {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.sa-fact dt {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b6b6b;
    margin-bottom: 0.15rem;
}

.sa-fact dd {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
}

.sa-rail-cta {
    display: block;
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    text-align: center;
    background: #007176;
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.3s;
}

.sa-rail-cta:hover,
.sa-rail-cta:focus {
    background: #005155;
    color: #fff;
}

.sa-rail-cta-secondary {
    background: transparent;
    color: #007176;
    border: 2px solid #007176;
    margin-top: 0.6rem;
}

.sa-rail-cta-secondary:hover,
.sa-rail-cta-secondary:focus {
    background: #007176;
    color: #fff;
}

.sa-article-crumb {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #5f5b54;
    margin-bottom: 0.75rem;
}

.sa-article-crumb a {
    color: inherit;
}

.sa-article-title {
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    line-height: 1.12;
    margin: 0;
    text-wrap: balance;
}

.sa-article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
    margin: 1rem 0 0;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    color: #6b6b6b;
}

.sa-topic {
    text-decoration: none;
    color: #007176;
    border: 1px solid #007176;
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
}

.sa-topic:hover,
.sa-topic:focus {
    background: #007176;
    color: #fff;
}

.sa-article-hero {
    margin: 1.75rem 0 0;
}

.sa-article-hero img {
    width: 100%;
    border-radius: 8px;
    display: block;
}

.sa-article-hero figcaption,
.sa-article-body figcaption {
    font-size: 0.82rem;
    color: #6b6b6b;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.sa-article-body {
    margin-top: 1.5rem;
}

.sa-article-body > p {
    font-size: 1.06rem;
    line-height: 1.72;
    max-width: 68ch;
}

.sa-article-body h2 {
    font-size: 1.5rem;
    margin: 2.5rem 0 0.75rem;
    scroll-margin-top: 2rem;
}

.sa-article-body h3 {
    font-size: 1.2rem;
    margin: 2rem 0 0.5rem;
}

.sa-article-body img,
.sa-article-body video {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Embedded video (YouTube/Vimeo oEmbed, raw iframes) has intrinsic width that
   overruns the column, so pin it to the container and keep a 16:9 box. */
.sa-article-body iframe,
.sa-article-body embed,
.sa-article-body object {
    max-width: 100%;
}

.sa-article-body .wp-block-embed__wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.sa-article-body .wp-block-embed__wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

.sa-timestamp-note {
    margin-top: 2.5rem;
    padding: 1rem 1.25rem;
    border-left: 4px solid #007176;
    background: rgba(0, 113, 118, 0.07);
    border-radius: 0 6px 6px 0;
    font-size: 0.92rem;
    line-height: 1.6;
}

.sa-timestamp-note b {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #007176;
    margin-bottom: 0.25rem;
}

.sa-related {
    margin-top: 3.5rem;
    padding-top: 2rem;
    border-top: 2px solid #f3f3f3;
}

.sa-related h2 {
    font-size: 1.4rem;
    margin: 0 0 1.25rem;
}

.sa-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.sa-related-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sa-related-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    display: block;
    transition: transform 0.3s;
}

.sa-related-card:hover img {
    transform: scale(1.04);
}

.sa-related-title {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.3;
}

.sa-related-term {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b6b6b;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
    .sa-single-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .sa-rail {
        position: static;
    }

    .sa-hero-slide {
        grid-template-columns: 1fr;
    }

    .sa-hero-media {
        min-height: 240px;
        aspect-ratio: 16 / 9;
    }

    .sa-hero-body {
        padding: 2rem 1.5rem 4rem;
    }

    .sa-hero-controls {
        right: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 600px) {
    .sa-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
    }

    .sa-filters {
        margin-left: 1rem;
        margin-right: 1rem;
        padding: 1rem;
    }

    .sa-filter-legend {
        flex-basis: 100%;
    }

    .sa-single-layout {
        padding: 0 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sa-card,
    .sa-card-media img,
    .sa-hero-slide,
    .sa-hero-cta,
    .sa-related-card img {
        transition: none;
    }
}

/* ============================================================
   DARK THEME
   ============================================================ */

[data-theme="dark"] .sa-archive-header p,
[data-theme="dark"] .sa-card-excerpt {
    color: #c9c9c9;
}

[data-theme="dark"] .sa-archive-count,
[data-theme="dark"] .sa-filter-legend,
[data-theme="dark"] .sa-card-who span,
[data-theme="dark"] .sa-fact dt,
[data-theme="dark"] .sa-article-meta,
[data-theme="dark"] .sa-related-term,
[data-theme="dark"] .sa-article-hero figcaption,
[data-theme="dark"] .sa-article-body figcaption {
    color: #9a9a9a;
}

[data-theme="dark"] .sa-card,
[data-theme="dark"] .sa-filters,
[data-theme="dark"] .sa-rail,
[data-theme="dark"] .sa-related {
    border-color: #3d3d3d;
}

[data-theme="dark"] .sa-card-media,
[data-theme="dark"] .sa-card-initials {
    background: #2a2a2a;
}

[data-theme="dark"] .sa-card-byline,
[data-theme="dark"] .sa-facts,
[data-theme="dark"] .sa-article-meta {
    border-color: #3d3d3d;
}

[data-theme="dark"] .sa-chip {
    border-color: #4a4a4a;
    color: #e6e6e6;
}

[data-theme="dark"] .sa-chip:hover,
[data-theme="dark"] .sa-chip:focus {
    border-color: #2fa39f;
    color: #2fa39f;
}

[data-theme="dark"] .sa-chip.is-active {
    background: #2fa39f;
    border-color: #2fa39f;
    color: #12211f;
}

[data-theme="dark"] .sa-card-place,
[data-theme="dark"] .sa-article-crumb {
    color: #fdb515;
}

[data-theme="dark"] .sa-topic {
    color: #2fa39f;
    border-color: #2fa39f;
}

[data-theme="dark"] .sa-topic:hover,
[data-theme="dark"] .sa-topic:focus {
    background: #2fa39f;
    color: #12211f;
}

[data-theme="dark"] .sa-timestamp-note {
    background: rgba(47, 163, 159, 0.12);
    border-left-color: #2fa39f;
}

[data-theme="dark"] .sa-timestamp-note b {
    color: #2fa39f;
}

[data-theme="dark"] .sa-rail-cta {
    background: #2fa39f;
    color: #12211f;
}

[data-theme="dark"] .sa-rail-cta:hover,
[data-theme="dark"] .sa-rail-cta:focus {
    background: #46bdb9;
    color: #12211f;
}

[data-theme="dark"] .sa-rail-cta-secondary {
    background: transparent;
    color: #2fa39f;
    border-color: #2fa39f;
}

[data-theme="dark"] .sa-rail-cta-secondary:hover,
[data-theme="dark"] .sa-rail-cta-secondary:focus {
    background: #2fa39f;
    color: #12211f;
}
