/**
 * Error pages (404, 500, 503, …) — compact, quiet, no shadows.
 *
 * Standalone on purpose: errors/base_error.html loads only the token files,
 * main.css and this sheet, so an error page still renders when the rest of the
 * site is degraded. It follows the public brand system (ifinsta blue, Plus
 * Jakarta headings, pill buttons, hairlines instead of shadows) through the
 * --ifinsta-mk-* tokens, and colours by severity: blue by default, amber for
 * 403/429, red for 5xx.
 */

.error-page {
    --error-tone: var(--ifinsta-mk-brand);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: var(--ifinsta-mk-bg);
    background-image: none;
    color: var(--ifinsta-mk-text);
    font-family: var(--ifinsta-mk-font-ui);
    font-size: 16px;
    line-height: 1.55;
    letter-spacing: -0.011em;
    -webkit-font-smoothing: antialiased;
}

.error-page a {
    text-decoration: none;
}

.error-page :focus-visible {
    outline: 2px solid var(--ifinsta-mk-accent-text);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Header */
.error-page__header {
    border-bottom: 1px solid var(--ifinsta-mk-line);
    background: var(--ifinsta-mk-bg);
}

.error-page__header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1200px;
    height: 56px;
    margin-inline: auto;
    padding-inline: clamp(16px, 4vw, 40px);
}

.error-page__brand {
    display: inline-flex;
    align-items: center;
    color: var(--ifinsta-mk-text);
    font-size: 21px;
}

.error-page__brand:hover {
    color: var(--ifinsta-mk-text);
}

.error-page__logo {
    width: auto;
    height: 1em;
}

.error-page__nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.error-page__nav-link {
    display: none;
    padding: 7px 12px;
    border-radius: 999px;
    color: var(--ifinsta-mk-text-2);
    font-size: 14px;
    font-weight: 500;
}

.error-page__nav-link:hover {
    background: var(--ifinsta-mk-bg-sunken);
    color: var(--ifinsta-mk-text);
}

@media (min-width: 560px) {
    .error-page__nav-link {
        display: inline-flex;
    }
}

.error-page__nav-cta {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--ifinsta-mk-accent);
    color: var(--ifinsta-mk-on-accent);
    font-size: 14px;
    font-weight: 600;
}

.error-page__nav-cta:hover {
    background: var(--ifinsta-mk-accent-hover);
    color: var(--ifinsta-mk-on-accent);
}

/* The shared theme switcher keeps its hairline here, without the dropdown shadow */
.error-page .ifinsta-theme-switcher__menu {
    border-color: var(--ifinsta-mk-line);
    border-radius: 12px;
    background: var(--ifinsta-mk-surface);
    box-shadow: none;
}

.error-page .ifinsta-theme-switcher__trigger {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--ifinsta-mk-line);
    border-radius: 999px;
    background: transparent;
    color: var(--ifinsta-mk-text-2);
    box-shadow: none;
}

.error-page .ifinsta-theme-switcher__trigger:hover {
    background: var(--ifinsta-mk-bg-sunken);
    color: var(--ifinsta-mk-text);
}

/* Main */
.error-page__main {
    display: grid;
    flex: 1;
    place-items: center;
    padding: clamp(28px, 6vh, 64px) 20px;
}

.error-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: min(100%, 560px);
    text-align: center;
}

/* Status row: [icon] 404 · Not Found */
.error-illustration {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--error-tone) 12%, var(--ifinsta-mk-bg));
    color: var(--error-tone);
}

.error-illustration svg {
    width: 20px;
    height: 20px;
}

.error-hero__code {
    margin: 0;
    font-family: var(--ifinsta-mk-font-display);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--error-tone);
    font-variant-numeric: tabular-nums;
}

.error-hero__label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ifinsta-mk-text-2);
}

.error-hero__label::before {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ifinsta-mk-line-strong);
}

/* Severity: blue (default), amber for access/limits/planned work, red for
   server failures, green for the healthy status page */
.error-page:has(.error-hero__code--403),
.error-page:has(.error-illustration--403) {
    --error-tone: var(--ifinsta-warning, var(--ifinsta-mk-spark));
}

.error-page:has(.error-hero__code--500),
.error-page:has(.error-illustration--500) {
    --error-tone: var(--ifinsta-danger);
}

.error-page:has(.error-hero__code--warn),
.error-page:has(.error-illustration--warn) {
    --error-tone: var(--ifinsta-warning, var(--ifinsta-mk-spark));
}

.error-page:has(.error-hero__code--ok),
.error-page:has(.error-illustration--ok) {
    --error-tone: var(--ifinsta-success);
}


/* Title, message, actions: full-width rows */
.error-hero__title,
.error-hero__message,
.error-actions,
.error-links,
.error-details {
    flex-basis: 100%;
}

.error-hero__title {
    margin: 10px 0 0;
    font-family: var(--ifinsta-mk-font-display);
    font-size: clamp(26px, 4vw, 34px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.035em;
    color: var(--ifinsta-mk-text);
    text-wrap: balance;
}

.error-hero__message {
    max-width: 480px;
    margin: 0 auto;
    font-size: 16px;
    color: var(--ifinsta-mk-text-2);
    text-wrap: pretty;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

.error-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    font-family: var(--ifinsta-mk-font-ui);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.error-btn svg {
    width: 17px;
    height: 17px;
}

.error-btn--primary {
    border-color: var(--ifinsta-mk-accent);
    background: var(--ifinsta-mk-accent);
    color: var(--ifinsta-mk-on-accent);
}

.error-btn--primary:hover {
    border-color: var(--ifinsta-mk-accent-hover);
    background: var(--ifinsta-mk-accent-hover);
    color: var(--ifinsta-mk-on-accent);
}

.error-btn--secondary {
    border-color: var(--ifinsta-mk-line-strong);
    color: var(--ifinsta-mk-text);
}

.error-btn--secondary:hover {
    background: var(--ifinsta-mk-bg-sunken);
    color: var(--ifinsta-mk-text);
}

.error-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
    margin-top: 4px;
    font-size: 14px;
}

.error-links a {
    color: var(--ifinsta-mk-accent-text);
    font-weight: 500;
}

.error-links a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Details: one hairline row */
.error-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 18px;
    border: 1px solid var(--ifinsta-mk-line);
    border-radius: 14px;
    text-align: left;
}

.error-detail {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 10px 14px;
}

.error-detail + .error-detail {
    border-left: 1px solid var(--ifinsta-mk-line);
}

.error-detail__label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ifinsta-mk-text-3);
}

.error-detail__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ifinsta-mk-text);
}

@media (max-width: 520px) {
    .error-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .error-detail + .error-detail {
        border-left: 0;
        border-top: 1px solid var(--ifinsta-mk-line);
    }
}

/* Footer */
.error-page__footer {
    border-top: 1px solid var(--ifinsta-mk-line);
}

.error-page__footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    max-width: 1200px;
    margin-inline: auto;
    padding: 16px clamp(16px, 4vw, 40px);
    font-size: 13px;
    color: var(--ifinsta-mk-text-3);
}

.error-page__footer-inner p {
    margin: 0;
}

.error-page__footer-links {
    display: flex;
    gap: 16px;
}

.error-page__footer-links a {
    color: var(--ifinsta-mk-text-3);
}

.error-page__footer-links a:hover {
    color: var(--ifinsta-mk-text);
}

@media (prefers-reduced-motion: reduce) {
    .error-page * {
        transition-duration: 0.01ms !important;
    }
}
