/* handout.css — screen + mobile-first responsive theme for Virtus
 * Cyber Academy handouts. Inherits Geist faces and palette tokens
 * from /css/style.css; overrides where the handout register needs
 * a wider reading column, sticky download bar on mobile, and a
 * tightened code-block treatment.
 *
 * License: (c) 2026 Virtus Cyber Academy; license TBD.
 */

/* ----- palette tokens (mirror /css/style.css; redeclared here so
 * print stylesheet can override them without touching globals) -- */
:root {
  --va-bg: #0a0a0a;
  --va-bg-card: #151515;
  --va-bg-code: #0e0f12;
  --va-fg: #e5e7eb;
  --va-fg-muted: #9ca3af;
  --va-fg-dim: #6b7280;
  --va-green: #4ade80;
  --va-green-dark: #22c55e;
  --va-amber: #fbbf24;
  --va-amber-dark: #f59e0b;
  --va-border: #1f2937;
  --va-border-soft: rgba(156, 163, 175, 0.18);
  --va-link: var(--va-green);
  --va-link-hover: var(--va-amber);
  --va-mono: ui-monospace, "Geist Mono", "JetBrains Mono", "SFMono-Regular",
              Menlo, Consolas, monospace;
  --va-sans: "Geist Sans", system-ui, -apple-system, "Segoe UI", Roboto,
              "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--va-bg);
  color: var(--va-fg);
  font-family: var(--va-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ----- header ------------------------------------------------- */

.va-handout-header {
  border-bottom: 1px solid var(--va-border);
  padding: 1.25rem 1.5rem 1.5rem;
  max-width: 80ch;
  margin: 0 auto;
}

.va-handout-home {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--va-fg-muted);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.5rem 0;
  min-height: 44px; /* touch target */
}
.va-handout-home:hover,
.va-handout-home:focus-visible {
  color: var(--va-amber);
}
.va-handout-home-arrow { font-size: 1rem; }

.va-handout-title {
  margin: 1rem 0 0.5rem;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem);
  line-height: 1.25;
  color: var(--va-fg);
  font-weight: 700;
}

.va-handout-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  color: var(--va-fg-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.va-handout-track {
  background: var(--va-green-muted, rgba(74,222,128,0.12));
  color: var(--va-green);
  border: 1px solid rgba(74,222,128,0.4);
  border-radius: 3px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* ----- download buttons -------------------------------------- */

.va-handout-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.va-handout-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--va-bg-card);
  border: 1px solid var(--va-amber);
  color: var(--va-amber);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
}
.va-handout-dl-btn:hover,
.va-handout-dl-btn:focus-visible {
  background: var(--va-amber);
  color: #0a0a0a;
  border-color: var(--va-amber-dark);
  outline: none;
}
.va-handout-dl-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ----- body --------------------------------------------------- */

.va-handout-body {
  max-width: 70ch;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.va-handout-body > h1,
.va-handout-body > h2,
.va-handout-body > h3,
.va-handout-body > h4 {
  color: var(--va-fg);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.va-handout-body > h1 {
  font-size: 1.7rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--va-border);
}
.va-handout-body > h2 {
  font-size: 1.4rem;
  margin: 2.25rem 0 0.85rem;
  color: var(--va-amber);
}
.va-handout-body > h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.65rem;
  color: var(--va-green);
}
.va-handout-body > h4 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--va-fg-muted);
}

.va-handout-body p {
  margin: 0.75rem 0;
}

.va-handout-body a {
  color: var(--va-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.va-handout-body a:hover,
.va-handout-body a:focus-visible {
  color: var(--va-link-hover);
}

.va-handout-body strong { color: var(--va-fg); font-weight: 600; }
.va-handout-body em { color: var(--va-fg); }

/* lists */
.va-handout-body ul,
.va-handout-body ol {
  margin: 0.75rem 0;
  padding-left: 1.4rem;
}
.va-handout-body li {
  margin: 0.35rem 0;
}
.va-handout-body li > ul,
.va-handout-body li > ol {
  margin: 0.25rem 0;
}

/* blockquotes */
.va-handout-body blockquote {
  border-left: 3px solid var(--va-amber);
  padding: 0.6rem 1rem;
  margin: 1rem 0;
  background: rgba(251,191,36,0.06);
  color: var(--va-fg);
}
.va-handout-body blockquote p { margin: 0.4rem 0; }

/* horizontal rules */
.va-handout-body hr {
  border: 0;
  border-top: 1px solid var(--va-border);
  margin: 2.5rem 0;
}

/* inline code */
.va-handout-body code {
  font-family: var(--va-mono);
  font-size: 0.9em;
  background: var(--va-bg-code);
  border: 1px solid var(--va-border);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: var(--va-amber);
  word-break: break-word;
}

/* fenced code blocks */
.va-handout-body pre {
  background: var(--va-bg-code);
  border: 1px solid var(--va-border);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 1rem 0;
}
.va-handout-body pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--va-fg);
  font-size: inherit;
  word-break: normal;
}

/* Pygments syntax-highlighter classes (default monokai-ish dark) */
.codehilite { background: var(--va-bg-code); }
.codehilite .k, .codehilite .kn, .codehilite .kd, .codehilite .kr { color: #c792ea; }   /* keyword */
.codehilite .nb { color: #82aaff; }   /* builtin */
.codehilite .nf, .codehilite .nc { color: #82aaff; }   /* func / class name */
.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sb { color: #c3e88d; } /* string */
.codehilite .mi, .codehilite .mf, .codehilite .il { color: #f78c6c; }   /* number */
.codehilite .c, .codehilite .c1, .codehilite .cm { color: #6b7280; font-style: italic; }
.codehilite .o { color: #89ddff; }   /* operator */
.codehilite .nv { color: #f07178; }
.codehilite .nt { color: #f78c6c; }   /* tag */
.codehilite .err { color: #ff5370; }

/* tables */
.va-handout-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.92rem;
  overflow-x: auto;
  display: block;
}
.va-handout-body table thead {
  background: var(--va-bg-card);
}
.va-handout-body table th {
  text-align: left;
  font-weight: 600;
  color: var(--va-amber);
  border-bottom: 2px solid var(--va-border);
  padding: 0.55rem 0.7rem;
  white-space: nowrap;
}
.va-handout-body table td {
  border-bottom: 1px solid var(--va-border);
  padding: 0.5rem 0.7rem;
  vertical-align: top;
}
.va-handout-body table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.015);
}

/* footnotes (mdit_py_plugins.footnote) */
.va-handout-body .footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--va-border);
  font-size: 0.9rem;
  color: var(--va-fg-muted);
}
.va-handout-body .footnotes ol { padding-left: 1.4rem; }
.va-handout-body .footnotes li { margin: 0.5rem 0; }

/* task lists */
.va-handout-body .task-list-item {
  list-style: none;
  margin-left: -1.4rem;
  padding-left: 0.4rem;
}
.va-handout-body .task-list-item input[type="checkbox"] {
  margin-right: 0.45rem;
  accent-color: var(--va-green);
}

/* images */
.va-handout-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--va-border);
  border-radius: 4px;
}

/* ----- footer ------------------------------------------------- */

.va-handout-footer {
  max-width: 80ch;
  margin: 4rem auto 0;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--va-border);
  color: var(--va-fg-muted);
  font-size: 0.85rem;
}
.va-handout-footer nav a {
  color: var(--va-link);
  text-decoration: none;
  padding: 0.4rem 0.2rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.va-handout-footer nav a:hover,
.va-handout-footer nav a:focus-visible {
  color: var(--va-amber);
  text-decoration: underline;
}
.va-handout-license {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--va-fg-dim);
}

/* ----- mobile ------------------------------------------------- */

@media (max-width: 640px) {
  body { font-size: 1rem; }

  .va-handout-header {
    padding: 1rem 1rem 1.25rem;
  }
  .va-handout-body {
    padding: 1.5rem 1rem 3rem;
  }
  .va-handout-footer {
    padding: 1.5rem 1rem 2rem;
  }

  .va-handout-body > h1 { font-size: 1.4rem; margin-top: 1.75rem; }
  .va-handout-body > h2 { font-size: 1.2rem; margin-top: 1.6rem; }
  .va-handout-body > h3 { font-size: 1.05rem; }

  /* Sticky-bottom downloads on mobile so they're always reachable */
  .va-handout-downloads {
    position: sticky;
    bottom: 0.75rem;
    z-index: 10;
    margin-top: 1.25rem;
    padding: 0.6rem;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid var(--va-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  }
  .va-handout-dl-btn { flex: 1 1 auto; justify-content: center; }
}

/* ----- focus-visible accessibility --------------------------- */

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--va-amber);
  outline-offset: 2px;
}
