:root, [data-theme="light"] {
    --gold: #B8942E;
    --gold-deep: #8A6C1C;
    --gold-soft: rgba(184, 148, 46, 0.16);
    --ink: #12141A;
    --ink-soft: #3A404C;
    --muted: #6B7380;
    --line: rgba(18, 20, 26, 0.1);
    --surface: rgba(255, 255, 255, 0.72);
    --surface-strong: #FFFFFF;
    --base: #E6E9EE;
    --mesh-a: rgba(184, 148, 46, 0.22);
    --mesh-b: rgba(45, 90, 120, 0.12);
    --ok: #1A8F5C;
    --ok-soft: rgba(26, 143, 92, 0.12);
    --warn: #B45309;
    --warn-soft: rgba(180, 83, 9, 0.12);
    --danger: #B42318;
    --danger-soft: rgba(180, 35, 24, 0.12);
    --info: #1D4E89;
    --info-soft: rgba(29, 78, 137, 0.12);
    --radius: 18px;
    --radius-sm: 10px;
    --font: "Figtree", sans-serif;
    --display: "Syne", sans-serif;
    --toggle: rgba(255, 255, 255, 0.85);
    --press: rgba(18, 20, 26, 0.04);
    --halo: rgba(184, 148, 46, 0.35);
}

[data-theme="dark"] {
    --gold: #D4AF37;
    --gold-deep: #B8942E;
    --gold-soft: rgba(212, 175, 55, 0.14);
    --ink: #F2F4F7;
    --ink-soft: #C5CAD3;
    --muted: #8E96A3;
    --line: rgba(242, 244, 247, 0.1);
    --surface: rgba(22, 25, 32, 0.78);
    --surface-strong: #161920;
    --base: #0E1014;
    --mesh-a: rgba(212, 175, 55, 0.14);
    --mesh-b: rgba(70, 130, 160, 0.1);
    --ok: #34D399;
    --ok-soft: rgba(52, 211, 153, 0.14);
    --warn: #FBBF24;
    --warn-soft: rgba(251, 191, 36, 0.14);
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --info: #7DB4E8;
    --info-soft: rgba(125, 180, 232, 0.14);
    --toggle: rgba(22, 25, 32, 0.9);
    --press: rgba(255, 255, 255, 0.04);
    --halo: rgba(212, 175, 55, 0.28);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--base);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 50% at 50% -5%, var(--mesh-a), transparent 60%),
        radial-gradient(ellipse 55% 40% at 100% 80%, var(--mesh-b), transparent 55%),
        radial-gradient(ellipse 40% 30% at 0% 60%, var(--gold-soft), transparent 50%),
        var(--base);
    animation: mesh-drift 18s ease-in-out infinite alternate;
}

.atmosphere::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(18, 20, 26, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18, 20, 26, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 20%, transparent 75%);
}

[data-theme="dark"] .atmosphere::after {
    background-image:
        linear-gradient(rgba(242, 244, 247, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(242, 244, 247, 0.04) 1px, transparent 1px);
}

@keyframes mesh-drift {
    from { filter: hue-rotate(0deg) saturate(1); }
    to { filter: hue-rotate(8deg) saturate(1.08); }
}

@media (prefers-reduced-motion: reduce) {
    .atmosphere { animation: none; }
    .reveal, .action, .tool, .cert-row { animation: none !important; transition: none !important; }
}

.shell {
    position: relative;
    z-index: 1;
    width: min(100%, 28rem);
    margin: 0 auto;
    padding: max(1rem, env(safe-area-inset-top)) 1.15rem max(2rem, env(safe-area-inset-bottom));
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--toggle);
    color: var(--muted);
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover { color: var(--ink); border-color: var(--gold); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; display: block; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* —— Hero: brand first —— */
.hero {
    text-align: center;
    padding: 0.75rem 0 1.75rem;
}

.mark {
    width: 6.25rem;
    height: 6.25rem;
    margin: 0 auto 1.15rem;
    border-radius: 28%;
    overflow: hidden;
    background: var(--surface-strong);
    box-shadow: 0 0 0 1px var(--line), 0 18px 40px var(--halo);
    animation: mark-in 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@keyframes mark-in {
    from { opacity: 0; transform: translateY(12px) scale(0.92); }
    to { opacity: 1; transform: none; }
}

.brand {
    margin: 0;
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(2.15rem, 9vw, 2.65rem);
    letter-spacing: -0.045em;
    line-height: 0.95;
    animation: reveal-up 650ms 80ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand span {
    display: inline-block;
    background: linear-gradient(120deg, var(--ink) 40%, var(--gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.tagline {
    margin: 0.85rem auto 0;
    max-width: 18rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink-soft);
    line-height: 1.45;
    animation: reveal-up 650ms 140ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

/* —— Sections —— */
.stack {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

.section {
    animation: reveal-up 650ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.section:nth-child(1) { animation-delay: 200ms; }
.section:nth-child(2) { animation-delay: 280ms; }
.section:nth-child(3) { animation-delay: 360ms; }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.65rem 0.15rem;
}

.section-head h2 {
    margin: 0;
    font-family: var(--display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-head .hint {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gold-deep);
}

[data-theme="dark"] .section-head .hint { color: var(--gold); }

/* —— Primary actions (essentials) —— */
.actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.action {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.9rem;
    padding: 1.05rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(14px);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.action::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gold);
    opacity: 0;
    transition: opacity 160ms ease;
}

.action:hover,
.action:focus-visible {
    border-color: rgba(184, 148, 46, 0.45);
    outline: none;
}

.action:hover::before,
.action:focus-visible::before { opacity: 1; }

.action:active { transform: scale(0.985); background: var(--press); }

.action.priority {
    background: linear-gradient(135deg, var(--gold-soft), var(--surface));
    border-color: rgba(184, 148, 46, 0.35);
}

.action.priority::before { opacity: 1; }

.step {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gold-deep);
    background: var(--gold-soft);
    flex-shrink: 0;
}

[data-theme="dark"] .step { color: var(--gold); }

.action.priority .step {
    color: #fff;
    background: linear-gradient(145deg, var(--gold), var(--gold-deep));
}

.action-body { min-width: 0; }

.action-title {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.action-desc {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.35;
}

.action-go {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    color: var(--muted);
    flex-shrink: 0;
    transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.action:hover .action-go {
    color: var(--gold-deep);
    border-color: rgba(184, 148, 46, 0.4);
    transform: translateX(2px);
}

[data-theme="dark"] .action:hover .action-go { color: var(--gold); }

.action-go img {
    width: 14px;
    height: 14px;
    display: block;
    opacity: 0.7;
}

/* —— Tool grid —— */
.tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.tool {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 0.9rem;
    min-height: 7.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(14px);
    color: inherit;
    text-decoration: none;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.tool:hover,
.tool:focus-visible {
    border-color: rgba(184, 148, 46, 0.4);
    outline: none;
}

.tool:active { transform: scale(0.98); }

.tool-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--press);
    border: 1px solid var(--line);
}

.tool-icon img {
    width: 18px;
    height: 18px;
    display: block;
    opacity: 0.75;
}

.tool-meta { margin-top: auto; }

.tool-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tool-tag {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.18rem 0.4rem;
    border-radius: 6px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-info { background: var(--info-soft); color: var(--info); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

.tool.wide {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    min-height: 0;
    gap: 0.9rem;
}

.tool.wide .tool-meta { margin-top: 0; flex: 1; min-width: 0; }

/* —— Cert vault —— */
.vault {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.vault > summary {
    list-style: none;
    cursor: pointer;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    user-select: none;
}

.vault > summary::-webkit-details-marker { display: none; }

.vault > summary:hover { background: var(--press); }

.vault-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--gold-soft);
    border: 1px solid rgba(184, 148, 46, 0.25);
}

.vault-icon img { width: 18px; height: 18px; display: block; }

.vault-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.vault-sub {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--muted);
}

.vault-chev {
    width: 16px;
    height: 16px;
    opacity: 0.45;
    transition: transform 220ms ease, opacity 160ms ease;
}

.vault[open] > summary .vault-chev {
    transform: rotate(180deg);
    opacity: 0.9;
}

.cert-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--line);
    max-height: min(52vh, 22rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.cert-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    transition: background 140ms ease;
}

.cert-row:last-child { border-bottom: none; }
.cert-row:hover,
.cert-row:focus-visible { background: var(--press); outline: none; }
.cert-row:active { background: var(--gold-soft); }

.cert-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 2px;
    background: var(--gold);
    flex-shrink: 0;
    opacity: 0.7;
}

.cert-name {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cert-badge {
    flex-shrink: 0;
    max-width: 42%;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.35rem;
    border-radius: 5px;
    background: var(--warn-soft);
    color: var(--warn);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cert-go {
    width: 14px;
    height: 14px;
    opacity: 0.35;
    flex-shrink: 0;
}

.foot {
    margin: 1.75rem 0 0;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    opacity: 0.75;
    animation: reveal-up 650ms 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
