/* Visual language for everything after the intro fold.
   Sharp corners stay (platform rule). Motion yields to prefers-reduced-motion. */

:root {
    --atlas-ink: #1a1a1a;
    --atlas-muted: #4a4a4a;
    --atlas-line: rgba(0, 133, 66, 0.16);
    --atlas-paper: #f7f6f1;
}

html,
body { overflow-x: hidden; }

/* ---- Map paper on pages after the intro ---- */
body:not(.page-home) {
    background-color: var(--atlas-paper);
    background-image:
        linear-gradient(var(--atlas-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--atlas-line) 1px, transparent 1px),
        radial-gradient(ellipse at 12% 0%, rgba(255, 184, 28, 0.16), transparent 42%),
        radial-gradient(ellipse at 100% 80%, rgba(0, 133, 66, 0.08), transparent 46%);
    background-size: 56px 56px, 56px 56px, auto, auto;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body:not(.page-home) > nav.navbar {
    margin-bottom: 1.75rem !important;
    border-bottom: 4px solid var(--uem-yellow);
}

body:not(.page-home) > .container {
    flex: 1 0 auto;
    width: 100%;
    position: relative;
}

body:not(.page-home) .card {
    box-shadow: 0 10px 28px rgba(0, 48, 24, 0.08);
}

/* ---- Gate ornament (login, registo, entrada) ---- */
.gate-ornament {
    display: none;
}

body.page-gate { position: relative; }

body.page-gate .gate-ornament {
    display: block;
    position: absolute;
    top: 56px;
    right: 0;
    width: 480px;
    pointer-events: none;
}

body.page-gate .gate-ornament .earth-globe {
    width: 480px;
    position: relative;
    right: -40px;
}

svg.gate-route { display: none; }

body.page-gate .card {
    position: relative;
    z-index: 1;
    background-color: #fff;
    background-image:
        linear-gradient(180deg, rgba(255, 184, 28, 0.14), transparent 72px);
    box-shadow: 0 16px 40px rgba(0, 48, 24, 0.1);
    animation: gt-rise 0.55s ease both;
}

body.page-gate .card h3 {
    letter-spacing: -0.02em;
}

/* ---- Site footer (every page except the home story, which has its own) ---- */
.gt-site-footer {
    margin-top: 2.5rem;
    padding: 1.75rem 0 1.5rem;
    background: linear-gradient(135deg, var(--uem-green) 0%, #006030 100%);
    color: #fff;
    border-top: 4px solid var(--uem-yellow);
}

body.page-home .gt-site-footer {
    display: none;
}

.gt-site-footer p {
    margin-bottom: 0.3rem;
}

.gt-site-footer .gt-foot-note {
    opacity: 0.9;
    max-width: 36rem;
}

.gt-site-footer a {
    color: var(--uem-yellow);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gt-site-footer a:hover {
    color: #fff;
}

/* ---- Story (below the intro fold) ---- */
.home-story {
    position: relative;
    color: var(--atlas-ink);
}

.story-band {
    position: relative;
    padding: 5rem 0 4.5rem;
    background-color: #fff;
    background-image:
        linear-gradient(rgba(0, 133, 66, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 133, 66, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
}

.story-band.alt {
    background-color: #f3f1e8;
    background-image:
        linear-gradient(rgba(0, 133, 66, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 133, 66, 0.06) 1px, transparent 1px),
        radial-gradient(ellipse at 80% 0%, rgba(255, 184, 28, 0.18), transparent 50%);
    background-size: 48px 48px, 48px 48px, auto;
}

.story-band h2 {
    color: var(--uem-green);
    font-weight: 700;
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.85rem;
}

.story-kicker {
    display: inline-block;
    margin-bottom: 0.85rem;
    padding: 0.28rem 0.6rem;
    background: var(--uem-yellow);
    color: #1a1a1a;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.story-lead {
    font-size: 1.15rem;
    line-height: 1.65;
    max-width: 40rem;
    color: #3d3d3d;
    margin-bottom: 0;
}

.atlas-divider {
    position: relative;
    z-index: 2;
    height: 0;
    background: transparent;
    pointer-events: none;
}

.atlas-divider > svg {
    position: absolute;
    left: 0;
    right: 0;
    top: -26px;
    display: block;
    width: 100%;
    height: 52px;
}

.atlas-divider .c1 {
    fill: none;
    stroke: var(--uem-green);
    stroke-width: 1.75;
}

.atlas-divider .c2 {
    fill: none;
    stroke: #c99212;
    stroke-width: 1.5;
    stroke-dasharray: 7 9;
}

.atlas-pin {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--uem-yellow);
    color: #1a1a1a;
    box-shadow: 0 0 0 6px rgba(255, 184, 28, 0.28);
}

.atlas-pin svg {
    width: 1rem;
    height: 1rem;
}

/* Clip the globe at the section edge, without creating a card. */
#sobre { overflow: hidden; }

.globe-row {
    position: relative;
    min-height: 440px;
}

.globe-column.reveal {
    position: static;
    transform: none;
}

.globe-panel {
    position: absolute;
    top: 50%;
    right: -180px;
    width: 500px;
    min-height: 440px;
    transform: translateY(-50%);
}

.globe-panel .earth-globe { width: 500px; }

.earth-globe,
.globe-panel {
    background: none;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.earth-globe::before,
.earth-globe::after,
.globe-panel::before,
.globe-panel::after {
    content: none;
    display: none;
}

.earth-globe {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    animation: gt-earth-float 14s ease-in-out infinite;
}

.earth-photo {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50% !important;
    filter: drop-shadow(0 12px 24px rgba(0, 133, 66, .35));
}

.earth-credit {
    margin-top: 0.7rem;
    font-size: 0.68rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
    text-align: center;
    color: #5c6570;
}

/* Keep the credit in the visible part of the landing globe. */
.globe-panel .earth-credit {
    align-self: flex-start;
    width: 320px;
}

.gt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background: rgba(0, 133, 66, 0.12);
    color: var(--uem-green);
    margin-bottom: 1rem;
    transition: transform 0.25s ease, background 0.25s ease;
}

.gt-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.gt-icon.yellow {
    background: var(--uem-yellow);
    color: #1a1a1a;
}

.atlas-tile,
.story-card {
    position: relative;
    background: #fff;
    border-top: 4px solid var(--uem-green);
    box-shadow: 0 10px 28px rgba(0, 48, 24, 0.07);
    padding: 1.5rem 1.4rem 1.45rem;
    height: 100%;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.atlas-tile::before,
.story-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: var(--uem-yellow);
    transition: width 0.25s ease;
}

.atlas-tile:hover,
.story-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 36px rgba(0, 48, 24, 0.14);
}

.atlas-tile:hover::before,
.story-card:hover::before {
    width: 4px;
}

.atlas-tile:hover .gt-icon,
.story-card:hover .gt-icon {
    transform: translateY(-3px);
}

.atlas-tile h3,
.story-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
    color: var(--atlas-ink);
}

.atlas-tile p,
.story-card p,
.story-point p {
    margin-bottom: 0;
    color: var(--atlas-muted);
    line-height: 1.6;
}

.story-card {
    padding-top: 1.35rem;
}

.story-card .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    background: var(--uem-yellow);
    color: #1a1a1a;
    font-weight: 800;
    margin-right: 0.45rem;
    vertical-align: middle;
}

.steps-wrap {
    position: relative;
    padding-top: 2rem;
}

.steps-route {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 0;
    height: 18px;
    pointer-events: none;
}

.route-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 8px;
    height: 3px;
    background: repeating-linear-gradient(90deg, var(--uem-green) 0 12px, transparent 12px 20px);
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1.15s ease;
}

.steps-wrap.is-visible .route-line {
    clip-path: inset(0 0 0 0);
}

.route-node {
    position: absolute;
    top: 2px;
    width: 14px;
    height: 14px;
    background: var(--uem-yellow);
    border: 2px solid var(--uem-green);
}

.route-node.n1 { left: 0; }
.route-node.n2 { left: 50%; margin-left: -7px; }
.route-node.n3 { right: 0; }


.home-footer {
    position: relative;
    background: linear-gradient(135deg, var(--uem-green) 0%, #006030 100%);
    color: #fff;
    padding: 2.75rem 0 2.4rem;
    border-top: 4px solid var(--uem-yellow);
}

.home-footer a {
    color: var(--uem-yellow);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.home-footer a:hover {
    color: #fff;
}

.home-footer p {
    margin-bottom: 0.35rem;
}

.home-footer .footer-note {
    opacity: 0.9;
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

.reveal-d1 { transition-delay: 0.08s; }
.reveal-d2 { transition-delay: 0.16s; }
.reveal-d3 { transition-delay: 0.24s; }

.steps-wrap.reveal {
    opacity: 1;
    transform: none;
}

@keyframes gt-earth-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes gt-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes gt-dash {
    to { stroke-dashoffset: -80; }
}

.gate-route path,
.atlas-divider .c2 {
    animation: gt-dash 14s linear infinite;
}

/* ---- Dark mode ---- */
body.dark-mode:not(.page-home) {
    --atlas-line: rgba(61, 206, 134, 0.1);
    background-color: #12121f;
    background-image:
        linear-gradient(var(--atlas-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--atlas-line) 1px, transparent 1px),
        radial-gradient(ellipse at 10% 0%, rgba(255, 184, 28, 0.08), transparent 40%),
        radial-gradient(ellipse at 100% 100%, rgba(0, 133, 66, 0.14), transparent 48%);
}

body.dark-mode.page-gate .card {
    background-color: #1a1a2e;
    background-image: linear-gradient(180deg, rgba(255, 184, 28, 0.1), transparent 72px);
    box-shadow: none;
}

body.dark-mode .home-story { color: #e8e8e8; }

body.dark-mode .story-band {
    background-color: #12121f;
    background-image:
        linear-gradient(rgba(61, 206, 134, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(61, 206, 134, 0.06) 1px, transparent 1px);
}

body.dark-mode .story-band.alt {
    background-color: #16162a;
    background-image:
        linear-gradient(rgba(61, 206, 134, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(61, 206, 134, 0.07) 1px, transparent 1px),
        radial-gradient(ellipse at 80% 0%, rgba(255, 184, 28, 0.08), transparent 50%);
}

body.dark-mode .story-band h2 { color: #3dce86; }

body.dark-mode .story-lead,
body.dark-mode .atlas-tile p,
body.dark-mode .story-card p,
body.dark-mode .story-point p { color: #b8b8c8; }

body.dark-mode .atlas-tile,
body.dark-mode .story-card {
    background-color: #1a1a2e;
    color: #e8e8e8;
    border: 1px solid #2a3a5a;
    border-top: 4px solid var(--uem-green);
    box-shadow: none;
}

body.dark-mode .earth-credit { color: #9aa3b5; }

body.dark-mode .atlas-tile h3,
body.dark-mode .story-card h3 { color: #e8e8e8; }

body.dark-mode .gt-icon {
    background: rgba(0, 133, 66, 0.25);
    color: #3dce86;
}

body.dark-mode .gt-icon.yellow {
    background: var(--uem-yellow);
    color: #1a1a1a;
}

body.dark-mode .home-footer,
body.dark-mode .gt-site-footer { color: #fff; }

body.dark-mode .atlas-divider .c1 { stroke: #3dce86; }

@media (max-width: 991.98px) {
    body.page-gate .gate-ornament {
        width: 250px;
        opacity: .55;
    }

    body.page-gate .gate-ornament .earth-globe {
        width: 250px;
        right: 0;
    }

    /* Reserve visible space above the form rather than hiding the globe. */
    body.page-gate > .container { padding-top: 220px; }

    .globe-row { min-height: 0; }

    .globe-panel {
        position: relative;
        top: auto;
        right: 0;
        width: 260px;
        min-height: 300px;
        margin: .5rem 0 0 auto;
        transform: none;
    }

    .globe-panel .earth-globe,
    .globe-panel .earth-credit { width: 260px; }
}

@media (max-width: 767.98px) {
    .story-band { padding: 3.25rem 0 3rem; }
    .story-lead { font-size: 1.05rem; }
    .steps-route { display: none; }
    .steps-wrap .story-card {
        box-shadow: inset 4px 0 0 var(--uem-yellow), 0 10px 28px rgba(0, 48, 24, 0.07);
    }
}

@media (prefers-reduced-motion: reduce) {
    .earth-globe,
    .gate-route path,
    .atlas-divider .c2,
    body.page-gate .card {
        animation: none;
    }

    .reveal,
    .steps-wrap.reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .route-line {
        clip-path: none;
        transition: none;
    }

    .atlas-tile,
    .story-card,
    .gt-icon,
    .atlas-tile::before,
    .story-card::before {
        transition: none;
    }

    .atlas-tile:hover,
    .story-card:hover,
    .atlas-tile:hover .gt-icon,
    .story-card:hover .gt-icon {
        transform: none;
    }
}


/* ---------- UI/UX: estados vazios, mapa, alvos de toque ---------- */
.empty-state {
    text-align: center;
    padding: 1.75rem 1rem;
    border: 1px dashed #b8c4bd;
    background: rgba(0, 133, 66, 0.04);
    color: #4a5a52;
}
.empty-state > i { font-size: 1.9rem; color: #008542; display: block; margin-bottom: .35rem; }
.empty-state .btn { margin-top: .75rem; }
body.dark-mode .empty-state { border-color: #2a3a5a; background: rgba(0, 133, 66, 0.1); color: #c9cfdc; }
body.dark-mode .empty-state > i { color: #4cc58b; }

.map-box { height: clamp(260px, 55vh, 440px); }
.map-legend button {
    background: transparent; border: 1px solid transparent; padding: .25rem .5rem;
    min-height: 36px; color: inherit; cursor: pointer; font-size: .85rem;
}
.map-legend button:hover, .map-legend button:focus-visible { border-color: #008542; outline: none; }
.map-legend .sw { display:inline-block; width:12px; height:12px; border:1px solid #1a1a2e; vertical-align:middle; margin-right:5px; }

@media (max-width: 767.98px) {
    .btn, .form-control, .form-select { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .modal-body { max-height: 70vh; overflow-y: auto; }
}
