:root {
    --ink: #101c29;
    --muted: #425365;
    --blue: #155169;
    --line: #cddbe0;
    --pale: #eef5f5;
    --mint: #b9ecdc;
}

body { font-family: system-ui, sans-serif; }
.wrap { width: min(1320px, 92%); }
.skip-link { position: absolute; top: .5rem; left: .5rem; z-index: 2; background: white; padding: .75rem; transform: translateY(-160%); }
.skip-link:focus { transform: none; }
.site-header { background: #fff; }
.top { min-height: 78px; gap: .8rem 2rem; }
.brand img { display: block; width: 106px; height: auto; }
nav a:hover { text-decoration: underline; }
.nav-contact { border: 1px solid var(--line); border-radius: .35rem; padding: .35rem .8rem; }
.hero {
    color: #fff;
    background: radial-gradient(ellipse at 85% 10%, #24576a 0, transparent 65%), #101c29;
    padding: clamp(3rem, 6vw, 6rem) 0;
}
/* WordPress can wrap shortcode output inside a Group or a paragraph.
   Apply the columns to the element that actually holds the two parts. */
.hero .hero-grid { display: block; }
.hero :is(.hero-grid, .hero-grid div):has(> :is(.wp-block-group, div):has(h1):not(:has(#demo))):has(> :is(#demo, :has(#demo)):not(:has(h1))) {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
    align-items: center;
    gap: clamp(1.7rem, 4vw, 4rem);
}
.hero :is(.hero-grid, .hero-grid div) > :is(#demo, :has(#demo)):not(:has(h1)) {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin-inline: 0;
}
.hero #demo { width: 100%; max-width: none; margin-inline: 0; }
.hero .hero-grid > :is(#demo, :has(#demo)):not(:has(h1)) { margin-block-start: 1.5rem; }
@media (min-width: 851px) {
    .hero .hero-grid:has(> :has(h1):not(:has(#demo))) > :is(#demo, :has(#demo)):not(:has(h1)) {
        margin-block: 0;
    }
}
.hero h1 { font-size: clamp(2.6rem, 5vw, 5rem); line-height: 1.04; }
.hero .product { color: var(--mint); }
.hero p:not(.product) { color: #d8e7eb; }
.hero figure { background: #192d3b; outline: 1px solid #ffffff30; }
.hero iframe { height: clamp(23rem, 38vw, 36rem); }
.hero figcaption a { color: var(--mint); }
.hero .wp-block-button__link { background: var(--mint); color: #142833; font-weight: 750; }
.hero .is-style-outline .wp-block-button__link { background: transparent; color: #fff; }
#kayttotapaukset { background: #f4f8f8; }
.card { background: white; border-top-color: #337688; padding: clamp(1.3rem, 2.6vw, 2.4rem); }
.card h3 { font-size: clamp(1.3rem, 2vw, 1.65rem); }
.section-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.section-heading p { margin-bottom: 0; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.project-card {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: .65rem;
    color: var(--ink);
    text-decoration: none;
    background: #fff;
}
.project-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.project-card > div { padding: 1rem 1.2rem; }
.project-card h3 { margin-bottom: .3rem; }
.project-card span { color: var(--blue); }
.project-card:hover span { text-decoration: underline; }
.resource-section { background: var(--pale); }
.resource-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .68fr); gap: 2rem 4rem; }
.resource-links a { display: block; padding: .7rem 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.site-footer { background: #101c29; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .7rem 1.5rem; }
.site-footer nav a { color: #e5f1f2; }
.entry { max-width: min(920px, 92%); overflow-wrap: anywhere; }
.entry img, .entry video { max-width: 100%; height: auto; }
.entry iframe { max-width: 100%; }
.entry h2, .entry h3 { margin-top: 1.25em; }
.entry a { text-underline-offset: .18em; }
.news-heading + .entry { padding-top: 0; }
@media (max-width: 850px) {
    .hero :is(.hero-grid, .hero-grid div):has(> :is(.wp-block-group, div):has(h1):not(:has(#demo))):has(> :is(#demo, :has(#demo)):not(:has(h1))),
    .resource-grid { grid-template-columns: minmax(0, 1fr); }
    .hero iframe { height: 26rem; }
}
@media (max-width: 620px) {
    .top { padding-block: .8rem; }
    .site-header nav { font-size: .95rem; }
    .project-grid { grid-template-columns: 1fr; }
    .hero iframe { height: 23rem; }
}

.hero .wp-block-buttons { margin-block-end: clamp(1.5rem, 3vw, 2rem); }

/* Sova3D: kuvallinen etusivu */
body.home .hero {
    position: relative;
    isolation: isolate;
    background: #102433;
}
body.home .hero::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 auto;
    height: clamp(24rem, 42vw, 37rem);
    background:
        linear-gradient(0deg, #102433 0%, transparent 45%),
        linear-gradient(90deg, #102433 0%, #102433 25%, rgba(16, 36, 51, .91) 45%, rgba(16, 36, 51, .35) 72%, rgba(16, 36, 51, .06) 100%),
        url("etusivu-kaupunkimalli.webp") right 42% / min(80rem, 96vw) auto no-repeat;
    pointer-events: none;
}
body.home .hero h1 {
    max-inline-size: 17ch;
    font-size: clamp(2.3rem, 5.25vw, 4.8rem);
    text-wrap: balance;
}
body.home .hero p:not(.product) { max-inline-size: 34rem; }
body.home .hero #demo { scroll-margin-top: 2rem; }
body.home #kayttotapaukset {
    background: linear-gradient(155deg, #ecf5f4, #f8fafb 70%);
}
body.home #kayttotapaukset .card {
    border-top: 4px solid #277784;
    box-shadow: 0 .55rem 1.6rem #203a5010;
}
body.home #kayttotapaukset .card h3 {
    min-block-size: 2.3em;
    text-wrap: balance;
}
body.home #kayttotapaukset .card a {
    display: inline-block;
    font-weight: 700;
}
body.home .project-grid .project-card {
    box-shadow: 0 .55rem 1.5rem #203a5012;
}
body.home .project-grid .project-card:hover {
    border-color: #337688;
    box-shadow: 0 .75rem 1.75rem #203a5024;
}
@media (max-width: 700px) {
    body.home .hero::before {
        background:
            linear-gradient(0deg, #102433 0%, rgba(16, 36, 51, .88) 65%, rgba(16, 36, 51, .68) 100%),
            url("etusivu-kaupunkimalli.webp") center top / auto 100% no-repeat;
    }
    body.home #kayttotapaukset .card h3 { min-block-size: 0; }
}

/* Sova3D: kuntamallikaruselli */
.sova-city-controls {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .6rem;
    margin-block: 0 .7rem;
}
.sova-city-controls[hidden] { display: none; }
.sova-city-controls button {
    padding: .45rem .75rem;
    border: 1px solid #337688;
    border-radius: .45rem;
    background: #fff;
    color: #165167;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}
.sova-city-controls button:disabled { opacity: .52; cursor: default; }
.sova-city-track {
    --sova-city-gap: 1rem;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 2 * var(--sova-city-gap)) / 3);
    gap: var(--sova-city-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    list-style: none;
    margin: 0;
    padding: .25rem .1rem .8rem;
}
.sova-city-track > li { scroll-snap-align: start; min-width: 0; }
.sova-city-track a:focus-visible { outline: 2px solid #165167; outline-offset: -3px; }
.sova-city-track .sova-city-no-photo {
    display: grid;
    place-content: center;
    aspect-ratio: 16 / 9;
    padding: 0;
    color: #edf8f8;
    font-size: clamp(1.3rem, 3vw, 2.3rem);
    font-weight: 750;
    background: linear-gradient(145deg, #102433, #2b6871);
}
@media (max-width: 900px) {
    .sova-city-track { grid-auto-columns: calc((100% - var(--sova-city-gap)) / 2); }
}
@media (max-width: 560px) {
    .sova-city-track { grid-auto-columns: 86%; }
}
