/* General */
* {
    box-sizing: border-box;
}

:root {
    color-scheme: dark;

    --background: #050816;
    --panel: #111827;
    --panel-secondary: #0b1020;
    --panel-hover: #152033;

    --border: #27364a;
    --border-strong: #3a526e;

    --text-main: #f2f2f2;
    --text-secondary: #a0aec0;
    --text-muted: #9ea7b3;

    --blue: #2f81f7;
    --blue-hover: #1f6feb;
    --green: #7ee787;
    --red: #ff7b72;

    --gnss-accent: #66c7ff;
    --gnss-soft: rgba(102, 199, 255, 0.12);

    --space-weather-accent: #ffb45f;
    --space-weather-soft: rgba(255, 180, 95, 0.12);

    --satellite-imagery-accent: #7ee787;
    --satellite-imagery-soft: rgba(126, 231, 135, 0.12);
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    background:
        radial-gradient(
            circle at 12% 8%,
            rgba(47, 129, 247, 0.12),
            transparent 32%
        ),
        radial-gradient(
            circle at 88% 12%,
            rgba(255, 180, 95, 0.08),
            transparent 30%
        ),
        var(--background);
    color: var(--text-main);
    line-height: 1.6;
}

/* Page Layout */
.page-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 60px 24px;
}

/* Headers */
.page-header {
    margin-bottom: 48px;
    text-align: center;
}

.page-eyebrow,
.section-eyebrow,
.service-eyebrow {
    margin: 0 0 8px 0;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-header h1 {
    margin: 0 0 16px 0;
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
    color: var(--text-main);
}

.page-header > p:last-child {
    max-width: 760px;
    margin: 0 auto;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

/* Service section */
.service-section {
    margin-bottom: 32px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 0 0 8px 0;
    font-size: 1.8rem;
}

.section-heading > p:last-child {
    margin: 0;
    color: var(--text-secondary);
}

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

.service-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    min-height: 300px;
    padding: 28px;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.service-card::after {
    position: absolute;
    right: -70px;
    bottom: -90px;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.service-card-gnss::after {
    background: radial-gradient(
        circle,
        var(--gnss-soft),
        transparent 70%
    );
}

.service-card-space-weather::after {
    background: radial-gradient(
        circle,
        var(--space-weather-soft),
        transparent 70%
    );
}

.service-card-satellite-imagery::after {
    background: radial-gradient(
        circle,
        var(--satellite-imagery-soft),
        transparent 70%
    );
}

.service-card:hover {
    transform: translateY(-3px);
    background: var(--panel-hover);
    border-color: var(--border-strong);
}

.service-card-gnss:hover {
    border-color: rgba(102, 199, 255, 0.65);
}

.service-card-space-weather:hover {
    border-color: rgba(255, 180, 95, 0.65);
}

.service-card-satellite-imagery:hover {
    border-color: rgba(126, 231, 135, 0.65);
}

.service-card:focus-visible {
    outline: 3px solid white;
    outline-offset: 4px;
}

.service-icon {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.service-card-gnss .service-icon {
    color: var(--gnss-accent);
    background: var(--gnss-soft);
}

.service-card-space-weather .service-icon {
    color: var(--space-weather-accent);
    background: var(--space-weather-soft);
}

.service-card-satellite-imagery .service-icon {
    color: var(--satellite-imagery-accent);
    background: var(--satellite-imagery-soft);
}

.service-icon svg {
    width: 42px;
    height: 42px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.service-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.service-content h3 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.service-content > p:not(.service-eyebrow) {
    margin: 16px 0 24px 0;
    color: var(--text-secondary);
}

.service-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    font-weight: 700;
}

.service-link span {
    font-size: 1.3rem;
    transition: transform 0.2s ease;
}

.service-card:hover .service-link span {
    transform: translateX(4px);
}

.service-card-gnss .service-link {
    color: var(--gnss-accent);
}

.service-card-space-weather .service-link {
    color: var(--space-weather-accent);
}

.service-card-satellite-imagery .service-link {
    color: var(--satellite-imagery-accent);
}

/* Cards */
.card {
    margin-bottom: 32px;
    padding: 32px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.card h2 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.card p {
    margin: 0 0 16px 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.card-header > div {
    flex: 1;
}

/* Status Section */
.status-area {
    margin-top: 24px;
    padding: 20px;
    background: var(--panel-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.status-area p {
    margin: 8px 0;
    font-size: 0.95rem;
}

.status-area p:first-child {
    margin-top: 0;
}

.status-area p:last-child {
    margin-bottom: 0;
}

/* Measurement Section */
.measurement-area {
    margin-top: 24px;
    padding: 20px;
    background: var(--panel-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.measurement-value {
    margin: 0 0 24px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.measurement-label {
    display: block;
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.measurement-value strong {
    display: block;
    margin: 0;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--green);
}

.measurement-info {
    margin-top: 16px;
}

.measurement-info p {
    margin: 8px 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.measurement-info p:first-child {
    margin-top: 0;
}

.measurement-info p:last-child {
    margin-bottom: 0;
}

/* Buttons */
button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: var(--blue);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

button:hover {
    background: var(--blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(47, 129, 247, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(47, 129, 247, 0.2);
}

button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

button:disabled {
    background: #444c56;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Status Classes */
.status-ok {
    color: var(--green) !important;
    font-weight: 500;
}

.status-error {
    color: var(--red) !important;
    font-weight: 500;
}

/* Architecture Section */
.architecture-introduction {
    max-width: 800px;
}

.architecture {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch;
    justify-content: center;
    margin-top: 24px;
}

.architecture-item {
    display: flex;
    flex: 1 1 170px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 150px;
    max-width: 220px;
    min-height: 120px;
    padding: 16px 12px;
    background: var(--panel-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
}

.architecture-item-wide {
    flex-basis: 240px;
    max-width: 280px;
}

.architecture-item strong {
    color: var(--blue);
    font-size: 0.95rem;
}

.architecture-item span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.architecture-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: var(--blue);
    font-size: 1.5rem;
    font-weight: bold;
}

.information-card p:last-child {
    max-width: 850px;
    margin-bottom: 0;
}

/* Footer */
.page-footer {
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.page-footer p {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1040px) {
    .service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .service-card-satellite-imagery {
        grid-column: 1 / -1;
    }
}

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

    .service-card-satellite-imagery {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .page-container {
        padding: 32px 16px;
    }

    .page-header h1 {
        font-size: 2.4rem;
    }

    .card {
        padding: 24px 16px;
    }

    .card-header {
        flex-direction: column;
        gap: 16px;
    }

    button {
        width: 100%;
        padding: 14px 16px;
    }

    .measurement-value strong {
        font-size: 2rem;
    }

    .architecture {
        flex-direction: column;
        align-items: stretch;
    }

    .architecture-item,
    .architecture-item-wide {
        width: 100%;
        max-width: none;
    }

    .architecture-arrow {
        min-height: auto;
        margin: -8px 0;
        transform: rotate(90deg);
    }
}

@media (max-width: 520px) {
    .page-container {
        padding: 20px 12px;
    }

    .page-header {
        margin-bottom: 32px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .page-header > p:last-child {
        font-size: 0.95rem;
    }

    .service-card {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 22px 18px;
    }

    .service-icon {
        width: 62px;
        height: 62px;
    }

    .service-content h3 {
        font-size: 1.65rem;
    }

    .service-link {
        margin-top: 8px;
    }

    .card {
        padding: 18px 14px;
        margin-bottom: 18px;
    }

    .card h2 {
        font-size: 1.2rem;
    }

    .measurement-value strong {
        font-size: 1.75rem;
    }

    button {
        font-size: 13px;
        padding: 12px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .service-card,
    .service-link span,
    button {
        transition: none;
    }
}


/* Mobile and Safari hardening */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100svh;
}

img,
svg {
    max-width: 100%;
}

.page-container,
.service-grid,
.service-card,
.service-content,
.card,
.card-header,
.status-area,
.measurement-area,
.architecture,
.architecture-item {
    min-width: 0;
}

.page-header h1,
.section-heading h2,
.service-content h3,
.card h2,
.page-header p,
.section-heading p,
.service-content p,
.card p,
.architecture-item span {
    overflow-wrap: anywhere;
    word-break: normal;
}

button,
.service-card {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

@supports (padding: max(0px)) {
    .page-container {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
        padding-bottom: max(60px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 600px) {
    .page-container {
        width: 100%;
        padding-top: 24px;
        padding-right: 14px;
        padding-bottom: 40px;
        padding-left: 14px;
    }

    .page-header {
        margin-bottom: 28px;
        text-align: left;
    }

    .page-header h1 {
        margin-bottom: 12px;
        font-size: clamp(2rem, 11vw, 2.7rem);
        line-height: 1.02;
    }

    .page-header > p:last-child {
        margin: 0;
        font-size: 0.98rem;
        line-height: 1.55;
    }

    .service-section {
        margin-bottom: 20px;
    }

    .section-heading {
        margin-bottom: 14px;
    }

    .section-heading h2 {
        font-size: 1.5rem;
    }

    .service-grid {
        display: block;
    }

    .service-card {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 0;
        margin-bottom: 14px;
        padding: 20px 16px;
        border-radius: 14px;
    }

    .service-card:last-child {
        margin-bottom: 0;
    }

    .service-icon {
        flex: 0 0 auto;
        width: 56px;
        height: 56px;
        margin-bottom: 4px;
    }

    .service-icon svg {
        width: 34px;
        height: 34px;
    }

    .service-content {
        width: 100%;
    }

    .service-content h3 {
        font-size: 1.55rem;
    }

    .service-content > p:not(.service-eyebrow) {
        margin: 12px 0 18px;
        font-size: 0.94rem;
        line-height: 1.55;
    }

    .service-link {
        width: 100%;
        justify-content: space-between;
        margin-top: 4px;
        padding-top: 12px;
        border-top: 1px solid var(--border);
    }

    .card {
        width: 100%;
        margin-bottom: 16px;
        padding: 18px 14px;
        border-radius: 14px;
    }

    .card-header {
        display: block;
        margin-bottom: 16px;
    }

    .card-header > div {
        width: 100%;
    }

    .card-header button {
        width: 100%;
        min-height: 46px;
        margin-top: 14px;
        padding: 12px 14px;
        font-size: 16px;
    }

    .status-area,
    .measurement-area {
        width: 100%;
        margin-top: 14px;
        padding: 15px 13px;
    }

    .status-area p,
    .measurement-info p {
        font-size: 0.9rem;
    }

    .measurement-value {
        margin-bottom: 16px;
    }

    .measurement-value strong {
        font-size: 1.9rem;
    }

    .architecture {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        width: 100%;
    }

    .architecture-item,
    .architecture-item-wide {
        width: 100%;
        max-width: none;
        min-height: 0;
        padding: 14px 12px;
    }

    .architecture-arrow {
        min-height: 24px;
        margin: -4px 0;
        transform: rotate(90deg);
    }

    .page-footer {
        margin-top: 36px;
        padding-top: 22px;
        font-size: 0.82rem;
    }
}

@media (max-width: 380px) {
    .page-container {
        padding-right: 10px;
        padding-left: 10px;
    }

    .page-header h1 {
        font-size: 1.85rem;
    }

    .service-card,
    .card {
        padding-right: 12px;
        padding-left: 12px;
    }

    .service-content h3 {
        font-size: 1.42rem;
    }
}
