/* ==========================================================================
   OPS Space — Application Portal
   Design tokens
   ========================================================================== */

/*
 * Registering these as typed <color> custom properties (rather than
 * leaving them untyped) fixes a real Chromium bug: an *untyped*
 * custom property used inside a `background`/`color` value that also
 * has a CSS `transition` on it can get permanently stuck at its old
 * computed value after the property changes — even though
 * getComputedStyle() correctly reports the new custom-property value
 * itself. Typing them via @property gives the browser a defined
 * interpolation type, which resolves the stuck-repaint bug and also
 * makes the light/dark transition animate smoothly instead of
 * snapping instantly.
 */
@property --bg { syntax: '<color>'; inherits: true; initial-value: #0B0C10; }
@property --bg-elevated { syntax: '<color>'; inherits: true; initial-value: #101116; }
@property --card { syntax: '<color>'; inherits: true; initial-value: #16181F; }
@property --card-hover { syntax: '<color>'; inherits: true; initial-value: #1C1F28; }
@property --border { syntax: '<color>'; inherits: true; initial-value: rgba(255,255,255,0.08); }
@property --border-strong { syntax: '<color>'; inherits: true; initial-value: rgba(255,255,255,0.16); }
@property --text { syntax: '<color>'; inherits: true; initial-value: #FFFFFF; }
@property --text-secondary { syntax: '<color>'; inherits: true; initial-value: rgba(255,255,255,0.65); }
@property --text-tertiary { syntax: '<color>'; inherits: true; initial-value: rgba(255,255,255,0.4); }

:root {
    /* --brand / --brand-rgb / --brand-light / --brand-dark / --brand-deep
       and --icon-size / --icon-radius are injected inline by index.php
       from config.php (OPS_BRAND_COLOR, APP_ICON_SIZE). The values
       below are fallbacks only, used if that block is ever missing. */
    --brand: #F2BF00;
    --brand-rgb: 242, 191, 0;
    --brand-light: #FFDB6B;
    --brand-dark: #A87F00;
    --brand-deep: #423200;
    --icon-size: 88px;
    --icon-radius: 25px;
    --logo-max-height: 34px;

    --bg: #0B0C10;
    --bg-elevated: #101116;
    --card: #16181F;
    --card-hover: #1C1F28;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --primary: var(--brand-dark);
    --accent: var(--brand);
    --text: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-tertiary: rgba(255, 255, 255, 0.4);
    --success: #34D399;
    --warning: #FBBF24;
    --danger: #F87171;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.5);
    --shadow-card-hover: 0 1px 2px rgba(0,0,0,.4), 0 24px 48px -16px rgba(0,0,0,.65);
    --shadow-glow: 0 0 0 1px rgba(var(--brand-rgb),.35), 0 0 40px -8px rgba(var(--brand-rgb),.45);

    --ease-out: cubic-bezier(.16,1,.3,1);
    --ease-spring: cubic-bezier(.34,1.56,.64,1);

    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

html[data-theme="light"] {
    --bg: #F3F5FA;
    --bg-elevated: #FFFFFF;
    --card: #FFFFFF;
    --card-hover: #FAFBFF;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.14);
    --text: #0B1526;
    --text-secondary: rgba(11, 21, 38, 0.62);
    --text-tertiary: rgba(11, 21, 38, 0.4);
    --shadow-card: 0 1px 2px rgba(15,23,42,.05), 0 12px 28px -14px rgba(15,23,42,.18);
    --shadow-card-hover: 0 1px 2px rgba(15,23,42,.06), 0 24px 44px -16px rgba(15,23,42,.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-display);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background .4s var(--ease-out), color .4s var(--ease-out);
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

.skip-link {
    position: absolute; top: -60px; left: 16px;
    background: var(--primary); color: #fff; padding: 10px 16px;
    border-radius: var(--radius-sm); z-index: 999; transition: top .2s;
}
.skip-link:focus { top: 16px; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ==========================================================================
   Background layers
   ========================================================================== */

.bg-layer {
    position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}

.bg-aurora {
    position: absolute; width: 60vw; height: 60vw; max-width: 900px; max-height: 900px;
    border-radius: 50%;
    filter: blur(110px);
    opacity: .28;
    animation: aurora-drift 26s ease-in-out infinite alternate;
    will-change: transform;
}
.bg-aurora--1 { background: radial-gradient(circle, var(--primary), transparent 70%); top: -20%; left: -10%; }
.bg-aurora--2 { background: radial-gradient(circle, var(--accent), transparent 70%); bottom: -25%; right: -10%; animation-delay: -12s; }

@keyframes aurora-drift {
    0%   { transform: translate(0,0) scale(1); }
    50%  { transform: translate(4%, 6%) scale(1.08); }
    100% { transform: translate(-3%, -2%) scale(0.98); }
}

.bg-grid {
    position: absolute; inset: -10%;
    background-image:
        linear-gradient(to right, rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 30%, transparent 80%);
    animation: grid-drift 60s linear infinite;
}
html[data-theme="light"] .bg-grid {
    background-image:
        linear-gradient(to right, rgba(15,23,42,.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(15,23,42,.05) 1px, transparent 1px);
}
@keyframes grid-drift {
    0% { transform: translate(0,0); }
    100% { transform: translate(56px, 56px); }
}

#network-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55;
}

.bg-glow {
    position: absolute; width: 480px; height: 480px; border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--brand-rgb),.16), transparent 65%);
    left: 0; top: 0; transform: translate(-50%,-50%);
    transition: opacity .3s;
    opacity: 0;
}

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(16px) saturate(140%);
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    border-bottom: 1px solid var(--border);
}
.topbar__inner {
    max-width: 1240px; margin: 0 auto; padding: 16px 32px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark {
    width: var(--logo-max-height); height: var(--logo-max-height);
    display: flex; flex-shrink: 0;
}
.brand__mark svg { width: 100%; height: 100%; }
.brand__mark--sm { width: calc(var(--logo-max-height) * .68); height: calc(var(--logo-max-height) * .68); }

.brand__logo {
    display: block;
    height: var(--logo-max-height);
    width: auto;
    max-width: 220px;
    object-fit: contain;
    flex-shrink: 0;
}
.brand__logo--sm { height: calc(var(--logo-max-height) * .68); max-width: 160px; }

.brand__name { font-weight: 800; letter-spacing: .06em; font-size: 15px; }

.topnav { display: flex; gap: 4px; }
.topnav__link {
    padding: 8px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    color: var(--text-secondary); transition: color .2s, background .2s;
}
.topnav__link:hover { color: var(--text); background: rgba(255,255,255,.04); }
.topnav__link--active { color: var(--text); background: rgba(var(--brand-rgb),.14); }

.topbar__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--card);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); cursor: pointer;
    transition: transform .2s var(--ease-spring), border-color .2s, color .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-theme {
    transform: rotate(0deg);
    transition: transform .45s var(--ease-spring);
}
html[data-theme="light"] .icon-theme {
    transform: rotate(180deg);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
    position: relative; z-index: 1;
    max-width: 720px; margin: 0 auto; padding: 88px 24px 40px;
    text-align: center;
}
.hero__eyebrow {
    font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
    color: var(--accent); margin: 0 0 18px;
    opacity: 0; animation: rise-in .7s var(--ease-out) .05s forwards;
}
.hero__title {
    font-size: clamp(38px, 6vw, 60px); font-weight: 800; letter-spacing: -.03em;
    line-height: 1.05; margin: 0 0 16px;
    background: linear-gradient(180deg, #fff, rgba(255,255,255,.78));
    -webkit-background-clip: text; background-clip: text; color: transparent;
    opacity: 0; animation: rise-in .8s var(--ease-out) .12s forwards;
    transition: transform .12s var(--ease-out);
}
html[data-theme="light"] .hero__title {
    background: linear-gradient(180deg, #0B1526, #1E2A44);
    -webkit-background-clip: text; background-clip: text;
}
.hero__subtitle {
    font-size: 18px; color: var(--text-secondary); margin: 0 0 40px;
    opacity: 0; animation: rise-in .8s var(--ease-out) .2s forwards;
    transition: transform .12s var(--ease-out);
}

@keyframes rise-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-wrap {
    opacity: 0; animation: rise-in .8s var(--ease-out) .3s forwards;
}
.search-bar {
    display: flex; align-items: center; gap: 12px;
    max-width: 560px; margin: 0 auto;
    padding: 14px 18px; border-radius: var(--radius-md);
    background: var(--card); border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: border-color .25s, box-shadow .25s, transform .25s var(--ease-spring);
}
.search-bar:focus-within {
    border-color: rgba(var(--brand-rgb),.55);
    box-shadow: var(--shadow-glow);
    transform: scale(1.015);
}
.search-bar__icon { width: 18px; height: 18px; color: var(--text-tertiary); flex-shrink: 0; }
.search-bar input {
    flex: 1; border: none; outline: none; background: transparent;
    color: var(--text); font-size: 15px; font-family: inherit;
}
.search-bar input::placeholder { color: var(--text-tertiary); }
.search-bar__kbd {
    font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary);
    border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px;
    flex-shrink: 0;
}

.pill-row {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
    margin-top: 22px;
    opacity: 0; animation: rise-in .8s var(--ease-out) .38s forwards;
}
.pill {
    padding: 8px 16px; border-radius: var(--radius-pill);
    border: 1px solid var(--border); background: transparent;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all .22s var(--ease-out);
}
.pill:hover { border-color: var(--border-strong); color: var(--text); background: rgba(255,255,255,.03); }
.pill--active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; border-color: transparent;
}
.pill--active:hover { color: #fff; }

/* ==========================================================================
   Featured
   ========================================================================== */

.featured-section {
    max-width: 1180px; margin: 44px auto 0; padding: 0 24px;
    position: relative; z-index: 1;
}
.featured-card {
    position: relative;
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
    padding: 30px 32px; border-radius: var(--radius-lg);
    background:
        radial-gradient(600px 200px at 15% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
        var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    opacity: 0; transform: translateY(20px);
    animation: rise-in .7s var(--ease-out) .46s forwards;
    transition: border-color .3s, box-shadow .3s, transform .1s linear;
    will-change: transform;
}
.featured-card::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    opacity: 0; transition: opacity .3s;
    pointer-events: none;
}
.featured-card:hover::before { opacity: 1; }
.featured-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover), var(--shadow-glow);
}
.featured-card__badge {
    position: absolute; top: 18px; right: 22px;
    display: flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
    color: #FBBF24; background: rgba(251,191,36,.12);
    border: 1px solid rgba(251,191,36,.25);
    padding: 5px 10px 5px 8px; border-radius: var(--radius-pill);
}
.featured-card__badge svg { width: 12px; height: 12px; }

.featured-card__icon {
    width: calc(var(--icon-size) * 1.25); height: calc(var(--icon-size) * 1.25);
    padding: calc(var(--icon-size) * 1.25 * .22);
    box-sizing: border-box;
    border-radius: calc(var(--icon-radius) * 1.15);
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(155deg, var(--brand-light), var(--brand-dark));
    box-shadow: 0 10px 24px -8px rgba(var(--brand-rgb),.55);
    flex-shrink: 0;
    transition: transform .35s var(--ease-spring);
}
.featured-card:hover .featured-card__icon { transform: rotate(-4deg) scale(1.05); }

.featured-card__body { min-width: 0; }
.featured-card__heading { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.featured-card__heading h2 { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.featured-card__body p {
    margin: 6px 0 0; color: var(--text-secondary); font-size: 14.5px;
    max-width: 60ch; overflow: hidden; text-overflow: ellipsis;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.featured-card__meta { display: flex; align-items: center; gap: 10px; margin-top: 14px; }

.featured-card__cta { flex-shrink: 0; }

/* ==========================================================================
   Shared: tags, badges, status, buttons
   ========================================================================== */

.tag {
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    background: rgba(255,255,255,.05); border: 1px solid var(--border);
    padding: 4px 10px; border-radius: var(--radius-pill);
}
.badge-version {
    font-family: var(--font-mono); font-size: 12px; color: var(--brand-light);
    background: rgba(var(--brand-rgb),.12); border: 1px solid rgba(var(--brand-rgb),.28);
    padding: 3px 8px; border-radius: 6px;
    animation: pulse-soft 3.2s ease-in-out infinite;
}
@keyframes pulse-soft {
    0%, 100% { opacity: 1; } 50% { opacity: .6; }
}

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.status__dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--success);
    box-shadow: 0 0 0 0 rgba(52,211,153,.5);
    animation: blink-dot 2.4s ease-in-out infinite;
}
.status--beta .status__dot { background: var(--warning); box-shadow: 0 0 0 0 rgba(251,191,36,.5); }
.status--maintenance .status__dot { background: var(--warning); box-shadow: 0 0 0 0 rgba(251,191,36,.5); }
.status--offline .status__dot { background: var(--danger); box-shadow: 0 0 0 0 rgba(248,113,113,.5); animation: none; }
.status__dot--live { background: var(--success); }

@keyframes blink-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,.45); }
    50% { box-shadow: 0 0 0 5px rgba(52,211,153,0); }
}

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 20px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; border: none; cursor: pointer;
    transition: transform .2s var(--ease-spring), box-shadow .25s;
}
.btn svg { width: 15px; height: 15px; transition: transform .25s var(--ease-out); }
.btn--primary {
    color: #1A1400;
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    box-shadow: 0 8px 20px -8px rgba(var(--brand-rgb),.55);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -8px rgba(var(--brand-rgb),.65); }
.btn--primary:hover svg { transform: translate(2px, -2px); }
.btn--disabled {
    color: var(--text-tertiary);
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border);
    cursor: not-allowed;
}
.btn--disabled:hover { transform: none; box-shadow: none; }

/* ==========================================================================
   Grid section
   ========================================================================== */

.grid-section {
    max-width: 1180px; margin: 56px auto 0; padding: 0 24px 90px;
    position: relative; z-index: 1;
}
.grid-section__head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 20px;
}
.grid-section__head h2 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.grid-section__count { font-size: 13px; color: var(--text-tertiary); font-family: var(--font-mono); }

.app-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}

.app-card {
    position: relative;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 22px; display: flex; flex-direction: column; gap: 10px;
    box-shadow: var(--shadow-card);
    opacity: 0; transform: translateY(18px);
    animation: card-in .6s var(--ease-out) forwards;
    animation-delay: .5s;
    transition: border-color .3s, box-shadow .3s, background .3s;
    will-change: transform;
    overflow: hidden;
}
@keyframes card-in {
    to { opacity: 1; transform: translateY(0); }
}
.app-card:hover {
    background: var(--card-hover);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover), var(--shadow-glow);
}
.app-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: radial-gradient(180px 120px at var(--mx,50%) var(--my,0%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
    opacity: 0; transition: opacity .35s; pointer-events: none;
}
.app-card:hover::after { opacity: 1; }

.app-card__top { display: flex; align-items: center; }
.app-card__icon {
    width: var(--icon-size); height: var(--icon-size);
    padding: calc(var(--icon-size) * .22);
    box-sizing: border-box;
    border-radius: var(--icon-radius);
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(155deg, var(--brand-light), var(--brand-dark));
    box-shadow: 0 8px 18px -8px rgba(var(--brand-rgb),.5);
    flex-shrink: 0;
    transition: transform .35s var(--ease-spring);
}
.app-card:hover .app-card__icon { transform: rotate(-6deg) scale(1.08); }

/*
 * Shared sizing rule for every icon type — real <img> assets,
 * inline <svg>, or the generated text fallback — all fill their
 * container at 100%. This is the single point that ties icon
 * rendering to --icon-size (from APP_ICON_SIZE in config.php): the
 * container's padding creates the breathing room, and the visual
 * always fills what's left, so nothing can fall out of sync no
 * matter what kind of icon asset an app.json points to.
 */
.icon-visual {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
img.icon-visual,
svg.icon-visual {
    object-fit: contain;
    display: block;
}
.icon-fallback {
    color: #1A1400;
    font-weight: 800;
    font-size: calc(var(--icon-size) * .34);
    line-height: 1;
}
.featured-card__icon .icon-fallback {
    font-size: calc(var(--icon-size) * 1.25 * .34);
}

.app-card__title { font-size: 16.5px; font-weight: 700; margin: 4px 0 0; letter-spacing: -.005em; }
.app-card__desc {
    font-size: 13.5px; color: var(--text-secondary); margin: 0; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    min-height: 2.9em;
}
.app-card__footer {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: auto; padding-top: 12px;
}
.app-card__footer-info {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}
.app-card__version { font-family: var(--font-mono); font-size: 12px; color: var(--text-tertiary); flex-shrink: 0; }

.app-card__open {
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 12.5px; font-weight: 700;
    color: var(--brand-light);
    border: 1px solid rgba(var(--brand-rgb), .45);
    background: rgba(var(--brand-rgb), .08);
    transition: background .2s, border-color .2s, transform .2s var(--ease-spring);
}
.app-card:hover .app-card__open {
    background: rgba(var(--brand-rgb), .16);
    border-color: rgba(var(--brand-rgb), .7);
}
.app-card__open--muted {
    color: var(--text-tertiary);
    border-color: var(--border-strong);
    background: transparent;
}
.app-card--disabled:hover .app-card__open--muted {
    background: transparent;
    border-color: var(--border-strong);
}
.app-card__category-tag { display: none; }

.no-results, .empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-secondary);
}
.empty-state__hint { font-size: 13.5px; color: var(--text-tertiary); }
.empty-state code {
    font-family: var(--font-mono); background: rgba(255,255,255,.06);
    padding: 2px 6px; border-radius: 4px;
}

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

.footer {
    border-top: 1px solid var(--border);
    position: relative; z-index: 1;
}
.footer__inner {
    max-width: 1240px; margin: 0 auto; padding: 26px 32px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.footer__brand { display: flex; align-items: center; gap: 10px; }
.footer__title { font-weight: 800; font-size: 13px; letter-spacing: .05em; }
.footer__subtitle { font-size: 12px; color: var(--text-tertiary); }
.footer__meta { font-size: 12.5px; color: var(--text-tertiary); }
.footer__status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }

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

@media (max-width: 1080px) {
    .app-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .topnav { display: none; }
    .featured-card { grid-template-columns: 1fr; text-align: left; padding: 24px; }
    .featured-card__cta { width: 100%; justify-content: center; }
    .app-grid { grid-template-columns: 1fr; }
    .hero { padding: 64px 20px 28px; }
}

/* ==========================================================================
   Disabled applications
   Layout stays identical to an active card — the only difference is
   the status indicator, which turns red instead of green/amber, in
   the exact same position. Clicking still opens the "Coming Soon"
   modal instead of navigating.
   ========================================================================== */

.status--disabled .status__dot {
    background: #F87171 !important;
    box-shadow: 0 0 0 0 rgba(248,113,113,.5) !important;
    animation: none !important;
}

.app-card--disabled,
.featured-card--disabled {
    cursor: not-allowed;
}

/* ==========================================================================
   "Coming Soon" modal
   Shown when a disabled application card is activated. Custom-built,
   matching the site's card language, golden accents, scale+fade
   entrance, and a blurred/darkened backdrop.
   ========================================================================== */

.modal-overlay {
    position: fixed; inset: 0; z-index: 400;
    align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(4, 4, 6, 0.6);
    backdrop-filter: blur(6px) saturate(120%);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease-out);
}
/* The [hidden] attribute is the source of truth for whether the
   modal exists on screen at all — it works even if this stylesheet
   fails to load, since browsers apply display:none for [hidden]
   natively. We only ever grant it `display:flex` when the attribute
   has been removed by JS, so there's no way for the modal to appear
   without an explicit openModal() call. */
.modal-overlay[hidden] { display: none; }
.modal-overlay:not([hidden]) { display: flex; }
.modal-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: relative;
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid rgba(var(--brand-rgb), .28);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card-hover), 0 0 0 1px rgba(var(--brand-rgb),.14), 0 0 60px -12px rgba(var(--brand-rgb),.4);
    padding: 40px 32px 32px;
    text-align: center;
    transform: scale(.92) translateY(8px);
    opacity: 0;
    transition: transform .35s var(--ease-spring), opacity .3s var(--ease-out);
}
.modal-overlay--visible .modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal__close {
    position: absolute; top: 14px; right: 14px;
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); background: transparent;
    color: var(--text-tertiary); cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.modal__close svg { width: 14px; height: 14px; }
.modal__close:hover { background: rgba(255,255,255,.06); color: var(--text); border-color: var(--border-strong); }

.modal__icon {
    width: 56px; height: 56px; margin: 0 auto 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--brand-rgb), .12);
    border: 1px solid rgba(var(--brand-rgb), .3);
    color: var(--brand-light);
}
.modal__icon svg { width: 26px; height: 26px; }

.modal__title {
    font-size: 21px; font-weight: 800; letter-spacing: -.01em;
    margin: 0 0 10px;
}
.modal__message {
    font-size: 14.5px; line-height: 1.6; color: var(--text-secondary);
    margin: 0 0 26px;
}
.modal__actions { display: flex; justify-content: center; }
.modal__ok { min-width: 120px; justify-content: center; }

@media (max-width: 480px) {
    .modal { padding: 32px 22px 26px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}
