/*
 * ZK Futures - the server-rendered pages (guides, legal pages) in the trading terminal's look: the same dark oklch tokens as
 * the terminal (BS.ZKExchange.App/styles.css), Inter for text, Orbitron for the brand, Fira Code for labels. The guide pages
 * add BS.Web.Blog's bs-article.css (themed through --bs-article-*) and bs-index.css (the card grid).
 */

:root {
  --zf-bg: oklch(0.16 0.022 275);
  --zf-surface: oklch(0.21 0.028 277);
  --zf-surface-2: oklch(0.26 0.033 279);
  --zf-fg: oklch(0.96 0.006 275);
  --zf-muted: oklch(0.72 0.03 277);
  --zf-border: oklch(0.32 0.04 282);
  --zf-primary: oklch(0.62 0.24 288);
  --zf-primary-soft: oklch(0.8 0.13 290);
  --zf-long: oklch(0.85 0.24 145);
  --zf-warning: oklch(0.82 0.17 85);
  --zf-radius: 1rem;
  --zf-maxw: 80rem;
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Orbitron", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Fira Code", ui-monospace, monospace;
  color-scheme: dark;

  /* The article page (bs-article.css) in the terminal's colours. */
  --bs-article-measure: 44rem;
  --bs-article-bg: var(--zf-bg);
  --bs-article-ink: oklch(0.9 0.012 275);
  --bs-article-muted: var(--zf-muted);
  --bs-article-accent: var(--zf-primary-soft);
  --bs-article-accent-ink: oklch(0.16 0.022 275);
  --bs-article-heading: var(--zf-fg);
  --bs-article-surface: var(--zf-surface);
  --bs-article-border: var(--zf-border);
  --bs-article-shadow: #000;
  --bs-article-focus: var(--zf-primary-soft);
  --bs-article-radius: 1rem;
  --bs-article-font: var(--font-sans);
  --bs-article-font-display: var(--font-sans);
  --bs-article-cta-bg: linear-gradient(135deg, oklch(0.3 0.12 288) 0%, oklch(0.21 0.05 280) 70%);
  --bs-article-scroll-margin: 5.5rem;

  /* The overview's card grid (bs-index.css). */
  --bs-cards-min: 18rem;
  --bs-cards-gap: 1.5rem;
}

/* The overview grows past the column on wide screens (nav and footer with it, so their edges stay in line): five cards a row at 2560 px. */
.zf-wide {
  --zf-maxw: clamp(80rem, 100vw - 16rem, 112rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--zf-bg);
  color: var(--zf-fg);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

/* The terminal's grid backdrop, fading out from the top. */
.zf-mesh {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(to right, color-mix(in oklch, var(--zf-primary) 30%, transparent) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(to bottom, color-mix(in oklch, var(--zf-primary) 30%, transparent) 0 1px, transparent 1px 48px);
  opacity: 0.1;
  mask-image: radial-gradient(ellipse at 50% 0%, black, transparent 70%);
}

.zf-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.zf-shell > main {
  flex: 1;
}

.zf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Nav ---------- */

.zf-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid color-mix(in oklch, var(--zf-border) 80%, transparent);
  background: color-mix(in oklch, var(--zf-surface) 70%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
}

.zf-nav__inner {
  display: flex;
  align-items: center;
  gap: 1rem 1.5rem;
  max-width: var(--zf-maxw);
  margin-inline: auto;
  padding: 0.75rem 1.25rem;
}

.zf-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.zf-brand__mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  border: 1px solid color-mix(in oklch, var(--zf-primary) 55%, transparent);
  background: color-mix(in oklch, var(--zf-primary) 18%, transparent);
  color: var(--zf-primary-soft);
  box-shadow: 0 0 26px color-mix(in oklch, var(--zf-primary) 40%, transparent);
}

.zf-brand__mark svg {
  width: 1.1rem;
  height: 1.1rem;
}

.zf-brand__name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.zf-badge {
  border: 1px solid color-mix(in oklch, var(--zf-warning) 55%, transparent);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  color: var(--zf-warning);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.zf-nav__links {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.zf-nav__link {
  border-radius: 0.6rem;
  padding: 0.4rem 0.75rem;
  color: var(--zf-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.zf-nav__link:hover,
.zf-nav__link.active {
  background: color-mix(in oklch, var(--zf-primary) 15%, transparent);
  color: var(--zf-primary-soft);
}

.zf-nav__link:focus-visible,
.zf-btn:focus-visible,
.zf-brand:focus-visible,
.zf-footer a:focus-visible {
  outline: 2px solid var(--zf-primary-soft);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */

.zf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--zf-border);
  border-radius: 0.75rem;
  background: color-mix(in oklch, var(--zf-surface-2) 70%, transparent);
  padding: 0.55rem 1rem;
  color: var(--zf-fg);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.zf-btn:hover {
  border-color: color-mix(in oklch, var(--zf-primary) 70%, transparent);
}

.zf-btn--primary {
  border-color: var(--zf-primary);
  background: var(--zf-primary);
  color: #fff;
  box-shadow: 0 0 24px color-mix(in oklch, var(--zf-primary) 45%, transparent);
}

.zf-btn--primary:hover {
  background: color-mix(in oklch, var(--zf-primary) 85%, #fff);
}

/* ---------- Sections and type ---------- */

.zf-section {
  width: 100%;
  max-width: var(--zf-maxw);
  margin-inline: auto;
  padding: 2.5rem 1.25rem 4rem;
}

.zf-eyebrow {
  margin: 0 0 0.75rem;
  color: var(--zf-primary-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.zf-h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.zf-lede {
  max-width: 48rem;
  margin: 1rem 0 0;
  color: var(--zf-muted);
  font-size: 1.0625rem;
}

.zf-muted {
  color: var(--zf-muted);
}

.zf-mono-muted {
  color: var(--zf-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.zf-note {
  border: 1px solid color-mix(in oklch, var(--zf-warning) 45%, transparent);
  border-radius: 0.75rem;
  background: color-mix(in oklch, var(--zf-warning) 10%, transparent);
  padding: 0.75rem 1rem;
  color: color-mix(in oklch, var(--zf-warning) 70%, var(--zf-fg));
}

/* ---------- Guide overview ---------- */

.zf-guides-head {
  animation: zf-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.zf-guides-back {
  display: inline-block;
  margin-top: 2rem;
  color: var(--zf-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.zf-guides-back:hover {
  color: var(--zf-primary-soft);
}

.zf-guides {
  margin: 2.5rem 0 0;
}

.zf-guides li {
  animation: zf-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.zf-guides li:nth-child(2) { animation-delay: 60ms; }
.zf-guides li:nth-child(3) { animation-delay: 120ms; }
.zf-guides li:nth-child(4) { animation-delay: 180ms; }
.zf-guides li:nth-child(5) { animation-delay: 240ms; }
.zf-guides li:nth-child(6) { animation-delay: 300ms; }
.zf-guides li:nth-child(7) { animation-delay: 360ms; }
.zf-guides li:nth-child(8) { animation-delay: 420ms; }
.zf-guides li:nth-child(9) { animation-delay: 480ms; }
.zf-guides li:nth-child(10) { animation-delay: 540ms; }
.zf-guides li:nth-child(n + 11) { animation-delay: 600ms; }

.zf-guides a {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid color-mix(in oklch, var(--zf-border) 85%, transparent);
  border-radius: var(--zf-radius);
  background: color-mix(in oklch, var(--zf-surface) 80%, transparent);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Hover and keyboard focus: the card lifts with a soft violet glow and its picture zooms. */
.zf-guides a:is(:hover, :focus-visible) {
  border-color: color-mix(in oklch, var(--zf-primary) 70%, transparent);
  transform: translateY(-4px);
  box-shadow:
    0 0 0 1px color-mix(in oklch, var(--zf-primary) 30%, transparent),
    0 18px 44px -18px color-mix(in oklch, var(--zf-primary) 70%, transparent);
}

.zf-guides a:focus-visible {
  outline: 2px solid var(--zf-primary-soft);
  outline-offset: 3px;
}

.zf-guide__cover {
  display: block;
  aspect-ratio: 1200 / 672;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in oklch, var(--zf-border) 85%, transparent);
  background: var(--zf-surface-2);
}

.zf-guide__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.zf-guides a:is(:hover, :focus-visible) .zf-guide__cover img {
  transform: scale(1.04);
}

.zf-guide__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 1.25rem 1.25rem;
}

.zf-guide__text strong {
  font-size: 1.0625rem;
  line-height: 1.35;
}

.zf-guide__text .zf-muted {
  font-size: 0.9rem;
}

.zf-guide__more {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--zf-primary-soft);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* The link to the next page: under the cards, its own spacing (the script removes it after the last page). */
.zf-guides-more {
  display: flex;
  width: fit-content;
  margin: 3rem auto 0;
}

.zf-empty {
  margin-top: 2rem;
}

@keyframes zf-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- A guide (bs-article.css in the terminal's look) ---------- */

.zf-guide {
  padding-block: 2.5rem 4rem;
}

.zf-guide .bs-article-eyebrow {
  border: 1px solid color-mix(in oklch, var(--zf-primary) 45%, transparent);
  background: color-mix(in oklch, var(--zf-primary) 12%, transparent);
  color: var(--zf-primary-soft);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.zf-guide .bs-article-header h1 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.zf-guide .bs-article-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.zf-guide .bs-article-meta svg {
  width: 1rem;
  height: 1rem;
}

.zf-guide .bs-article-toc h2 {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.zf-guide .bs-article-closing {
  box-shadow:
    inset 0 0 0 1px var(--zf-border),
    inset 0 3px 0 var(--zf-primary);
}

/* The call to action sits on a dark violet gradient: light text there (the accent ink stays dark for the step numbers). */
.zf-guide .bs-article-cta {
  --bs-article-accent-ink: var(--zf-fg);
  border: 1px solid color-mix(in oklch, var(--zf-primary) 40%, transparent);
  box-shadow: 0 24px 60px -30px color-mix(in oklch, var(--zf-primary) 70%, transparent);
}

.zf-guide .bs-article-cta .zf-guide-cta__label {
  margin: 0 0 1rem;
  color: var(--zf-warning);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.zf-guide-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.zf-guide .bs-article-cta .zf-btn {
  text-decoration: none;
}

.zf-guide .bs-article-share a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Legal pages ---------- */

.zf-legal {
  max-width: 50rem;
}

.zf-legal section {
  margin-top: 2rem;
}

.zf-legal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}

.zf-legal h3 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1rem;
}

.zf-legal p {
  margin: 0.5rem 0 0;
  color: color-mix(in oklch, var(--zf-fg) 85%, var(--zf-muted));
}

.zf-legal a {
  color: var(--zf-primary-soft);
}

.zf-legal .zf-note {
  margin-top: 1.5rem;
}

.zf-legal__german {
  margin-top: 3.5rem;
  border-top: 1px solid var(--zf-border);
  padding-top: 2rem;
}

/* ---------- Footer ---------- */

.zf-footer {
  border-top: 1px solid color-mix(in oklch, var(--zf-border) 80%, transparent);
  background: color-mix(in oklch, var(--zf-surface) 55%, transparent);
}

.zf-footer__inner {
  display: grid;
  gap: 0.75rem;
  max-width: var(--zf-maxw);
  margin-inline: auto;
  padding: 2rem 1.25rem 2.5rem;
  color: var(--zf-muted);
  font-size: 0.875rem;
}

.zf-footer__note {
  max-width: 52rem;
  margin: 0;
}

.zf-footer__note strong {
  color: var(--zf-warning);
}

.zf-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}

.zf-footer__links a {
  color: var(--zf-fg);
  font-weight: 600;
  text-decoration: none;
}

.zf-footer__links a:hover {
  color: var(--zf-primary-soft);
}

.zf-footer__legal {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* ---------- Small screens ---------- */

@media (max-width: 47.99rem) {
  .zf-nav__inner {
    flex-wrap: wrap;
    gap: 0.6rem 0.75rem;
    padding: 0.6rem 1rem;
  }

  .zf-nav__cta {
    display: none;
  }

  .zf-nav__links {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .zf-section {
    padding: 2rem 1rem 3rem;
  }

  .zf-guides {
    margin-top: 2rem;
  }
}

@media (min-width: 48rem) {
  .zf-guide {
    padding-block: 3.5rem 6rem;
  }
}

/* ---------- Reduced motion: colours change, nothing moves ---------- */

@media (prefers-reduced-motion: reduce) {
  .zf-guides-head,
  .zf-guides li {
    animation: none;
  }

  .zf-guides a,
  .zf-guide__cover img {
    transition: none;
  }

  .zf-guides a:is(:hover, :focus-visible),
  .zf-guides a:is(:hover, :focus-visible) .zf-guide__cover img {
    transform: none;
  }
}
