/* ===== Kryptec — home ===== */
:root {
    --bg: #000;
    --fg: #fff;
    --orange: #ffa500;
    --logo-orange: #ff9a00;
    --muted: #5e5e5e;
    --text-2: #9a9a9a;
    --card-bg: rgba(12, 12, 12, 0.86);
    --card-border: rgba(255, 165, 0, 0.22);
    --surface: #0b0b0b;
    --surface-2: #141414;
    --line: #1f1f1f;
    --logo-size: 300px;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'Kanit', system-ui, sans-serif;
    font-weight: 300;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* ===== Hero ===== */
.hero {
    position: relative;
    height: 100vh;
    height: 100svh;
    min-height: 560px;
    overflow: hidden;
}
.hero-stage {
    position: absolute;
    inset: 0;
    opacity: calc(1 - var(--p, 0) * 1.15);
    transform: translateY(calc(var(--p, 0) * 90px));
}
.logo-canvas, #fx {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.logo-canvas { z-index: 1; }
#fx { z-index: 2; }

.hero-content {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    pointer-events: none;
}
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.hero-content a, .logo-slot { pointer-events: auto; }
body.on-point, body.on-point .logo-slot { cursor: pointer; }

.logo-slot {
    width: var(--logo-size);
    aspect-ratio: 1;
    margin-bottom: 30px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.logo { display: block; width: 100%; height: 100%; transition: opacity .4s; }

.sep {
    /* same as the original: 80% of the page container, max 500px */
    width: min(500px, calc((100vw - 80px) * 0.8));
    height: 1px;
    border: 0;
    background: #ffa50085;
    margin: 5px auto 30px;
}
.welcome-title {
    font-size: 4rem;
    line-height: 4.5rem;
    font-weight: 400;
    letter-spacing: 1px;
}
.welcome-text {
    color: var(--orange);
    font-family: Arial, sans-serif;
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 20px;
}
.contact-link {
    color: var(--muted);
    text-decoration: none;
    font-family: Arial, sans-serif;
    font-size: 1.2rem;
    transition: color .3s ease;
}
.contact-link:hover { color: var(--orange); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animated { animation: fadeIn 1s ease-out both; }

.scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 5;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: .75rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color .3s;
}
.scroll-hint:hover { color: var(--orange); }
.chev {
    width: 10px;
    height: 10px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 50% { translate: 0 5px; } }

/* ===== Logo mode 2 — tilt ===== */
.tilt { width: 100%; height: 100%; }
.tilt-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    will-change: transform;
}
.tilt-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.tilt-layer:last-of-type { filter: drop-shadow(0 0 18px rgba(255, 154, 0, .25)); }
.tilt-glare {
    position: absolute;
    inset: 0;
    transform: translateZ(1px);
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .55), transparent 45%);
    mix-blend-mode: overlay;
    -webkit-mask: var(--mask) center / contain no-repeat;
    mask: var(--mask) center / contain no-repeat;
    pointer-events: none;
}

/* ===== Secret layer ===== */
.secret-layer {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}
.app-card {
    position: absolute;
    left: 0;
    top: 0;
    /* width follows the title (min 228px, capped); the description wraps instead of widening the card */
    width: max-content;
    min-width: 228px;
    max-width: min(420px, calc(100vw - 32px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 15px 9px 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--fg);
    text-decoration: none;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    translate: 0 6px;
    pointer-events: none;
    transition: opacity .35s, translate .35s, border-color .2s, box-shadow .2s;
}
.app-card.on { opacity: 1; translate: 0 0; pointer-events: auto; }
.app-card:hover, .app-card:focus-visible {
    border-color: var(--orange);
    box-shadow: 0 0 24px rgba(255, 154, 0, .22);
    outline: none;
}
.anchor-r { transform: translate(16px, -50%); }
.anchor-l { transform: translate(calc(-100% - 16px), -50%); }

.app-icon, .tool-icon {
    flex: 0 0 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
}
.app-icon img, .tool-icon img { width: 24px; height: 24px; object-fit: contain; }
.monogram { color: var(--orange); font-weight: 500; font-size: 1rem; }
.app-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.app-title { display: flex; align-items: center; gap: 6px; line-height: 1.25; }
.app-name { font-family: var(--mono); font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lock { flex: 0 0 11px; width: 11px; height: 11px; color: var(--orange); opacity: .85; }
.lock.open { flex-basis: 12px; width: 12px; height: 12px; color: #3ddc84; opacity: 1; }
.app-desc {
    font-size: .75rem;
    color: var(--text-2);
    line-height: 1.3;
    /* width 0 + min-width 100%: doesn't count in the card width → wraps under the title */
    width: 0;
    min-width: 100%;
}

/* Reveal mode 1 — torch */
.reveal-torch {
    --x: -999px; --y: -999px; --r: 1px;
    -webkit-mask-image: radial-gradient(circle var(--r) at var(--x) var(--y), #000 35%, transparent 100%);
    mask-image: radial-gradient(circle var(--r) at var(--x) var(--y), #000 35%, transparent 100%);
}
.reveal-torch::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 154, 0, .3) 1px, transparent 1.5px);
    background-size: 24px 24px;
}
.reveal-torch .app-card { opacity: 1; translate: 0 0; }
.torch-halo {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(circle calc(var(--r, 1px) * 1.2) at var(--x, -999px) var(--y, -999px), rgba(255, 154, 0, .07), transparent 70%);
}

/* ===== Vault (all secret apps) ===== */
#vault {
    margin: auto;
    width: min(760px, calc(100% - 32px));
    max-height: calc(100% - 32px);
    background: var(--surface);
    color: var(--fg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 0;
}
#vault::backdrop { background: rgba(0, 0, 0, .75); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.vault-box { padding: 18px; }
.vault-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-family: var(--mono);
    font-size: .8rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--orange);
}
.vault-close {
    background: none;
    border: 0;
    color: var(--text-2);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.vault-close:hover { color: var(--fg); }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.app-card.static { position: static; width: auto; min-width: 0; max-width: none; transform: none; }

/* ===== Toolbox (public) ===== */
.toolbox {
    max-width: 1200px;
    margin: 0 auto;
    padding: 96px 20px 60px;
}
.tb-head { text-align: center; margin-bottom: 40px; }
.tb-kicker {
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--orange);
    margin-bottom: 10px;
}
.tb-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 400; line-height: 1.15; }
.tb-sub { color: var(--text-2); margin: 10px auto 28px; max-width: 560px; }
.tb-controls { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.tb-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(520px, 100%);
    padding: 0 14px;
    height: 46px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text-2);
    transition: border-color .2s;
}
.tb-search:focus-within { border-color: var(--orange); }
.tb-search svg { width: 18px; height: 18px; flex: none; }
.tb-search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: none;
    color: var(--fg);
    font: inherit;
    font-size: 1rem;
}
.tb-search kbd {
    font-family: var(--mono);
    font-size: .75rem;
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 1px 7px;
}
.tb-tags, .tb-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
    font: inherit;
    font-size: .85rem;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: all .2s;
}
.chip:hover { color: var(--fg); border-color: #333; }
.chip[aria-pressed="true"] { color: #000; background: var(--orange); border-color: var(--orange); }
.tb-nav { margin-top: 18px; }
.tb-nav-link {
    color: var(--muted);
    text-decoration: none;
    font-size: .85rem;
    padding: 2px 6px;
    transition: color .2s;
}
.tb-nav-link:hover { color: var(--orange); }

.tb-cat { margin-bottom: 44px; scroll-margin-top: 24px; }
.tb-cat-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--line);
}
.tb-cat-head h3 { font-size: 1.3rem; font-weight: 400; }
.tb-count { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.tb-cat-desc { color: var(--text-2); font-size: .9rem; margin-bottom: 14px; }
.tb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.tool-card {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--fg);
    text-decoration: none;
    transition: border-color .2s, transform .2s, background .2s;
}
.tool-card:hover { border-color: rgba(255, 165, 0, .45); background: #0f0f0f; transform: translateY(-2px); }
.tool-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 14px; }
.tool-name { font-weight: 500; line-height: 1.25; }
.tool-desc { font-size: .85rem; color: var(--text-2); line-height: 1.35; }
.tool-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.badge {
    font-family: var(--mono);
    font-size: .65rem;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--text-2);
}
.badge-open-source { color: var(--orange); border-color: rgba(255, 165, 0, .35); }
.badge-self-hostable { color: #8fd3ff; border-color: rgba(143, 211, 255, .3); }
.tool-arrow {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    color: var(--muted);
    transition: color .2s;
}
.tool-card:hover .tool-arrow { color: var(--orange); }
.tb-empty { text-align: center; color: var(--text-2); padding: 40px 0; }

.site-footer {
    display: flex;
    justify-content: center;
    gap: 18px;
    padding: 30px 20px 40px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--orange); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .welcome-title { font-size: 3rem; line-height: 3.5rem; }
    .welcome-text { font-size: 1.8rem; }
    .contact-link { font-size: 1rem; }
}
@media (max-width: 480px) {
    :root { --logo-size: 200px; }
    .welcome-text { font-size: 1.5rem; }
    .toolbox { padding-top: 72px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .animated, .chev { animation: none; }
    .hero-stage { transform: none; }
}
