:root {
    --bg-1: #04111f;
    --bg-2: #0e2b40;
    --surface: rgba(9, 22, 36, 0.82);
    --surface-2: rgba(5, 16, 28, 0.76);
    --line: rgba(118, 163, 193, 0.28);
    --text: #e7f2fb;
    --muted: #9fb9cb;
    --accent: #37d8ad;
    --accent-2: #f0c860;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    background: radial-gradient(1280px 640px at 78% -18%, #1f587f 0%, transparent 60%),
        linear-gradient(150deg, var(--bg-1), var(--bg-2));
    font-family: "Space Grotesk", "Segoe UI", Tahoma, sans-serif;
    scroll-behavior: smooth;
}

a {
    color: inherit;
    text-decoration: none;
}

.bg-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(circle at 50% 18%, black 24%, transparent 82%);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    margin: 0 auto;
    padding: 14px clamp(14px, 2.8vw, 40px);
    border-bottom: 1px solid var(--line);
    background: rgba(3, 10, 18, 0.8);
    backdrop-filter: blur(10px);
}

.brand-link {
    display: inline-flex;
    align-items: center;
}

.brand-kicker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 11px;
    letter-spacing: 0.16em;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
}

.topnav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.topnav a {
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--muted);
    font-weight: 600;
    font-size: 14px;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.topnav a:hover,
.topnav a:focus-visible {
    color: var(--text);
    border-color: var(--line);
    background: rgba(27, 52, 72, 0.45);
}

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-tools label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.topbar-tools select {
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 8px 10px;
    color: var(--text);
    background: rgba(7, 20, 33, 0.94);
    font-weight: 600;
}

.hero {
    max-width: 1320px;
    margin: 0 auto;
    padding: clamp(44px, 8vw, 92px) clamp(14px, 2.8vw, 40px) clamp(26px, 4.8vw, 52px);
}

.hero-content {
    max-width: 920px;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: clamp(22px, 4vw, 40px);
    background: linear-gradient(150deg, rgba(8, 24, 40, 0.84), rgba(3, 13, 22, 0.7));
    box-shadow: 0 26px 56px rgba(0, 8, 14, 0.28);
}

.hero-kicker {
    display: inline-flex;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--accent);
    font-size: 12px;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.hero h1 {
    margin: 14px 0 10px;
    font-size: clamp(34px, 6vw, 62px);
    line-height: 1.03;
    letter-spacing: -0.02em;
}

#projectName {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: clamp(14px, 1.6vw, 17px);
}

.hero p {
    margin: 8px 0;
    max-width: 62ch;
    color: #d4e6f3;
    font-size: clamp(16px, 1.9vw, 22px);
}

.hero-actions {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 15px;
    border-radius: 10px;
    font-weight: 800;
    border: 1px solid transparent;
}

.cta-primary {
    color: #042421;
    background: linear-gradient(120deg, var(--accent), #89f1d6);
    border-color: rgba(255, 255, 255, 0.2);
}

.cta-ghost {
    color: var(--text);
    border-color: var(--line);
    background: rgba(11, 29, 45, 0.65);
}

.page-content {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 clamp(14px, 2.8vw, 40px) 42px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.section-wrap {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    backdrop-filter: blur(9px);
    padding: 16px;
}

.section-head h2 {
    margin: 0;
    font-size: clamp(24px, 3vw, 38px);
}

.section-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.layout {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
}

.viewer-card,
.controls-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-2);
}

.viewer-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 72vh;
}

.viewer-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 16px 16px 10px;
}

.viewer-head h2 {
    margin: 0;
}

.viewer-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.pill {
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 10px;
    color: var(--muted);
}

#viewerCanvas {
    width: 100%;
    flex: 1;
    min-height: 420px;
    background: radial-gradient(circle at 50% 25%, #173a53 0%, #081522 72%);
    display: block;
}

.viewer-foot {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.controls-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
}

.controls-head h2 {
    margin: 0;
}

.controls-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.control {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.control span {
    color: var(--muted);
    font-size: 13px;
}

.control strong {
    font-size: 14px;
    color: var(--accent-2);
}

.control input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
    accent-color: var(--accent);
}

.control select {
    grid-column: 1 / -1;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    color: var(--text);
    background: rgba(6, 18, 30, 0.85);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.metrics article {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px;
    background: rgba(3, 11, 20, 0.45);
}

.metrics h3 {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.metrics p {
    margin: 8px 0 0;
    font-size: 18px;
    font-weight: 700;
}

.actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
}

.actions button {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text);
    background: rgba(9, 26, 40, 0.85);
}

.actions button:last-child {
    background: linear-gradient(120deg, #0e433d, #14665b);
    border-color: rgba(131, 243, 210, 0.35);
}

.services-links {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.services-links a {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 23, 36, 0.66);
    padding: 14px 12px;
    text-align: center;
    font-weight: 700;
    color: #ddedf8;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.services-links a:hover,
.services-links a:focus-visible,
.services-links a.active {
    transform: translateY(-2px);
    border-color: rgba(97, 237, 198, 0.5);
    background: rgba(17, 62, 71, 0.72);
}

.portfolio-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.portfolio-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    background: rgba(6, 19, 31, 0.72);
    min-height: 140px;
}

.portfolio-card h3 {
    margin: 0 0 8px;
    color: var(--accent-2);
    font-size: 21px;
}

.portfolio-card p {
    margin: 0;
    color: #c5dced;
    line-height: 1.45;
}

.footer {
    border-top: 1px solid var(--line);
    background: rgba(3, 11, 20, 0.82);
    padding: 16px clamp(14px, 2.8vw, 40px) 22px;
    text-align: center;
}

.footer p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

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

    .viewer-card {
        min-height: 62vh;
    }

    .services-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .topbar {
        grid-template-columns: 1fr;
        gap: 10px;
        justify-items: start;
    }

    .topnav {
        justify-content: flex-start;
    }

    .hero h1 {
        font-size: clamp(32px, 8vw, 52px);
    }

    .hero p {
        font-size: clamp(15px, 3.2vw, 20px);
    }
}

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

    .services-links,
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .viewer-foot {
        flex-direction: column;
        gap: 6px;
    }
}
