/* Campus Ransomware Playbook — CrimRxiv Consortium
   Strict brand palette: shades of black / gray / white plus CrimRxiv orange #f68212.
   MIT-licensed code; content CC BY 4.0
*/

:root {
  /* CrimRxiv brand orange + supporting grayscale shades.
     Legacy tokens (--brand-brown / --brand-red / --brand-mint / --brand-rose)
     are kept as aliases so all existing rules continue to work. */
  --brand-orange: #f68212;
  --brand-orange-deep: #c4660a;  /* darker shade for hover/contrast on light bg */
  --brand-orange-soft: #f4f4f4;  /* neutral gray — strict palette, no warm tint */

  --brand-brown: var(--brand-orange);  /* alias — was warm brown */
  --brand-red:   #1a1a1a;              /* alias — was deep red; now near-black for severity */
  --brand-mint:  var(--brand-orange);  /* alias — was mint */
  --brand-rose:  #d9d9d9;              /* alias — was rose; now light gray */

  /* Light theme tokens */
  --bg:           #ffffff;
  --bg-elev:      #ffffff;
  --bg-soft:      #f4f4f4;
  --fg:           #111111;
  --fg-muted:     #555555;
  --border:       #d9d9d9;
  --accent:       var(--brand-orange);
  --accent-fg:    #111111;
  --danger:       #1a1a1a;
  --success:      #2a2a2a;
  --warn:         var(--brand-orange-deep);
  --link:         var(--brand-orange);
  --focus:        #111111;
  --shadow:       0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);

  --radius: 10px;
  --radius-sm: 6px;
  --maxw: 72rem;
  --readw: 44rem;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg:           #0d0d0d;
  --bg-elev:      #1a1a1a;
  --bg-soft:      #232323;
  --fg:           #f5f5f5;
  --fg-muted:     #b3b3b3;
  --border:       #333333;
  --accent:       var(--brand-orange);
  --accent-fg:    #0d0d0d;
  --danger:       #f5f5f5;
  --success:      #d6d6d6;
  --warn:         var(--brand-orange);
  --link:         var(--brand-orange);
  --focus:        var(--brand-orange);
  --shadow:       0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg:           #0d0d0d;
    --bg-elev:      #1a1a1a;
    --bg-soft:      #232323;
    --fg:           #f5f5f5;
    --fg-muted:     #b3b3b3;
    --border:       #333333;
    --accent:       var(--brand-orange);
    --accent-fg:    #0d0d0d;
    --danger:       #f5f5f5;
    --success:      #d6d6d6;
    --warn:         var(--brand-orange);
    --link:         var(--brand-orange);
    --focus:        var(--brand-orange);
    --shadow:       0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.5);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.5rem 1rem;
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* Focus styles */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.25;
  margin: 1.6em 0 0.6em;
  color: var(--fg);
  font-weight: 700;
}
h1 { font-size: 2.1rem; margin-top: 0.4em; }
h2 { font-size: 1.55rem; border-bottom: 2px solid var(--border); padding-bottom: 0.3em; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }

p, ul, ol { margin: 0.6em 0 1em; }
ul, ol { padding-left: 1.5em; }
li { margin: 0.3em 0; }

code, kbd { font-family: var(--font-mono); font-size: 0.92em; background: var(--bg-soft); padding: 0.1em 0.35em; border-radius: 4px; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Layout */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.read {
  /* No width constraint — body text spans the full container width to match
     the hero. (Previously narrowed to a 44rem reading measure which left the
     right half of the page empty on short content.) */
}

/* Header */
.site-header {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(6px);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--fg);
  font-weight: 700;
  font-family: var(--font-serif);
}
.brand .mark {
  width: 30px; height: 30px;
  background: var(--brand-brown);
  color: white;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 900;
  font-size: 0.9rem;
}
html[data-theme="dark"] .brand .mark { background: var(--brand-orange); color: #0d0d0d; }
.brand .title { font-size: 1.05rem; }
.brand .sub { color: var(--fg-muted); font-weight: 500; font-size: 0.85rem; font-family: var(--font-sans); display: block; }

nav.primary { margin-left: auto; }
nav.primary ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
nav.primary a {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
}
nav.primary a:hover, nav.primary a[aria-current="page"] {
  background: var(--bg-soft);
  color: var(--fg);
}
nav.primary a.emergency {
  background: var(--brand-red);
  color: #fff;
  font-weight: 600;
}
nav.primary a.emergency:hover { background: #0d0d0d; }

.theme-toggle, .menu-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
}
.theme-toggle:hover, .menu-toggle:hover { background: var(--bg-soft); }
.menu-toggle { display: none; }

@media (max-width: 820px) {
  .menu-toggle { display: inline-block; margin-left: auto; }
  nav.primary { width: 100%; display: none; }
  nav.primary[data-open="true"] { display: block; }
  nav.primary ul { flex-direction: column; align-items: stretch; }
  nav.primary a { display: block; }
}

/* Main content */
main { padding: 2rem 0 4rem; }
main.read-section { padding-top: 1.5rem; }

/* Hero */
.hero {
  padding: 3rem 0 2rem;
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: 2.6rem; margin-top: 0; }
.hero .lead {
  font-size: 1.2rem;
  color: var(--fg-muted);
}
.hero .cta {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
}
.btn:hover { filter: brightness(0.92); text-decoration: none; }
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-soft); }
.btn-danger { background: var(--brand-red); color: #fff; }
.btn-danger:hover { background: #0d0d0d; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.9rem; }

/* Cards & grids */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card .meta { color: var(--fg-muted); font-size: 0.9rem; }

/* Role tiles (home selector) */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.role-tile {
  display: block;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.1rem;
  text-decoration: none;
  color: var(--fg);
  transition: transform 80ms ease, border-color 120ms;
  position: relative;
}
.role-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  text-decoration: none;
}
.role-tile .icon {
  font-size: 1.6rem;
  display: inline-block;
  margin-bottom: 0.4rem;
}
.role-tile h3 {
  margin: 0 0 0.3rem; font-size: 1.1rem;
}
.role-tile p { margin: 0; color: var(--fg-muted); font-size: 0.95rem; }
.role-tile.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Phase pills */
.phases {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin: 1rem 0;
}
.phases a {
  background: var(--bg-soft);
  color: var(--fg);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}
.phases a:hover { border-color: var(--accent); }

/* Alerts */
.alert {
  border-left: 4px solid var(--accent);
  background: var(--bg-soft);
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
}
.alert.danger { border-left-color: var(--danger); }
.alert.warn   { border-left-color: var(--warn); }
.alert.success{ border-left-color: var(--success); }
.alert h4 { margin: 0 0 0.3rem; }
.alert p:last-child { margin-bottom: 0; }

/* Checklist component */
.checklist {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
.checklist h3 { margin-top: 0.2rem; }
.checklist .progress {
  height: 8px;
  background: var(--bg-soft);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0 1rem;
}
.checklist .progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 200ms ease;
}
.checklist ul { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: flex;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
  align-items: flex-start;
}
.checklist li:first-child { border-top: 0; }
.checklist input[type="checkbox"] {
  margin-top: 0.3em;
  width: 18px; height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.checklist label { cursor: pointer; flex: 1; }
.checklist li.done label { color: var(--fg-muted); text-decoration: line-through; }
.checklist .actions { margin-top: 0.7rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.badge-earned {
  display: inline-block;
  background: var(--success);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

/* Decision tree */
.decision {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1rem 0;
}
.decision .question { font-weight: 600; font-size: 1.1rem; margin-bottom: 0.6rem; }
.decision .choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.decision .choices button {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--fg);
  font: inherit;
}
.decision .choices button:hover { border-color: var(--accent); }
.decision .result {
  margin-top: 0.8rem;
  padding: 0.8rem 1rem;
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}
.decision .breadcrumbs {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

/* Quiz */
.quiz {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1rem 0;
}
.quiz .question { font-weight: 600; margin-bottom: 0.6rem; }
.quiz .options { display: flex; flex-direction: column; gap: 0.5rem; }
.quiz .options button {
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  color: var(--fg);
  font: inherit;
}
.quiz .options button:hover { border-color: var(--accent); }
.quiz .options button.correct { background: color-mix(in srgb, var(--success) 25%, var(--bg-elev)); border-color: var(--success); }
.quiz .options button.incorrect { background: color-mix(in srgb, var(--danger) 25%, var(--bg-elev)); border-color: var(--danger); }
.quiz .feedback { margin-top: 0.7rem; padding: 0.7rem 0.9rem; background: var(--bg-soft); border-radius: var(--radius-sm); }
.quiz .meta { color: var(--fg-muted); font-size: 0.9rem; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg-soft); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 2rem 0;
  margin-top: 2rem;
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.site-footer .grid { gap: 1.5rem; }
.site-footer h4 { margin: 0 0 0.4rem; font-size: 1rem; font-family: var(--font-sans); }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin: 0.25rem 0; }
.site-footer a { color: var(--fg); }

/* Print */
@media print {
  .site-header, .site-footer, nav.primary, .theme-toggle, .menu-toggle, .skip-link, .cta, button { display: none !important; }
  body { background: white; color: black; }
  a { color: black; text-decoration: underline; }
  .card, .checklist, .decision, .quiz, .alert {
    page-break-inside: avoid;
    border: 1px solid #aaa;
    box-shadow: none;
  }
  h1, h2, h3 { page-break-after: avoid; }
  main { padding: 0; }
  .container { max-width: none; padding: 0; }
}

/* Utility */
.muted { color: var(--fg-muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.tag {
  display: inline-block;
  font-size: 0.78rem;
  background: var(--bg-soft);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  margin-right: 0.3rem;
}
.tag.before { border-color: var(--success); color: var(--success); }
.tag.during { border-color: var(--danger); color: var(--danger); }
.tag.after  { border-color: var(--warn); color: var(--warn); }

/* Layout: two-column for role pages */
.two-col {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
}
.two-col aside { position: sticky; top: 5rem; align-self: start; }
.two-col aside ul { list-style: none; padding: 0; margin: 0; font-size: 0.95rem; }
.two-col aside li { margin: 0.3em 0; }
.two-col aside a { color: var(--fg-muted); text-decoration: none; }
.two-col aside a:hover, .two-col aside a.active { color: var(--accent); }
@media (max-width: 820px) {
  .two-col { grid-template-columns: 1fr; }
  .two-col aside { position: static; }
}

/* Diagrams (CC BY 4.0 SVGs) */
.diagram {
  margin: 1.5rem 0;
  text-align: center;
}
.diagram img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  background: #ffffff;
  padding: 1rem;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.diagram figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-style: italic;
}

/* Inline-SVG diagrams (e.g., lifecycle on Prevention/Response pages) */
.diagram > svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  background: #ffffff;
  padding: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Lifecycle band emphasis: dim the non-relevant band on each context */
.diagram.emphasize-prev .resp-band { opacity: 0.28; }
.diagram.emphasize-resp .prev-band { opacity: 0.28; }
html[data-theme="dark"] .diagram.emphasize-prev .resp-band,
html[data-theme="dark"] .diagram.emphasize-resp .prev-band { opacity: 0.35; }

/* "How to use this playbook" — plain numbered list (not interactive) */
ol.how-to { padding-left: 1.25rem; margin: 0.5rem 0 0; }
ol.how-to li { margin: 0.5rem 0; line-height: 1.55; }
ol.how-to li::marker { color: var(--brand-orange); font-weight: 700; }
