/* CalcDepo FileUtils: modern dark-first theme with a light variant */

:root {
  --bg: #0b1020;
  --bg2: #121a33;
  --card: rgba(255, 255, 255, 0.05);
  --card-h: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.1);
  --text: #e6ebf5;
  --muted: #9aa6c1;
  --accent: #7c5cff;
  --accent2: #22d3ee;
  --err: #f87171;
  --radius: 18px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f7fb;
  --bg2: #ffffff;
  --card: #ffffff;
  --card-h: #eef2ff;
  --line: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #56637c;
  --err: #dc2626;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
.hidden { display: none !important; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 0% -10%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(34, 211, 238, 0.16), transparent 60%),
    var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ext-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-weight: 600; font-size: 0.9rem;
  text-decoration: none; white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.ext-link:hover { border-color: var(--accent2); color: var(--accent2); }

/* Top bar category menu */
.topbar { position: relative; z-index: 20; }
.cat-menu { position: relative; }
.cat-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.cat-menu > summary::-webkit-details-marker { display: none; }
.cat-menu[open] > summary { border-color: var(--accent); }
.cat-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: min(600px, 92vw); max-height: 70vh; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px;
  padding: 10px; border-radius: 16px;
  background: var(--bg2); border: 1px solid var(--line);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
}
.cat-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 0.85rem;
  min-width: 0;
}
.cat-item:hover, .cat-item:focus-visible { background: var(--card-h); outline: none; color: var(--accent2); }
.cat-item .fc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-all {
  grid-column: 1 / -1; justify-content: center;
  margin-bottom: 4px; border: 1px solid var(--line); background: var(--card);
  font-weight: 700; color: var(--accent2);
}
.search {
  flex: 1;
  max-width: 460px;
  margin-left: auto;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---------- deck ---------- */
.viewport { flex: 1; overflow: hidden; position: relative; }
.deck {
  display: flex;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.slide {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto;
  padding: clamp(28px, 4vw, 56px) clamp(20px, 5vw, 80px);
}
.content { max-width: 1200px; margin: 0 auto; }
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent2);
  font-weight: 700;
  margin-bottom: 10px;
}
.big { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -0.02em; margin: 0 0 8px; }
.sub { color: var(--muted); margin: 0; }

/* hero */
.slide.hero { display: flex; align-items: center; }
.hero-inner { max-width: 880px; margin: auto; }
.hero h1 { font-size: clamp(2.6rem, 6.5vw, 5rem); line-height: 1.02; letter-spacing: -0.035em; margin: 0 0 20px; }
.grad {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; line-height: 1.6; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 36px; }
.stats { display: flex; flex-wrap: wrap; gap: 14px; }
.stat {
  display: flex; flex-direction: column;
  padding: 16px 24px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  min-width: 130px;
}
.stat b { font-size: 2.2rem; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 0.9rem; }

/* category tiles */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 28px; }
.cat-tile {
  text-align: left;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  color: inherit;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}
.cat-tile:hover { transform: translateY(-3px); background: var(--card-h); border-color: var(--accent); }
.cat-tile strong { font-size: 1.05rem; }
.cat-tile small { color: var(--muted); }
.ico { font-size: 1.8rem; }
.ico.big { font-size: 3rem; line-height: 1; }

/* category slide */
.cat-head { display: flex; gap: 20px; align-items: center; margin-bottom: 28px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column;
  min-height: 150px;
  text-align: left;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.tool-card:hover, .tool-card:focus-visible {
  transform: translateY(-2px);
  background: var(--card-h);
  border-color: var(--accent);
  box-shadow: 0 12px 30px -12px rgba(124, 92, 255, 0.45);
  outline: none;
}
.tool-card h3 { font-size: 1.02rem; margin: 12px 0 6px; }
.tool-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tc-top { display: flex; justify-content: space-between; align-items: center; }
.num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent2); font-weight: 700; font-size: 0.85rem; }
.badge {
  font-size: 0.68rem; font-weight: 600;
  padding: 3px 9px; border-radius: 99px;
  background: rgba(124, 92, 255, 0.18); color: #a78bfa;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge.star { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.badge.popular { background: rgba(34, 211, 238, 0.16); color: var(--accent2); }
.row-title { font-size: 1.1rem; margin: 28px 0 12px; }
/* Home overview: 3 columns x 4 rows per section */
.pick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Home page: the slider is a fixed-height band; picks scroll below it */
body.home-page { display: block; height: auto; min-height: 100%; overflow-y: auto; }
body.home-page .viewport { flex: none; height: calc(100vh - 152px); min-height: 440px; }
/* Equal top and bottom padding, so every gap between sections is the same (2 x 64px). */
/* One continuous backdrop: soft colour glows fixed behind the whole page,
   so the sections read as a single surface instead of stacked colour bands. */
:root {
  --glow-a: rgba(124, 92, 255, 0.28);   /* violet */
  --glow-b: rgba(34, 211, 238, 0.18);   /* cyan */
  --glow-c: rgba(244, 114, 182, 0.14);  /* pink */
  --band: rgba(255, 255, 255, 0.025);   /* alternate-section surface */
}
[data-theme="light"] {
  --glow-a: rgba(124, 92, 255, 0.16);
  --glow-b: rgba(34, 211, 238, 0.12);
  --glow-c: rgba(244, 114, 182, 0.10);
  --band: rgba(15, 23, 42, 0.03);
}
body.home-page { background: var(--bg); }
body.home-page::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 50% at 8% 0%, var(--glow-a), transparent 70%),
    radial-gradient(50% 45% at 100% 30%, var(--glow-b), transparent 70%),
    radial-gradient(55% 50% at 40% 100%, var(--glow-c), transparent 70%);
}
.home-picks {
  padding: 64px clamp(20px, 5vw, 80px);
  background: transparent;
}
/* Every other section gets a faint surface so the rhythm of the page reads clearly */
.home-picks:nth-of-type(odd) { background: var(--band); }
.home-picks .row-title { margin: 0 0 16px; }
.empty-note { color: var(--muted); margin-top: 24px; }

/* outro */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 28px 0; }
.step { padding: 24px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.step h3 { margin: 12px 0 6px; }
.step p { margin: 0; color: var(--muted); line-height: 1.5; }
.step-n {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 800;
}

/* ---------- controls ---------- */
.progress { height: 3px; background: var(--line); }
.progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.6s;
}
.controls {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px;
}
.dots { display: flex; flex: 1; justify-content: center; flex-wrap: wrap; gap: 8px; }
.dot {
  width: 10px; height: 10px; padding: 0;
  border-radius: 99px; border: 0;
  background: var(--line);
  cursor: pointer;
  transition: width 0.3s, background 0.3s;
}
.dot.active { width: 28px; background: var(--accent); }
.nav-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 1.5rem; line-height: 1;
  cursor: pointer;
}
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.counter { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; min-width: 56px; text-align: right; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  font: inherit; font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  background: transparent;
}
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #5b8cff); color: #fff; border: 0; }
.btn.ghost { background: var(--card); }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }
.btn.wide { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(3, 6, 18, 0.6);
  backdrop-filter: blur(6px);
}
.modal-box {
  position: relative;
  width: min(680px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 22px;
  background: var(--bg2);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.modal-box h2 { margin: 0 0 6px; font-size: 1.6rem; letter-spacing: -0.02em; padding-right: 40px; }
.close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card);
  color: var(--text); font-size: 1.3rem; cursor: pointer;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin-top: 20px; padding: 28px;
  border: 2px dashed var(--line); border-radius: 16px;
  text-align: center; color: var(--muted); cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone strong { color: var(--text); }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over {
  border-color: var(--accent); background: var(--card-h); outline: none;
}
.file-meta { font-size: 0.85rem; color: var(--muted); margin-top: 10px; min-height: 1em; }
.file-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; max-height: 180px; overflow-y: auto; }
.file-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--card);
  font-size: 0.9rem;
}
.file-list small { color: var(--muted); }
.x {
  border: 0; background: transparent; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; padding: 0 4px;
}
.fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.params {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin: 18px 0;
}
.params:empty { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.field input, .field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
}

.results { margin-top: 16px; display: grid; gap: 10px; }
.results:empty { display: none; }
.result {
  padding: 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
}
.res-head { display: flex; align-items: center; gap: 10px; }
.res-head small { color: var(--muted); }
.result pre {
  margin: 12px 0 0;
  padding: 12px;
  max-height: 220px; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.82rem;
}
[data-theme="light"] .result pre { background: #f1f5f9; }
.msg { padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.msg.error { color: var(--err); border-color: var(--err); }
.all { justify-self: start; }

/* ---------- site footer ---------- */
.site-footer {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px 24px;
  padding: 18px 24px;
  background: var(--bg2);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.foot-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.foot-brand .brand { font-size: 1rem; }
.foot-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 0.75rem; font-weight: 600; color: var(--muted);
}
.foot-pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent2); box-shadow: 0 0 8px var(--accent2);
}
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.foot-links a { color: var(--muted); text-decoration: none; transition: color 0.2s; }
.foot-links a:hover { color: var(--accent2); }
.foot-copy { opacity: 0.8; }

/* Tool page: one tool per page, with related tools below */
body.tool-page { display: block; height: auto; min-height: 100%; overflow-y: auto; }
.tool-page .topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); }
.tool-page .brand { color: inherit; text-decoration: none; }
.tool-page .all-link { color: var(--accent2); text-decoration: none; font-weight: 600; white-space: nowrap; margin-left: auto; }
.tool-page .modal { position: static; display: block; padding: 0; background: none; backdrop-filter: none; }
.tool-page .modal-box { width: 100%; max-height: none; overflow: visible; }
.tool-page .close { display: none; }
.tool-main { max-width: 760px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 24px; }
.related-section { max-width: 1100px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 56px; }

/* Tool explanation (runner modal) */
.explain {
  display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px;
  margin: 16px 0 18px; padding: 14px 16px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  font-size: 0.9rem;
}
.explain dt { color: var(--accent2); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding-top: 2px; }
.explain dd { margin: 0; line-height: 1.5; }
@media (max-width: 480px) {
  .explain { grid-template-columns: 1fr; gap: 2px; }
  .explain dt { margin-top: 8px; }
}

/* Category footer (home page) */
.site-footer--cats { display: block; padding: 64px clamp(20px, 5vw, 80px) 22px; }
.foot-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.foot-tag { margin: 0; color: var(--muted); }
.foot-cats-head { display: flex; align-items: baseline; gap: 12px; margin: 28px 0 14px; }
.foot-cats-head h4 { margin: 0; font-size: 0.95rem; color: var(--text); letter-spacing: -0.01em; }
.foot-count { font-size: 0.78rem; color: var(--accent2); font-weight: 600; }
.foot-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.foot-cat {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; min-width: 0;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--text);
  text-decoration: none; font-size: 0.85rem;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.foot-cat:hover { border-color: var(--accent); background: var(--card-h); transform: translateY(-1px); }
.foot-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fc-ico { flex: none; width: 1.4em; text-align: center; }
.fc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-count {
  flex: none; padding: 1px 7px; border-radius: 99px;
  background: rgba(124, 92, 255, 0.14); color: var(--accent);
  font-size: 0.72rem; font-weight: 700;
}
.foot-bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px;
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 0.85rem; color: var(--muted);
}
.foot-all { color: var(--accent2); text-decoration: none; font-weight: 600; }
.foot-all:hover { text-decoration: underline; }

/* ---------- responsive & motion ---------- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .search { order: 3; max-width: none; width: 100%; margin-left: 0; }
  .controls { padding: 10px 12px; gap: 8px; }
  .counter { display: none; }
  .cat-head { flex-direction: column; align-items: flex-start; }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.home-page .viewport { height: calc(100vh - 190px); }
}
@media (max-width: 480px) {
  .pick-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
