/* ==========================================================================
   Site main stylesheet
   ========================================================================== */
:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #5b6475;
    --line: #e3e8ef;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --accent: #06b6d4;
    --dark: #0f172a;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 24px rgba(15, 23, 42, .06);
    --shadow-hover: 0 4px 10px rgba(15, 23, 42, .08), 0 14px 40px rgba(79, 70, 229, .14);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }
.section { padding: 56px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 720px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4em;
    padding: .75em 1.4em; border-radius: 10px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
    transition: background .2s, color .2s, box-shadow .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 6px 18px rgba(79, 70, 229, .3); }
.btn-ghost { background: transparent; color: inherit; border-color: currentColor; opacity: .9; }
.btn-ghost:hover { opacity: 1; background: rgba(127, 127, 127, .08); }
.btn-sm { padding: .5em 1em; font-size: .9rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* Header */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(15, 23, 42, .96); backdrop-filter: blur(8px);
    color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.15rem; text-decoration: none !important; }
.brand img { width: 40px; height: 40px; flex: none; transition: transform .4s cubic-bezier(.34,1.56,.64,1); }
.brand:hover img { transform: rotate(-12deg) scale(1.08); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-size: 1.05rem; letter-spacing: -.01em; }
.brand-text small { font-size: .74rem; font-weight: 500; color: #94a3b8; letter-spacing: .02em; }
.main-nav ul { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.main-nav a { display: block; padding: 8px 14px; border-radius: 8px; color: #cbd5e1; font-weight: 500; text-decoration: none; }
.main-nav a:hover, .main-nav a.active { color: #fff; background: rgba(255, 255, 255, .08); }
.caret { font-size: .75em; opacity: .7; }
.has-menu { position: relative; }
.mega {
    position: absolute; right: -160px; top: calc(100% + 8px);
    display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 18px 24px;
    padding: 22px; background: #fff; color: var(--text); border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(15, 23, 42, .25); min-width: 640px;
    opacity: 0; visibility: hidden; transform: translateY(6px); transition: .18s;
}
.has-menu:hover .mega, .has-menu:focus-within .mega { opacity: 1; visibility: visible; transform: none; }
.mega-title { font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.mega a { color: var(--text); padding: 5px 8px; margin: 0 -8px; font-size: .95rem; }
.mega a:hover { background: #eef2ff; color: var(--primary); }
.burger { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; padding: 8px; }
.burger span { display: block; height: 2px; background: #fff; margin: 5px 0; border-radius: 2px; transition: .25s; }
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero (compact strip) */
.hero {
    color: #fff; padding: 22px 0 16px;
    background:
        radial-gradient(700px 220px at 90% -40%, rgba(6, 182, 212, .30), transparent 60%),
        radial-gradient(600px 220px at 0% 140%, rgba(79, 70, 229, .40), transparent 60%),
        var(--dark);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.hero-row { display: flex; align-items: center; gap: 28px; }
.hero-text { flex: 1 1 auto; min-width: 0; }
.hero h1 { font-size: clamp(1.25rem, 2.2vw, 1.6rem); margin: 0 0 4px; }
.hero-text p { margin: 0; color: #94a3b8; font-size: .95rem; }
.hero-search { flex: 0 1 420px; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip.chip-dark { background: rgba(255, 255, 255, .06); color: #cbd5e1; border-color: rgba(255, 255, 255, .12); }
.chip.chip-dark:hover { color: #fff; border-color: var(--accent); }
.chip.chip-dark.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-color: transparent; }
.chip-n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: rgba(255, 255, 255, .15); font-size: .78rem; text-align: center; }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: #94a3b8; pointer-events: none; }
.hero-search { position: relative; }
.hero-search input {
    width: 100%; padding: 12px 16px 12px 40px; font: inherit; font-size: 1rem; border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .08); color: #fff; outline: none;
}
.hero-search input::placeholder { color: #94a3b8; }
.hero-search input:focus { border-color: var(--accent); background: rgba(255, 255, 255, .12); box-shadow: 0 0 0 4px rgba(34, 211, 238, .18); }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 8px); background: #fff; border-radius: 12px; box-shadow: 0 20px 40px rgba(0, 0, 0, .3); overflow: hidden; display: none; z-index: 5; }
.search-results a { display: flex; gap: 10px; padding: 12px 16px; color: var(--text); border-bottom: 1px solid var(--line); }
.search-results a:hover, .search-results a.sel { background: #eef2ff; text-decoration: none; }
.search-results .empty { padding: 14px 16px; color: var(--muted); }

/* Category blocks & cards */
.cat-block + .cat-block { margin-top: 48px; }
.cat-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.cat-head h2 { margin: 0; }
.cat-head p { margin: 0; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.card {
    display: flex; gap: 16px; align-items: flex-start; padding: 20px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); color: var(--text); text-decoration: none !important;
    transition: transform .18s, box-shadow .18s, border-color .18s; position: relative;
}
.card { overflow: hidden; isolation: isolate; }
.card::before {
    content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 2px;
    background: linear-gradient(135deg, var(--primary), var(--accent), #f59e0b, var(--primary));
    background-size: 300% 300%;
    -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 .25s;
}
.card::after {
    content: ''; position: absolute; z-index: -1; width: 220px; height: 220px; border-radius: 50%;
    left: var(--mx, 50%); top: var(--my, 50%); transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(79, 70, 229, .14), transparent 70%);
    opacity: 0; transition: opacity .25s; pointer-events: none;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: transparent; outline: none; }
.card:hover::before, .card:focus-visible::before { opacity: 1; animation: borderflow 3s linear infinite; }
.card:hover::after { opacity: 1; }
.card:hover .card-icon { transform: scale(1.12) rotate(-6deg); background: linear-gradient(135deg, #e0e7ff, #cffafe); }
.card:active { transform: translateY(-1px) scale(.99); }
.card.is-picked { transform: scale(.97); box-shadow: 0 0 0 3px rgba(79, 70, 229, .35), var(--shadow-hover); }
@keyframes borderflow { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(79, 70, 229, .25); animation: ripple .6s ease-out forwards; pointer-events: none; z-index: 0; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.cat-block { transition: opacity .25s, transform .25s; }
.cat-block.is-hidden { display: none; }
.cat-block.fade-in { animation: fadein .35s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card-icon { font-size: 1.8rem; width: 52px; height: 52px; flex: none; display: grid; place-items: center; background: #eef2ff; border-radius: 12px; transition: transform .3s cubic-bezier(.34,1.56,.64,1), background .3s; }
.card-body { display: flex; flex-direction: column; gap: 4px; }
.card-body strong { font-size: 1.05rem; }
.card-body span { color: var(--muted); font-size: .93rem; line-height: 1.5; }
.card-go { position: absolute; right: 18px; bottom: 14px; font-size: .85rem; font-weight: 600; color: var(--primary); opacity: 0; transform: translateX(-8px); transition: .25s; }
.card:hover .card-go { opacity: 1; transform: none; }

.why h2 { text-align: center; margin-bottom: 30px; }
.why-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.why-grid p { color: var(--muted); }

/* Page head */
.page-head, .tool-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 22px 0 20px; }
.tool-head { padding: 14px 0 14px; }
.tool-head .crumbs { margin-bottom: 8px; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; opacity: .5; }
.cat-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { font: inherit; font-size: .9rem; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Tools overview */
.overview { display: grid; gap: 20px; }
.overview-item { display: flex; gap: 22px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .25s, box-shadow .25s, transform .25s; }
.overview-item:hover { border-left-color: var(--primary); box-shadow: var(--shadow-hover); transform: translateX(4px); }
.overview-item:hover .overview-icon { transform: scale(1.08) rotate(-5deg); }
.overview-icon { transition: transform .3s cubic-bezier(.34,1.56,.64,1); font-size: 2.4rem; width: 76px; height: 76px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, #eef2ff, #ecfeff); border-radius: 18px; }
.overview-body h2 { margin: 6px 0 8px; font-size: 1.35rem; }
.overview-body h2 a { color: var(--text); }
.overview-body p { color: var(--muted); }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); background: #eef2ff; padding: 3px 10px; border-radius: 999px; }
.ticks { list-style: none; padding: 0; margin: 0 0 1.2em; }
.ticks li { position: relative; padding-left: 26px; margin: 6px 0; }
.ticks li::before { content: '✓'; position: absolute; left: 0; top: 0; color: #10b981; font-weight: 700; }

/* Tool page */
.tool-title { display: flex; align-items: center; gap: 18px; }
.tool-title h1 { margin: 0 0 4px; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.tool-title p { margin: 0; color: var(--muted); }
.tool-icon { font-size: 1.8rem; width: 54px; height: 54px; flex: none; display: grid; place-items: center; background: #eef2ff; border-radius: 16px; }
.tool-full { margin-left: auto; color: var(--muted); white-space: nowrap; }
.tool-app { padding: 24px 0 8px; }
.frame-wrap { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tool-frame { display: block; width: 100%; min-height: 320px; height: 600px; border: 0; background: #fff; }
.frame-loader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); background: #fff; z-index: 2; transition: opacity .3s; }
.frame-loader.hide { opacity: 0; pointer-events: none; }
.spinner { width: 26px; height: 26px; border: 3px solid #e0e7ff; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px 38px; box-shadow: var(--shadow); }
.article h2 { margin-top: 1.4em; }
.article h2:first-child { margin-top: 0; }
.steps { padding-left: 1.3em; }
.steps li { margin: 8px 0; padding-left: 4px; }
.faq details { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; background: #fafbff; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; position: relative; padding-right: 40px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 18px; top: 10px; font-size: 1.4rem; color: var(--primary); }
.faq details[open] summary::after { content: '−'; }
.faq details p { padding: 0 18px 14px; margin: 0; color: var(--muted); }
.sidebar { position: sticky; top: 84px; display: grid; gap: 20px; }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.side-box p { color: var(--muted); font-size: .95rem; }
.side-tool { display: flex; gap: 12px; padding: 10px; margin: 0 -10px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.side-tool { transition: background .2s, transform .2s; }
.side-tool:hover { background: #f1f5ff; transform: translateX(4px); }
.side-tool > span:first-child { font-size: 1.5rem; }
.side-tool strong { display: block; font-size: .95rem; }
.side-tool small { color: var(--muted); font-size: .82rem; line-height: 1.4; display: block; }
.side-all { display: inline-block; margin-top: 8px; font-weight: 600; font-size: .92rem; }

/* Prose pages */
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 6px 0; }
.prose .ticks { padding-left: 0; }
.author { display: flex; gap: 24px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.author img { width: 120px; height: 120px; flex: none; }
.author-logo { padding: 14px; border-radius: 28px; background: #0f172a; }
.author h2 { margin-top: 0; }

/* Forms */
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 12px 14px; font: inherit; border: 1px solid #cfd6e0; border-radius: 10px; background: #fff; color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.form-group .input-short { max-width: 160px; }
.form-group.hp { position: absolute; left: -9999px; }
.form-note { font-size: .88rem; color: var(--muted); }
.form-status { margin-top: 14px; padding: 0; border-radius: 10px; font-weight: 500; }
.form-status.ok { padding: 12px 16px; background: #ecfdf5; color: #047857; }
.form-status.err { padding: 12px 16px; background: #fef2f2; color: #b91c1c; }

/* Ads */
.ad { margin: 24px auto; text-align: center; min-height: 90px; }
.ad-inline { margin: 28px 0; }
.ad-side { min-height: 250px; }

/* 404 */
.notfound { text-align: center; }
.notfound .cards { text-align: left; margin: 30px 0; }
.nf-code { font-size: 6rem; font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Footer */
.site-footer { background: var(--dark); color: #94a3b8; padding: 56px 0 24px; margin-top: 40px; font-size: .93rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr); gap: 28px; }
.footer-about p { margin-top: 14px; }
.brand-footer img { width: 36px; height: 36px; }
.footer-col h4 { color: #fff; font-size: .95rem; margin-bottom: 12px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin: 7px 0; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 40px; padding-top: 22px; }
.footer-bottom nav { display: flex; gap: 20px; flex-wrap: wrap; }

/* Responsive */
@media (max-width: 1080px) {
    .footer-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-about { grid-column: 1 / -1; }
    .article-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 860px) {
    .burger { display: block; }
    .main-nav { position: fixed; inset: 64px 0 0 0; background: var(--dark); padding: 16px 20px 40px; overflow-y: auto; transform: translateX(100%); transition: transform .25s; }
    .main-nav.open { transform: none; }
    .main-nav ul { flex-direction: column; gap: 2px; }
    .main-nav a { padding: 12px 10px; font-size: 1.05rem; }
    .mega { position: static; opacity: 1; visibility: visible; transform: none; min-width: 0; grid-template-columns: 1fr; background: transparent; box-shadow: none; padding: 4px 0 8px 14px; color: #cbd5e1; gap: 10px; }
    .mega-title { color: #64748b; }
    .mega a { color: #cbd5e1; margin: 0; }
    .mega a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
    body.menu-open { overflow: hidden; }
    .hero-row { flex-direction: column; align-items: stretch; gap: 12px; }
    .hero-search { flex-basis: auto; }
    .hero-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
    .hero-chips .chip { white-space: nowrap; }
    .brand-text { font-size: .95rem; }
    .why-grid { grid-template-columns: 1fr; }
    .tool-full { display: none; }
}
@media (max-width: 640px) {
    .section { padding: 40px 0; }
    .cards { grid-template-columns: 1fr; }
    .overview-item { flex-direction: column; gap: 12px; padding: 20px; }
    .overview-icon { width: 60px; height: 60px; font-size: 2rem; }
    .article { padding: 22px 20px; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-card { padding: 22px; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .author { flex-direction: column; text-align: center; }
    .tool-icon { width: 52px; height: 52px; font-size: 1.7rem; }
    .tool-frame { min-height: 360px; }
}

/* ---------- Illustrations ---------- */
.card { flex-wrap: wrap; }
.card-thumb {
    flex: 0 0 calc(100% + 40px); margin: -20px -20px 6px; aspect-ratio: 16 / 10; overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0; background: #eef2ff; border-bottom: 1px solid var(--line);
}
.card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.card:hover .card-thumb img { transform: scale(1.06); }
.card .card-body { flex: 1 1 0; min-width: 0; }
.overview-art { flex: 0 0 280px; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); align-self: flex-start; }
.overview-art img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.overview-item:hover .overview-art img { transform: scale(1.05); }
.article-art { float: right; width: 42%; max-width: 360px; margin: 0 0 18px 26px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.article-art img { display: block; width: 100%; height: auto; }
.article > h2:nth-of-type(2) { clear: both; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.shown { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

@media (max-width: 860px) {
    .overview-art { flex-basis: auto; width: 100%; }
}
@media (max-width: 640px) {
    .article-art { float: none; width: 100%; max-width: none; margin: 0 0 18px; }
}
