/* =========================================================
   Base document
========================================================= */

:root {
  --bg: #ffffff;
  --fg: #222222;

  --border: #e5e7eb;
  --muted: #64748b;

  --blue: #4f7cff;
  --green: #16a34a;
  --orange: #d97706;
  --red: #dc2626;

  --surface: #fafafa;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  line-height: 1.65;
  max-width: 90ch;
  margin: 3rem auto;
  padding: 0 1rem;

  color: var(--fg);
  background: var(--bg);
}

h1, h2, h3 {
  line-height: 1.2;
}

p,
ul,
ol,
table,
blockquote {
  margin: 1rem 0;
}

pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #111827;
  color: #f9fafb;
}

code {
  font-family: ui-monospace, monospace;
}

/* =========================================================
   Links
========================================================= */

a,
a:visited,
a:active {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--blue);
  text-decoration: underline;
}

/* =========================================================
   Generic blocks
========================================================= */

.card,
.note,
.warning,
.success,
.error,
.quote,
.hero,
.stat {
  margin: 1.25rem 0;
  border-radius: 0.85rem;
}

.card,
.note,
.warning,
.success,
.error,
.hero,
.stat {
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
}

/* =========================================================
   Semantic callouts
========================================================= */

.note {
  background: #f5f8ff;
  border-left: 0.35rem solid var(--blue);
}

.success {
  background: #effaf2;
  border-left: 0.35rem solid var(--green);
}

.warning {
  background: #fff8eb;
  border-left: 0.35rem solid var(--orange);
}

.error {
  background: #fff1f2;
  border-left: 0.35rem solid var(--red);
}

/* =========================================================
   Layouts
========================================================= */

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;

  margin: 1.5rem 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;

  margin: 1.5rem 0;
}

/* =========================================================
   Hero
========================================================= */

.hero {
  padding: 2rem;
  background:
    linear-gradient(
      135deg,
      #f5f7ff,
      #ffffff
    );

  border: 1px solid var(--border);
}

.hero > :first-child {
  margin-top: 0;
}

.hero > :last-child {
  margin-bottom: 0;
}

/* =========================================================
   Stats
========================================================= */

.stat {
  background: var(--surface-2);
}

.stat strong {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
}

/* =========================================================
   Quote
========================================================= */

.quote {
  padding: 0.5rem 1.25rem;

  border-left: 0.35rem solid #94a3b8;

  background: var(--surface-3);
  color: #475569;
  font-size: 1.1rem;
  font-style: italic;
}

/* =========================================================
   Tables
========================================================= */

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.65rem 0.75rem;
  text-align: left;

  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-2);
  font-weight: 650;
}

/* =========================================================
   Typography helpers
========================================================= */

.caption {
  margin-top: -0.5rem;

  color: var(--muted);
  font-size: 0.92rem;
}

.center {
  text-align: center;
}

.small {
  font-size: 0.92rem;
}

.large {
  font-size: 1.15rem;
}

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

.nowrap {
  white-space: nowrap;
}

/* =========================================================
   Colors
========================================================= */

.red {
  --theme-color: var(--red);
}

.green {
  --theme-color: var(--green);
}

.blue {
  --theme-color: var(--blue);
}

.orange {
  --theme-color: var(--orange);
}

/* =========================================================
   Buttons
========================================================= */

.buttons {
  --button-color: var(--theme-color, var(--muted));
}

.buttons a, .buttons a:visited {
  display: inline-block;
  margin: 0.25rem 0.35rem 0.25rem 0;
  padding: 0.55rem 0.85rem;
  border-radius: 0.8rem;
  border: 1px solid var(--button-color);
  background: var(--surface-2);
  color: var(--button-color);
  font-weight: 600;
}

.buttons a:hover {
  background: var(--surface);
  text-decoration: none;
}

.buttons a:active {
  transform: translateY(1px);
}

.buttons a:focus-visible {
  outline: 2px solid var(--button-color);
  outline-offset: 2px;
}

/* =========================================================
   Visual helpers
========================================================= */

.shadow {
  box-shadow:
    0 6px 18px rgba(0,0,0,0.08);
}

.round {
  border-radius: 1.5rem;
}

.borderless {
  border: none;
}

.compact {
  padding: 0.6rem 0.85rem;
}

/* =========================================================
   Combinations become very powerful
========================================================= */

/* Example:
   .card.shadow.round
   .note.compact.small
*/

pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f8f8f8; }
.highlight .c { color: #3D7B7B; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #F00 } /* Error */
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
.highlight .o { color: #666 } /* Operator */
.highlight .ch { color: #3D7B7B; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #3D7B7B; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #9C6500 } /* Comment.Preproc */
.highlight .cpf { color: #3D7B7B; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #3D7B7B; font-style: italic } /* Comment.Single */
.highlight .cs { color: #3D7B7B; font-style: italic } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #E40000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #008400 } /* Generic.Inserted */
.highlight .go { color: #717171 } /* Generic.Output */
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #04D } /* Generic.Traceback */
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #B00040 } /* Keyword.Type */
.highlight .m { color: #666 } /* Literal.Number */
.highlight .s { color: #BA2121 } /* Literal.String */
.highlight .na { color: #687822 } /* Name.Attribute */
.highlight .nb { color: #008000 } /* Name.Builtin */
.highlight .nc { color: #00F; font-weight: bold } /* Name.Class */
.highlight .no { color: #800 } /* Name.Constant */
.highlight .nd { color: #A2F } /* Name.Decorator */
.highlight .ni { color: #717171; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #CB3F38; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #00F } /* Name.Function */
.highlight .nl { color: #767600 } /* Name.Label */
.highlight .nn { color: #00F; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #19177C } /* Name.Variable */
.highlight .ow { color: #A2F; font-weight: bold } /* Operator.Word */
.highlight .w { color: #BBB } /* Text.Whitespace */
.highlight .mb { color: #666 } /* Literal.Number.Bin */
.highlight .mf { color: #666 } /* Literal.Number.Float */
.highlight .mh { color: #666 } /* Literal.Number.Hex */
.highlight .mi { color: #666 } /* Literal.Number.Integer */
.highlight .mo { color: #666 } /* Literal.Number.Oct */
.highlight .sa { color: #BA2121 } /* Literal.String.Affix */
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
.highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
.highlight .se { color: #AA5D1F; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
.highlight .si { color: #A45A77; font-weight: bold } /* Literal.String.Interpol */
.highlight .sx { color: #008000 } /* Literal.String.Other */
.highlight .sr { color: #A45A77 } /* Literal.String.Regex */
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #00F } /* Name.Function.Magic */
.highlight .vc { color: #19177C } /* Name.Variable.Class */
.highlight .vg { color: #19177C } /* Name.Variable.Global */
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
.highlight .vm { color: #19177C } /* Name.Variable.Magic */
.highlight .il { color: #666 } /* Literal.Number.Integer.Long */