/* ============================================================
   MK13 Network Services
   Shared Site Stylesheet
   /var/www/html/css/site.css
   ============================================================ */

:root {
    color-scheme: dark;

    --background: #0d1117;
    --panel: #161b22;
    --panel-hover: #21262d;
    --border: #30363d;

    --text: #e6edf3;
    --muted: #8b949e;
    --footer: #6e7681;

    --green: #7ee787;
    --green-dark: #238636;
    --green-bg: #12261a;

    --red: #ff7b72;
    --red-dark: #da3633;
    --red-bg: #2d1117;
}


/* ============================================================
   Base
   ============================================================ */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    min-height: 100vh;

    padding: 40px 20px;

    background-color: var(--background);

    /* Subtle infrastructure grid */
    background-image:
        linear-gradient(
            rgba(48, 54, 61, 0.12) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(48, 54, 61, 0.12) 1px,
            transparent 1px
        ),
        radial-gradient(
            circle at 50% 38%,
            rgba(35, 134, 54, 0.07),
            transparent 42%
        );

    background-size:
        32px 32px,
        32px 32px,
        100% 100%;

    color: var(--text);

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

.container {
    width: 100%;
    max-width: 820px;

    margin: auto;
}


/* ============================================================
   Page Heading
   ============================================================ */

h1 {
    margin-top: 0;
    margin-bottom: 30px;

    color: var(--text);

    font-size: 32px;
    font-weight: 700;

    letter-spacing: -0.025em;
}

.subtitle {
    margin-bottom: 30px;

    color: var(--muted);

    font-size: 15px;
}


/* ============================================================
   Operational Status Banner
   ============================================================ */

.status {
    margin-bottom: 25px;

    padding: 15px 18px;

    background: var(--green-bg);

    border: 1px solid var(--green-dark);
    border-radius: 8px;

    color: var(--green);

    font-weight: 600;
}

.status-dot {
    margin-right: 8px;

    color: var(--green);

    text-shadow:
        0 0 9px rgba(126, 231, 135, 0.65);
}


/* ============================================================
   Error Page Code
   ============================================================ */

.error-code {
    margin: 12px 0 30px;

    text-align: center;

    font-size: clamp(120px, 26vw, 225px);
    font-weight: 800;

    line-height: 0.82;
    letter-spacing: -0.07em;

    color: transparent;

    -webkit-text-stroke:
        1px rgba(126, 231, 135, 0.22);

    text-shadow:
        0 0 35px rgba(35, 134, 54, 0.08);

    user-select: none;
}


/* ============================================================
   Error Message Banner
   ============================================================ */

.error-message {
    margin-bottom: 20px;

    padding: 16px 20px;

    background: var(--red-bg);

    border: 1px solid var(--red-dark);
    border-radius: 8px;

    color: var(--red);

    font-size: 16px;
    font-weight: 600;

    line-height: 1.55;
}

.error-dot {
    margin-right: 8px;

    color: var(--red);

    text-shadow:
        0 0 9px rgba(255, 123, 114, 0.6);
}


/* ============================================================
   Diagnostics Card
   ============================================================ */

.card {
    position: relative;

    isolation: isolate;

    overflow: hidden;

    background: var(--panel);

    border: 1px solid var(--border);
    border-radius: 8px;

    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.15);
}


/*
   MK ASCII logo watermark.

   Logo:
   /var/www/html/images/mk-logo.png
*/

.card::before {
    content: "";

    position: absolute;
    inset: 0;

    background-image:
        url("/mkdiag/images/mk-logo.png");

    background-repeat: no-repeat;
    background-position: center;
    background-size: 62% auto;

    opacity: 0.09;

    pointer-events: none;

    z-index: -2;
}


/*
   Very light overlay above the logo watermark but below data.
   This preserves text readability.
*/

.card::after {
    content: "";

    position: absolute;
    inset: 0;

    background:
        rgba(13, 17, 23, 0.08);

    pointer-events: none;

    z-index: -1;
}


/* ============================================================
   Diagnostics Rows
   ============================================================ */

.row {
    position: relative;

    display: grid;

    grid-template-columns: 190px 1fr;

    padding: 14px 18px;

    border-bottom: 1px solid var(--border);

    z-index: 1;
}

.row:last-child {
    border-bottom: none;
}

.label {
    color: var(--muted);

    font-weight: 600;
}

.value {
    color: var(--text);

    word-break: break-word;
}


/* ============================================================
   Links
   ============================================================ */

a {
    color: var(--green);
}

a:hover {
    color: #a7f3ad;
}


/* ============================================================
   Buttons
   ============================================================ */

.actions {
    margin-top: 25px;

    text-align: center;
}

.button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    min-width: 160px;

    padding: 11px 20px;

    background: var(--panel-hover);

    border: 1px solid var(--muted);
    border-radius: 6px;

    color: var(--text);

    font-weight: 600;

    text-decoration: none;

    transition:
        background 150ms ease,
        border-color 150ms ease,
        transform 150ms ease,
        box-shadow 150ms ease;
}

.button:hover {
    background: var(--border);

    border-color: var(--green);

    color: var(--text);

    transform: translateY(-1px);

    box-shadow:
        0 0 18px rgba(126, 231, 135, 0.08);
}

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


/* ============================================================
   Footer
   ============================================================ */

footer {
    margin-top: 26px;

    color: var(--footer);

    font-size: 13px;

    text-align: center;
}

footer a,
footer a:visited,
footer a:hover,
footer a:focus,
footer a:active {
    color: inherit;
    text-decoration: none;
}

footer a:hover,
footer a:focus-visible {
    color: var(--green);
}

footer span {
    color: var(--muted);
}


/* ============================================================
   Utility Classes
   ============================================================ */

.text-green {
    color: var(--green);
}

.text-red {
    color: var(--red);
}

.text-muted {
    color: var(--muted);
}

.text-center {
    text-align: center;
}


/* ============================================================
   Mobile / Responsive
   ============================================================ */

@media (max-width: 600px) {

    body {
        padding: 28px 16px;
    }

    h1 {
        font-size: 27px;
    }

    .row {
        grid-template-columns: 1fr;

        gap: 5px;
    }

    .error-code {
        margin-bottom: 26px;

        font-size: clamp(105px, 35vw, 170px);
    }

    .error-message {
        padding: 14px 16px;
    }

    .card::before {
        background-size: 90% auto;

        opacity: 0.045;
    }
}


/* ============================================================
   Reduced Motion / Accessibility
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

    .button {
        transition: none;
    }
}

/* Copyable IP address */
.copy-ip {
    cursor: pointer;
    transition: color 150ms ease, text-shadow 150ms ease;
}

.copy-ip:hover,
.copy-ip:focus-visible {
    color: var(--green);
    text-shadow: 0 0 8px rgba(126, 231, 135, 0.20);
}

.copy-ip:focus-visible {
    outline: none;
}

.copy-ip.copied {
    color: var(--green);
}

/* ============================================================
   Landing Page Welcome
   ============================================================ */

.welcome-title {
    margin: 12px 0 36px;

    text-align: center;

    font-size: clamp(72px, 15vw, 150px);
    font-weight: 800;

    line-height: 0.9;
    letter-spacing: -0.055em;

    color: transparent;

    -webkit-text-stroke:
        1px rgba(126, 231, 135, 0.22);

    text-shadow:
        0 0 35px rgba(35, 134, 54, 0.08);

    user-select: none;
}

@media (max-width: 600px) {
    .welcome-title {
        font-size: clamp(58px, 18vw, 100px);
        margin-bottom: 28px;
    }
}

/* ============================================================
   ASCII Background - Enhanced Heading Visibility
   ============================================================ */

.welcome-title {
    -webkit-text-stroke: 2px rgba(126, 231, 135, 0.58);
    text-shadow:
        0 0 8px rgba(126, 231, 135, 0.20),
        0 0 24px rgba(35, 134, 54, 0.16),
        0 0 50px rgba(0, 0, 0, 0.85);
}

.error-code {
    -webkit-text-stroke: 2px rgba(126, 231, 135, 0.58);
    text-shadow:
        0 0 8px rgba(126, 231, 135, 0.20),
        0 0 24px rgba(35, 134, 54, 0.16),
        0 0 50px rgba(0, 0, 0, 0.85);
}


/* Error Code - Match Error Banner */
.error-code {
    -webkit-text-stroke: 2px rgba(255, 123, 114, 0.60);
    text-shadow: 0 0 8px rgba(255, 123, 114, 0.20), 0 0 24px rgba(218, 54, 51, 0.17), 0 0 50px rgba(0, 0, 0, 0.85);
}

/* Hide error-page Return Home control */
.error-message ~ .card + .actions { display: none; }

/* ============================================================
   MKDiag integration with shared MK13 navigation
   ============================================================ */

.mk13-topbar {
    position: relative;
    z-index: 100;

    margin-top: -40px;
    margin-bottom: 34px;

    isolation: isolate;
}

#ascii-landing {
    z-index: 0;
}

.container {
    position: relative;
    z-index: 2;
}

@media (max-width: 600px) {

    .mk13-topbar {
        margin-top: -28px;
        margin-bottom: 30px;
    }
}
