/* Default CSS for MARS Help Documents */

/* ==========================================================================
   1. CSS Variables & Theming
   ========================================================================== */

:root {
  --primary: #2563eb;
  --success: #16a34a;
  --warning: #ca8a04;
  --bg: #f8fafc;
  --card-bg: #dddddd;
  --text: #1e293b;
  --text-red: #d73637;
  --text-muted: #546174;
  --border: #e2e8f0;
  --link: #2563eb;
  --link-visited: #7c3aed;
  --link-hover: #1d4ed8;
  --nav-bg: #dddddd;
}

[data-theme="dark"] {
  --primary: #60a5fa;
  --success: #4ade80;
  --warning: #fbbf24;
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #e2e8f0;
  --text-red: #d73637;
  --text-muted: #94a3b8;
  --border: #334155;
  --link: #93c5fd;
  --link-visited: #c4b5fd;
  --link-hover: #bfdbfe;
  --nav-bg: #1e293b;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue,
    Adwaita Sans, Cantarell, Ubuntu, roboto, noto, helvetica, arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

/* ==========================================================================
   3. Layout
   ========================================================================== */

.layout {
  display: flex;
  min-height: 100vh;
}

main {
  margin-left: 260px;
  flex: 1;
  padding: 2rem 3rem;
  max-width: 900px;
}

header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

section {
  margin-bottom: 3rem;
  scroll-margin-top: 2rem;
}

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ==========================================================================
   4. Navigation
   ========================================================================== */

nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: var(--nav-bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
}

nav .logo {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

nav .logo img {
  max-width: 100%;
  height: auto;
}

nav h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem 0;
}

nav ul {
  list-style: none;
}

nav li a {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  transition: background 0.15s;
}

nav li a:hover {
  background: var(--border);
}

nav li a.active {
  background: var(--primary);
  color: white;
}

/* ==========================================================================
   5. Typography
   ========================================================================== */

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 2rem;
  margin-top: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
  color: var(--text);
}

h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem 0;
  color: var(--text-red);
}

h4 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem 0;
  color: var(--primary);
}

p {
  margin-bottom: 1rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ==========================================================================
   6. Links
   ========================================================================== */

main a {
  color: var(--link);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.1s;
}

main a:visited {
  color: var(--link-visited);
}

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

/* ==========================================================================
   7. Lists
   ========================================================================== */

ul,
ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.cardlist li {
  line-height: 1.6rem;
  margin: 0.25rem 0.5rem;
}

.cardlist ol > li{
  font-weight: 700;
  font-size: 1.0em;
}

.cardlist ul {
  line-height: 1.5rem;
  margin-top: 0.25rem;
  margin-bottom: 0.7rem;
}

.cardlist ol > li::marker,
.cardlist ul > li::marker {
  font-weight: bold;
  font-size: 1.2em;
  color: var(--text-red);
}

li {
  line-height: 1.9rem;
}

/* Definition Lists */

dd {
  margin-left: 3em;
  margin-right: 3em;
}

dt {
  font-weight: 400;
  font-size: 1.25rem;
}

/* ==========================================================================
   8. Tables
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--nav-bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.doctable td:first-child {
  font-weight: 600;
}

/* ==========================================================================
   9. Code & Pre
   ========================================================================== */

pre {
  background: var(--nav-bg);
  padding: 1.5rem;
  margin: 1rem 0;
  border-radius: 0.5rem;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  line-height: 1.2em;
  display: block;
}

code {
  background: var(--nav-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 1em;
}

.card code {
  display: block;
  padding: 0.75rem 1rem;
  line-height: 1.2;
}

.flow-diagram {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 1em;
  font-weight: 400;
  overflow-x: auto;
  display: block;
  line-height: 1.2;
}

.flow-arrow {
  color: var(--primary);
  font-weight: bold;
}

/* ==========================================================================
   10. Cards
   ========================================================================== */

.card {
  background: var(--card-bg);
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card-title {
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

/* ==========================================================================
   11. Workflow Steps
   ========================================================================== */

.workflow {
  background: var(--card-bg);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin: 1rem 0;
}

.workflow-step {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.workflow-step:last-child {
  margin-bottom: 0;
}

.step-number {
  background: var(--primary);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
  margin-right: 1rem;
}

.step-content h4 {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.step-content p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ==========================================================================
   12. Callouts (Tips & Warnings)
   ========================================================================== */

.tip {
  background: rgba(37, 99, 235, 0.1);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  margin: 2rem 0;
  border-radius: 0 0.5rem 0.5rem 0;
}

.tip-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.warning {
  background: rgba(202, 138, 4, 0.1);
  border-left: 4px solid var(--warning);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0 0.5rem 0.5rem 0;
}

.warning-title {
  font-weight: 600;
  color: var(--warning);
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   13. Keyboard Keys
   ========================================================================== */

.keyboard {
  display: inline-block;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  padding: 0.1rem 0.5rem;
  font-family: Menlo, Consolas, Monaco, Adwaita Mono, Liberation Mono, Lucida Console, monospace;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ==========================================================================
   14. Utilities
   ========================================================================== */

.theme-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.theme-toggle:hover {
  background: var(--nav-bg);
}

/* ==========================================================================
   15. Media Queries
   ========================================================================== */

@media (max-width: 900px) {
  nav {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  main {
    margin-left: 0;
    padding: 1.5rem;
  }

  .layout {
    flex-direction: column;
  }
}
