/* ============================================================
   Encryption & Decryption Tool — GitHub Pages site
   Modern, responsive, light/dark, portfolio-ready
   ============================================================ */

:root {
  --bg: #0b0d12;
  --bg-alt: #11141c;
  --surface: #161a23;
  --surface-2: #1d222e;
  --border: #262c3a;
  --text: #e7eaf0;
  --text-muted: #9aa3b2;
  --primary: #6d8bff;
  --primary-2: #8b5cf6;
  --accent: #34d399;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-sm: 0 4px 14px rgba(0,0,0,.25);
  --maxw: 1140px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

[data-theme="light"] {
  --bg: #f7f8fb;
  --bg-alt: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f2f4f9;
  --border: #e2e6ee;
  --text: #131722;
  --text-muted: #5b6472;
  --primary: #4f6bff;
  --primary-2: #7c3aed;
  --accent: #059669;
  --shadow: 0 12px 34px rgba(20,30,60,.10);
  --shadow-sm: 0 4px 14px rgba(20,30,60,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .4s var(--ease), color .4s var(--ease);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
code, .mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.12rem; }
.brand-icon { color: var(--primary); display: grid; place-items: center; }
.brand-text strong { color: var(--primary); }
.nav-links { display: flex; gap: 18px; }
.nav-links a { color: var(--text-muted); font-size: .88rem; font-weight: 500; transition: color .2s; white-space: nowrap; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { content: ""; display: block; height: 2px; margin-top: 4px; background: var(--primary); border-radius: 2px; }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; display: grid; place-items: center;
  transition: transform .25s var(--ease), background .2s;
}
.theme-toggle:hover { transform: rotate(18deg); }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.nav-github { gap: 7px; }
.nav-burger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-burger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: .3s; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: .94rem;
  cursor: pointer; border: 1px solid transparent; transition: transform .2s var(--ease), box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-sm { padding: 8px 14px; font-size: .85rem; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 80px 0 60px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; min-height: 420px; }
.eyebrow { display: inline-block; font-size: .82rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); margin-bottom: 16px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.grad { background: linear-gradient(120deg, var(--primary), var(--primary-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { margin: 20px 0 28px; color: var(--text-muted); font-size: 1.08rem; max-width: 520px; line-height: 1.7; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.chip { font-size: .78rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); }

.hero-art { perspective: 1200px; display: flex; justify-content: center; align-items: center; }
.window { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transform: rotateY(-6deg) rotateX(3deg); transition: transform .5s var(--ease); }
.window:hover { transform: rotateY(0) rotateX(0); }
.window-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.red { background: #ff5f57; } .dot.yellow { background: #febc2e; } .dot.green { background: #28c840; }
.window-title { margin-left: 10px; font-size: .82rem; color: var(--text-muted); }
.window-body { padding: 18px; display: grid; gap: 12px; }
.fake-row { display: flex; justify-content: space-between; font-size: .88rem; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fake-row .k { color: var(--text-muted); }
.fake-row .v { font-weight: 600; }
.lock-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 9px 14px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-size: .85rem; font-weight: 600; }
.hero-fade { position: absolute; inset: auto 0 0 0; height: 120px; background: linear-gradient(to top, var(--bg), transparent); pointer-events: none; }

/* ---------- Sections ---------- */
.section { padding: 76px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 660px; margin: 0 auto 44px; text-align: center; }
.section-tag { font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); }
.section-head h2 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); font-weight: 800; margin: 10px 0 12px; letter-spacing: -.01em; }
.section-head p { color: var(--text-muted); line-height: 1.6; }

/* ---------- Cards ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; text-align: left; }
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); box-shadow: var(--shadow); }
.card-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--primary); margin-bottom: 16px; }
.card h3 { font-size: 1.14rem; margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: .95rem; }
.card code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: .85em; color: var(--primary); }
.tick { list-style: none; margin-top: 12px; display: grid; gap: 8px; }
.tick li { position: relative; padding-left: 26px; color: var(--text-muted); font-size: .9rem; }
.tick li::before { content: "✓"; position: absolute; left: 0; top: 0; color: var(--accent); font-weight: 700; }

/* ---------- Stack ---------- */
.stack-wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 8px 0; }
.stack-item { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), border-color .2s; }
.stack-item:hover { transform: translateY(-3px); border-color: var(--primary); }
.stack-logo { font-size: 1.2rem; }

/* ---------- Architecture ---------- */
.arch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 30px; }
.arch-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 20px 16px; text-align: center; }
.arch-col h4 { color: var(--primary); font-size: 1.05rem; }
.arch-col p { color: var(--text-muted); font-size: .82rem; margin-top: 6px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding: 12px 0; }
.flow-node { background: var(--surface); border: 1px solid var(--border); padding: 10px 18px; border-radius: 999px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.flow-arrow { color: var(--primary); font-weight: 700; font-size: 1.1rem; }

/* ---------- Steps ---------- */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: s; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 22px; position: relative; }
.step-num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; font-weight: 700; margin-bottom: 16px; }
.steps h3 { font-size: 1.08rem; margin-bottom: 8px; }
.steps p { color: var(--text-muted); font-size: .9rem; line-height: 1.5; }

/* ---------- Gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.shot { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); cursor: zoom-in; transition: transform .25s var(--ease), border-color .25s; }
.shot:hover { transform: translateY(-4px); border-color: var(--primary); }
.shot img { width: 100%; height: 180px; object-fit: cover; border-bottom: 1px solid var(--border); }
.shot figcaption { padding: 12px 14px; font-size: .88rem; color: var(--text-muted); font-weight: 500; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; place-items: center; z-index: 100; padding: 30px; }
.lightbox.open { display: grid; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 10px; box-shadow: var(--shadow); }
.lightbox button { position: absolute; top: 20px; right: 24px; background: none; border: 0; color: #fff; font-size: 2.4rem; cursor: pointer; line-height: 1; }

/* ---------- Video ---------- */
.video-wrap { max-width: 860px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); background: #000; }
.video-wrap video { width: 100%; display: block; }

/* ---------- Download ---------- */
.download-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 22px; background: linear-gradient(135deg, var(--surface), var(--surface-2)); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); }
.dl-info h3 { font-size: 1.25rem; }
.dl-info p { color: var(--text-muted); margin-top: 6px; font-size: .92rem; }
.dl-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.note { margin-top: 22px; padding: 14px 18px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius-sm); color: var(--text-muted); font-size: .92rem; line-height: 1.6; }

/* ---------- Docs ---------- */
.doc-card { display: block; }
.run-steps { margin-top: 26px; }
.run-steps pre { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; overflow-x: auto; }
.run-steps code { font-size: .9rem; color: var(--text); white-space: pre; }

/* ---------- Repo ---------- */
.repo-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); }
.repo-meta { display: flex; flex-wrap: wrap; gap: 18px; color: var(--text-muted); font-size: .92rem; align-items: center; }
.repo-lang { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text); }
.lang-dot { width: 11px; height: 11px; border-radius: 50%; background: #f89820; }

/* ---------- About ---------- */
.about-card { display: flex; gap: 26px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow-sm); }
.avatar { width: 86px; height: 86px; border-radius: 22px; display: grid; place-items: center; font-weight: 800; font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); flex-shrink: 0; }
.about-body h3 { font-size: 1.25rem; }
.about-body p { color: var(--text-muted); margin: 10px 0 14px; line-height: 1.6; }
.about-tags { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- FAQ ---------- */
.faq { max-width: 820px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 18px; transition: border-color .2s; }
.faq details[open] { border-color: var(--primary); }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--primary); font-size: 1.4rem; font-weight: 700; transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { color: var(--text-muted); padding: 0 0 16px; font-size: .94rem; }

/* ---------- Footer ---------- */
.footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 54px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 30px; align-items: start; }
.footer-brand p { color: var(--text-muted); margin-top: 8px; font-size: .92rem; }
.footer-links { display: flex; flex-direction: column; gap: 9px; }
.footer-links a { color: var(--text-muted); font-size: .92rem; transition: color .2s; }
.footer-links a:hover { color: var(--text); }
.footer-cta { display: flex; gap: 10px; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .85rem; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.show { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-art { max-width: 400px; margin: 0 auto; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .arch { grid-template-columns: repeat(3, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav-links { position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0; background: var(--bg); border-bottom: 1px solid var(--border); padding: 8px 22px 16px; transform: translateY(-130%); transition: transform .35s var(--ease); }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: 13px 0; border-bottom: 1px solid var(--border); }
  .nav-burger { display: flex; }
  .nav-github { display: none; }
  .grid-2, .grid-3, .steps, .gallery { grid-template-columns: 1fr; }
  .arch { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .hero { padding: 60px 0 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; opacity: 1; transform: none; }
  * { animation: none !important; }
}

/* ============================================================
   Try It Online — Dashboard
   Uses global --bg/--surface/--border/--text vars so it follows
   the site's light/dark theme automatically.
   ============================================================ */
.dash { max-width: 820px; margin: 0 auto; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-title { display: flex; align-items: center; gap: 14px; }
.dash-logo { font-size: 1.8rem; }
.dash-title h3 { font-size: 1.15rem; }
.dash-title p { color: var(--text-muted); font-size: .85rem; }
.algo-badge { background: color-mix(in srgb, var(--primary) 14%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary); padding: 6px 14px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }

.dash .tabs { display: inline-flex; gap: 3px; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.dash .tab-btn { padding: 8px 20px; border: 0; border-radius: 9px; cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600; background: transparent; color: var(--text-muted); transition: background .2s, color .2s; }
.dash .tab-btn.active { background: var(--primary); color: #fff; }
[data-theme="light"] .dash .tab-btn.active { color: #fff; }

.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.dash .section-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 700; margin-bottom: 12px; }
.dash .form-group { margin-bottom: 18px; }
.dash label { display: block; font-size: .78rem; color: var(--text-muted); margin-bottom: 7px; text-transform: uppercase; letter-spacing: .04em; }
.dash textarea, .dash input[type="password"], .dash input[type="text"] {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .88rem;
  padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s; resize: vertical;
}
.dash textarea:focus, .dash input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.dash .password-wrap { position: relative; }
.dash .password-wrap input { padding-right: 48px; }
.dash .toggle-pass { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 1rem; opacity: .8; }
.dash .strength-bar-bg { height: 5px; background: var(--border); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.dash .strength-bar { height: 100%; width: 0; border-radius: 999px; transition: width .3s, background .3s; }
.dash .strength-label { font-size: .75rem; margin-top: 5px; min-height: 1em; }

.dash .btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.dash .btn { padding: 10px 18px; border: 0; border-radius: 9px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: transform .15s, opacity .15s; }
.dash .btn:hover { transform: translateY(-1px); }
.dash .btn:disabled { opacity: .6; cursor: not-allowed; }
.dash .btn-encrypt { background: var(--accent); color: #06281c; }
.dash .btn-decrypt { background: var(--primary); color: #fff; }
.dash .btn-copy { background: color-mix(in srgb, var(--text-muted) 16%, transparent); color: var(--text); border: 1px solid var(--border); }
.dash .btn-clear { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }

.dash .result-box { border-radius: 10px; padding: 14px 16px; margin-top: 16px; border: 1px solid; display: none; }
.dash .result-box.show { display: block; }
.dash .result-success { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.dash .result-error { background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 32%, transparent); }
.dash .result-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.dash .result-label.ok { color: var(--accent); }
.dash .result-label.err { color: var(--danger); }
.dash .result-text { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .82rem; word-break: break-all; line-height: 1.6; white-space: pre-wrap; }

.dash .info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.dash .info-box { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.dash .info-box .icon { font-size: 1.3rem; margin-bottom: 6px; }
.dash .info-box .name { font-size: .76rem; color: var(--text-muted); }
.dash .info-box .val { font-size: .9rem; font-weight: 700; color: var(--primary); }
.dash .about-note { margin-top: 20px; padding: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: .85rem; line-height: 1.9; color: var(--text-muted); }
.dash .about-note code { color: var(--primary-2); }
.dash-foot { text-align: center; color: var(--text-muted); font-size: .88rem; margin-top: 22px; }
.dash-foot a { color: var(--primary); }

.dash .spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.3); border-top-color: currentColor; border-radius: 50%; animation: dashspin .7s linear infinite; }
@keyframes dashspin { to { transform: rotate(360deg); } }

