/* GhostType — clean, trustworthy security-tool styling. */

:root {
  --bg: #0b0f1a;
  --bg-soft: #111726;
  --panel: #141b2d;
  --panel-2: #18203468;
  --line: #243049;
  --line-soft: #1c2840;
  --text: #e7ecf6;
  --muted: #9aa6bf;
  --faint: #6b7894;
  --accent: #6c8cff;
  --accent-2: #57e6c3;
  --accent-ink: #0b1020;
  --danger: #ff8597;
  --good: #57e6c3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px -25px rgba(0, 0, 0, 0.8);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must beat author display rules (e.g. .attach-bar uses
   display:flex, which would otherwise keep hidden panels visible). */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 80% -10%, rgba(108, 140, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(87, 230, 195, 0.08), transparent 55%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1080px, 92vw); margin-inline: auto; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 50; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(11, 15, 26, 0.72);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { width: 30px; height: 30px; fill: var(--accent); filter: drop-shadow(0 0 10px rgba(108,140,255,.45)); }
.brand-mark circle { fill: var(--accent-ink); }
.brand-name { font-weight: 700; font-size: 1.18rem; letter-spacing: -0.02em; }
.brand-accent { color: var(--accent); }
.header-meta { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.01em;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text); background: var(--panel-2);
}
.pill-quiet { color: var(--muted); font-weight: 500; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 16px; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 62ch; margin: 0 0 22px; }
.lede strong { color: var(--text); }
.assurances { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 0; margin: 0; }
.assurances li { display: inline-flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--text); font-weight: 500; }
.assurances svg { width: 18px; height: 18px; fill: var(--accent-2); }

/* ---------- workbench ---------- */
.workbench { padding: 14px 0 40px; }

.mode-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.mode-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 0.95rem;
  color: var(--muted); background: var(--panel); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; transition: all .15s ease;
}
.mode-btn svg { width: 17px; height: 17px; fill: currentColor; }
.mode-btn:hover { color: var(--text); border-color: #34466b; }
.mode-btn.is-active {
  color: var(--accent-ink); background: linear-gradient(180deg, #8aa3ff, var(--accent));
  border-color: transparent; box-shadow: 0 8px 24px -10px rgba(108,140,255,.7);
}
.mode-hint { color: var(--faint); font-size: 0.86rem; margin-left: 4px; }

.panes { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; }
@media (max-width: 820px) { .panes { grid-template-columns: 1fr; } }

.pane {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pane-label { font-weight: 650; font-size: 0.96rem; }
.pane-sub { font-size: 0.78rem; color: var(--faint); }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 10px; }
.tool {
  font: inherit; font-size: 0.82rem; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 6px 9px; cursor: pointer; min-width: 32px; transition: all .12s ease;
}
.tool:hover { color: var(--text); border-color: var(--accent); background: rgba(108,140,255,.12); }
.tool b, .tool i, .tool u { font-style: normal; font-weight: 800; }
.tool i { font-style: italic; }
.tool u { text-decoration: underline; }
.tool-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

.editor {
  min-height: 220px; max-height: 460px; overflow-y: auto;
  background: #0c1322; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 15px; color: var(--text); font-size: 0.98rem;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,.18); }
.editor:empty::before { content: attr(data-placeholder); color: var(--faint); }
.editor img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.editor a { color: var(--accent); }

.cipher-input {
  width: 100%; min-height: 220px; resize: vertical;
  background: #0c1322; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 15px; color: var(--text); font-family: var(--mono); font-size: 0.86rem;
  line-height: 1.5; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.cipher-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,.18); }

/* key pane */
.pane-key { display: flex; flex-direction: column; }
.password-row { position: relative; display: flex; align-items: center; }
.password {
  width: 100%; font: inherit; font-size: 1rem;
  background: #0c1322; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 44px 12px 14px; color: var(--text); outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.password:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,140,255,.18); }
.ghost-btn {
  font: inherit; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: all .13s ease;
}
.ghost-btn svg { width: 16px; height: 16px; fill: currentColor; }
.ghost-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.ghost-btn:disabled { opacity: .45; cursor: not-allowed; }
.password-row .ghost-btn { position: absolute; right: 6px; border: none; background: transparent; padding: 6px 8px; }

.strength { height: 5px; border-radius: 999px; background: var(--line); margin: 10px 0 14px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .25s ease, background .25s ease; }

.pw-tools { display: flex; gap: 8px; margin-bottom: 18px; }
.pw-tools .ghost-btn { font-size: 0.84rem; padding: 8px 11px; }
.pw-tools #genBtn { flex: 1; justify-content: center; }

/* attachments + .ghost opener */
.attach-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.attach-add {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 13px; cursor: pointer; transition: all .13s ease;
}
.attach-add svg { width: 16px; height: 16px; fill: currentColor; }
.attach-add:hover { border-color: var(--accent); background: rgba(108,140,255,.12); }
.attach-add.is-drag { border-color: var(--accent-2); background: rgba(87,230,195,.1); }
.attach-hint { font-size: 0.8rem; color: var(--faint); }
.attach-hint code { font-family: var(--mono); color: var(--muted); }

.attach-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.attach-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.attach-item .file-icon { font-size: 1.25rem; }
.attach-item .ai-meta { min-width: 0; flex: 1; }
.attach-item .ai-meta strong { display: block; font-weight: 600; font-size: 0.9rem; word-break: break-all; }
.attach-item .ai-meta span { font-size: 0.78rem; color: var(--faint); }
.attach-remove {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px; cursor: pointer;
  font: inherit; font-size: 1rem; line-height: 1; color: var(--muted);
  background: transparent; border: 1px solid var(--line); transition: all .12s ease;
}
.attach-remove:hover { color: var(--danger); border-color: var(--danger); }

.file-icon { font-size: 1.4rem; }

.attach-hint.has-file { color: var(--accent-2); font-weight: 600; }

/* decrypted output: message + attachment results */
.decrypted-message { margin-bottom: 4px; }
.attach-results { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.attach-results-head { font-size: 0.82rem; font-weight: 600; color: var(--muted); }

/* download card (encrypted bundle + each decrypted attachment) */
.dl-card {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.dl-card + .dl-card { margin-top: 0; }
.output > .dl-card { background: #0c1322; }
.dl-card .file-icon { font-size: 2rem; }
.dl-info { min-width: 0; }
.dl-info strong { display: block; word-break: break-all; }
.dl-info span { font-size: 0.82rem; color: var(--faint); }
.dl-btn {
  margin-left: auto; flex-shrink: 0; font: inherit; font-weight: 650; color: var(--accent-ink);
  background: linear-gradient(180deg, #8aa3ff, var(--accent)); border: none; border-radius: 9px;
  padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
}
.dl-btn:hover { filter: brightness(1.05); }

.run-btn {
  font: inherit; font-weight: 700; font-size: 1rem; color: var(--accent-ink);
  background: linear-gradient(180deg, #8aa3ff, var(--accent));
  border: none; border-radius: var(--radius-sm); padding: 14px 18px; cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(108,140,255,.8); transition: transform .12s ease, filter .12s ease;
}
.run-btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.run-btn:active { transform: translateY(0); }
.run-btn:disabled { filter: grayscale(.4) brightness(.8); cursor: progress; }
.run-note { font-size: 0.78rem; color: var(--faint); margin: 12px 0 0; }
.status { font-size: 0.86rem; margin: 10px 0 0; min-height: 1.2em; }
.status.is-error { color: var(--danger); }
.status.is-ok { color: var(--good); }

/* output */
.output-pane { margin-top: 18px; }
.output-actions { display: flex; gap: 8px; }
.output {
  min-height: 130px; background: #0c1322; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 15px; font-family: var(--mono); font-size: 0.86rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; overflow-y: auto; max-height: 420px;
}
.output[data-empty="true"] { font-family: var(--font); }
.output-placeholder { color: var(--faint); }
.output.is-rich { font-family: var(--font); font-size: 0.98rem; white-space: normal; word-break: normal; }
.output.is-rich img { max-width: 100%; border-radius: 8px; }
.output.is-rich a { color: var(--accent); }

/* ---------- trust section ---------- */
.trust { padding: 26px 0 60px; }
.trust h2 { font-size: 1.5rem; letter-spacing: -0.02em; margin: 0 0 20px; }
.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .trust-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .trust-grid { grid-template-columns: 1fr; } }
.card {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 18px 16px;
}
.card h3 { margin: 0 0 8px; font-size: 1.02rem; color: var(--accent); }
.card p { margin: 0; font-size: 0.88rem; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line-soft); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 22px 0; font-size: 0.82rem; color: var(--faint); }
.footer-warn { color: var(--muted); }

::selection { background: rgba(108,140,255,.35); }
