/* Face the Bitcoin: the filter studio, in the colours of the main page */

:root {
  --bg: #04050a;
  --bg-2: #0a0d16;
  --fg: #eef1f7;
  --fg-2: #b9c0cf;
  --muted: #7d869a;
  --orange: #f7931a;
  --orange-2: #ffb648;
  --orange-glow: rgba(247, 147, 26, 0.45);
  --cyan: #4de3ff;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --glass: rgba(10, 13, 22, 0.6);

  --f-display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --pad-x: clamp(16px, 5vw, 72px);
  --cut: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
.mono { font-family: var(--f-mono); }
::selection { background: var(--orange); color: #000; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
[hidden] { display: none !important; }

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vmax 40vmax at 85% 10%, rgba(247, 147, 26, 0.14), transparent 60%),
    radial-gradient(50vmax 40vmax at 0% 100%, rgba(77, 227, 255, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px var(--pad-x);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; filter: drop-shadow(0 0 10px var(--orange-glow)); }
.brand-text { font-family: var(--f-display); font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.brand-text b, .brand-text span { color: var(--orange); font-weight: inherit; }
.top-right { display: flex; align-items: center; gap: 10px; }
/* language dropdown, as on the main page */
.lang { position: relative; }
.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px 8px 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--glass);
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s;
}
.lang-current:hover, .lang.is-open .lang-current { border-color: var(--orange); }
.lang-current svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform 0.2s; }
.lang.is-open .lang-current svg { transform: rotate(180deg); }
.lang-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 5px;
  list-style: none;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: rgba(10, 13, 22, 0.96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0s linear 0.2s;
}
.lang.is-open .lang-list { opacity: 1; visibility: visible; transform: none; transition: opacity 0.2s, transform 0.2s; }
.lang-list button {
  width: 100%;
  min-width: 52px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  cursor: pointer;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.lang-list button:hover, .lang-list button:focus-visible { color: var(--fg); background: rgba(255, 255, 255, 0.07); }
.lang-list button[aria-pressed="true"] { background: var(--orange); color: #0b0600; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--line-2);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn-primary { background: var(--orange); border-color: var(--orange); color: #140a00; box-shadow: 0 0 24px var(--orange-glow); }
.btn-primary:hover { background: var(--orange-2); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-2); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.back { min-height: 36px; padding: 6px 14px; font-size: 11px; }

/* ---------- layout ---------- */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  grid-template-areas: "intro intro" "viewer panel";
  gap: 22px 36px;
  padding: 10px var(--pad-x) 40px;
  max-width: 1320px;
  margin: 0 auto;
}
.intro { grid-area: intro; max-width: 760px; }
.kicker { color: var(--orange); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
h1 {
  margin: 6px 0 8px;
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
h1 em { font-style: normal; color: var(--orange); text-shadow: 0 0 30px var(--orange-glow); }
.lead { color: var(--fg-2); max-width: 60ch; }

/* ---------- viewer ---------- */

.viewer-wrap { grid-area: viewer; min-width: 0; }
.viewer {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}
.viewer.has-image { aspect-ratio: auto; background: #000; }
.viewer canvas { display: none; max-width: 100%; max-height: 78vh; width: auto; height: auto; }
.viewer.has-image canvas { display: block; }
.viewer-empty { display: grid; justify-items: center; gap: 12px; color: var(--muted); text-align: center; padding: 20px; }
.viewer-empty svg { width: 76px; height: 76px; color: var(--orange); opacity: 0.7; }
.viewer-status {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  padding: 8px 14px;
  background: rgba(4, 5, 10, 0.82);
  border: 1px solid var(--line-2);
  color: var(--fg);
  font-size: 13px;
  text-align: center;
}

/* ---------- panel ---------- */

.panel { grid-area: panel; display: grid; gap: 14px; align-content: start; }
.step {
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(10px);
}
.step-title {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 12px;
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.step-title .mono { color: var(--orange); font-size: 11px; }
.source { display: flex; flex-wrap: wrap; gap: 8px; }
.source .btn { flex: 1 1 auto; }

.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.filter, .coin-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.filter i, .coin-toggle i {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(247, 147, 26, 0.12);
  color: var(--orange-2);
  font-style: normal;
  font-size: 14px;
  letter-spacing: -0.12em;
}
.filter:hover, .coin-toggle:hover { border-color: var(--orange); }
.filter[aria-pressed="true"], .coin-toggle[aria-pressed="true"] {
  border-color: var(--orange);
  background: rgba(247, 147, 26, 0.14);
  box-shadow: inset 0 0 0 1px var(--orange), 0 0 18px rgba(247, 147, 26, 0.18);
}
.filter[aria-pressed="true"] i, .coin-toggle[aria-pressed="true"] i { background: var(--orange); color: #140a00; }
.coin-toggle { width: 100%; margin-top: 8px; }
.coin-toggle i { font-family: var(--f-display); font-weight: 700; font-size: 15px; letter-spacing: 0; }
.coin-toggle b { display: block; font-weight: 600; }
.coin-toggle small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.link-btn {
  margin-top: 10px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--orange-2); }
.privacy { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* ---------- toast, footer ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  background: var(--orange);
  color: #140a00;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.foot { padding: 10px var(--pad-x) 26px; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .studio { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "viewer" "panel"; gap: 16px; }
  .viewer canvas { max-height: 70vh; }
  .back span[data-t] { display: none; }
}
@media (max-width: 420px) {
  .brand-text { font-size: 12px; }
  .filters { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
