/* Global reset / defaults */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
}

/* =========================
   Theme tokens
   ========================= */
:root {
  /* LIGHT MODE: A "Paper" aesthetic */
  --bg: #fdfdfd;      /* Off-white reduces glare */
  --text: #1a1a1a;    /* Softened black */
  --secondary-bg: #f4f4f4;
  
  /* Smooth, modern borders on light mode */
  --border: rgba(0, 0, 0, 0.18);

  /* Brand - Slightly deeper blue for readability on light */
  --tint: #0066d6;
  --tint-visited: #4da3ff;

  /* Neutrals */
  --muted: rgba(0, 0, 0, 0.6);
  --max: 725px;
  --pad: 18px;
  --radius: 12px; /* 12px */
  --radius-sm: calc(var(--radius) * 0.5);  /* 6px */
  --radius-lg: calc(var(--radius) * 1.5);  /* 18px */

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* DARK MODE: "Deep Charcoal" aesthetic */
    --bg: #0d0d0d;      /* Lifted from pure black to stop OLED smearing */
    --text: #e3e3e3;    /* Softened from white to stop "glowing" text */

    /* Better secondary surface: a bit closer to bg, less boxy */
    --secondary-bg: #141414;

    /* THE KEY FIX: Soften borders and muted text */
    --muted: rgba(255, 255, 255, 0.6);
    --border: #3f3f3f;  /* Pure white borders are the main "rookie" vibe source */

    --tint: #4da3ff;
    --tint-visited: #8fc2ff;
  }
}

/* =========================
   Base typography
   ========================= */
body {
  color: var(--text);
  background: var(--bg);

  font-family: system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17.5px;
  font-weight: 350;
  line-height: 1.6;
  letter-spacing: 0.01em;

  overflow-x: hidden;
}

/* =========================
   Sticky footer layout
   ========================= */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Constrain main content containers (center the column on the page) */
.site-header,
.site-main,
.site-footer {
  max-width: var(--max);
  padding-left: var(--pad);
  padding-right: var(--pad);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* Main takes remaining vertical space so footer sits at bottom */
.site-main {
  flex: 1;
  padding-top: 28px;
  padding-bottom: 36px;
}

/* =========================
   Header / nav
   ========================= */

.site-header {
  margin-top: 36px;
  margin-bottom: 12px;

  display: flex;
  align-items: center;
  gap: 16px;

  /* keep header content left-aligned */
  text-align: left;
}

/* Logo on the left */
.site-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-logo img {
  width: 45px;
  height: 45px;

  /* IMPORTANT: override global img defaults that can let SVGs explode */
  max-width: none;
  display: block;
}

/* Nav on the right */
.site-nav {
  margin-left: auto;        /* pushes nav to the far right */
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  align-items: baseline;

  text-align: right;
}

/* Links */
.nav-link {
  display: inline-block;

  font-size: 20px;
  font-weight: 450;
  letter-spacing: 0.02em;
  text-transform: lowercase;

  text-decoration: none;
  color: var(--tint);

  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: var(--tint-visited);
}

.nav-link.is-active {
  color: var(--text);
  border-bottom-color: var(--text);
  opacity: 0.85;
}

/* =========================
   Footer
   ========================= */
.site-footer {
  margin-top: 0;
  margin-bottom: 28px;

  font-size: 15px;
  font-weight: 450;
  font-style: italic;
  line-height: 1.4;

  color: var(--muted);
  text-align: center; /* footer only */
}

.site-footer a {
  color: var(--text);
}

/* =========================
   Elements
   ========================= */
img,
video {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

a {
  color: var(--tint);
  text-decoration: none;
}

a:hover {
  color: var(--tint-visited);
}

a.isFancyLink:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

p {
  margin: 18px 0;
}

/* Headings */
h1,
h2,
h3 {
  line-height: 1.15;
  margin: 0.4em 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 44px;
  margin-top: 0; /* avoid double top spacing */
}

h2 {
  font-size: 28px;
  margin-top: 44px;
}

h3 {
  font-size: 24px;
  margin-top: 32px;
}

hr {
  border: 0;
  margin: 38px 0;
  border-top: 2px dashed var(--muted);
}

.subtitle {
  font-weight: 500;
  line-height: 1.15;
  font-size: 22px;
  margin-top: 12px;
}

.subtitle.add-top-margin {
  margin-top: 32px;
}

/* Blockquotes */
blockquote {
  margin: 36px 0;
  padding: 16px;
  border-left: 4px solid var(--border);
}

blockquote p:first-child {
  margin-top: 0;
}
blockquote p:last-child {
  margin-bottom: 0;
}

/* Code */
code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

pre {
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (prefers-color-scheme: dark) {
  pre {
    border: none;
  }
}

/* Callout box (square + bold) */
.box {
  border: 3px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  text-align: center;
}

/* =========================
   Mobile tweaks
   ========================= */
@media (max-width: 700px) {
  body {
    font-size: 16.5px;
  }

  h1 {
    font-size: 38px;
  }

  .site-main {
    padding-top: 22px;
    padding-bottom: 28px;
  }

  .site-header {
    margin-bottom: 10px;
  }
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin: 28px 0;

  font-size: 0.95em;
  line-height: 1.4;
}

thead {
  background: var(--secondary-bg);
}

th,
td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 600;
  text-align: left;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--secondary-bg) 40%, transparent);
}

/* =========================
   Re-usable "warning" callout box
   ========================= */
.warning-box {
  width: 100%;
  margin: 0 0 24px 0;

  border-radius: var(--radius);
  border: transparent;

  background: var(--secondary-bg);
  color: var(--muted);

  padding: 18px;
}

.warning-box-inner {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.warning-text {
  margin: 0;
  font-weight: 600;
  line-height: 1.35;
}

/* Light mode (default) */
.astro-code,
.astro-code span {
  color: var(--shiki-light);
  background-color: var(--shiki-light-bg);

  font-style: var(--shiki-light-font-style);
  font-weight: var(--shiki-light-font-weight);
  text-decoration: var(--shiki-light-text-decoration);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .astro-code,
  .astro-code span {
    color: var(--shiki-dark) !important;
    background-color: var(--shiki-dark-bg) !important;

    font-style: var(--shiki-dark-font-style) !important;
    font-weight: var(--shiki-dark-font-weight) !important;
    text-decoration: var(--shiki-dark-text-decoration) !important;
  }
}