/* Dark is the default theme; [data-theme="light"] overrides. */

/* Aeronaves by Måns Grebäck (personal use; see fonts/Aeronaves-LICENSE.txt)
   — used only for the site name. */
@font-face {
  font-family: "Aeronaves";
  src: url("/fonts/Aeronaves.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #131317;
  --bg-raised: #1b1b21;
  --border: #2a2a32;
  --text: #d4d4d9;
  --text-strong: #f4f4f6;
  --text-muted: #85858f;
  --accent: #93a8f4;

  --code-base: #cdd1da;
  --code-comment: #767e8c;
  --code-keyword: #c093e8;
  --code-string: #99c793;
  --code-number: #e0a56e;
  --code-title: #82b1e0;
  --code-attr: #d8b566;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #fdfdfc;
  --bg-raised: #f4f4f2;
  --border: #e4e4e0;
  --text: #33333a;
  --text-strong: #17171c;
  --text-muted: #75757e;
  --accent: #3b5bcc;

  --code-base: #383c44;
  --code-comment: #8b93a0;
  --code-keyword: #8536b8;
  --code-string: #3d7a35;
  --code-number: #b25f1e;
  --code-title: #2263a8;
  --code-attr: #9a6d0b;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Header ------------------------------------------------------------------ */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 4rem;
}

.site-name {
  font-family: "Aeronaves", var(--font-sans);
  font-weight: 400;
  color: var(--text-strong);
  font-size: 1.5625rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.site-name:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-header nav a {
  color: var(--text-muted);
  font-size: 1.0625rem;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: var(--text-strong);
  text-decoration: none;
}

#theme-toggle {
  display: inline-flex;
  align-items: center;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

#theme-toggle:hover {
  color: var(--text-strong);
}

.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* Headings & prose -------------------------------------------------------- */

h1 {
  font-size: 1.625rem;
  line-height: 1.25;
  color: var(--text-strong);
  letter-spacing: -0.015em;
  margin-bottom: 0.5rem;
}

.prose h2,
main > h2 {
  font-size: 1.25rem;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  margin: 2.25rem 0 0.75rem;
}

.prose h3 {
  font-size: 1.0625rem;
  color: var(--text-strong);
  margin: 1.75rem 0 0.5rem;
}

.prose p,
.prose ul,
.prose ol {
  margin-bottom: 1.1rem;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}

.prose li {
  margin-bottom: 0.3rem;
}

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}

.prose img {
  max-width: 100%;
  border-radius: 6px;
}

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

.home p:first-child {
  font-size: 1.1875rem;
}

/* Code -------------------------------------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  color: var(--code-base);
}

pre {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  margin-bottom: 1.1rem;
  line-height: 1.55;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8125rem;
}

.hljs-comment, .hljs-quote { color: var(--code-comment); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-built_in { color: var(--code-keyword); }
.hljs-string, .hljs-regexp, .hljs-addition { color: var(--code-string); }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-meta { color: var(--code-number); }
.hljs-title, .hljs-section, .hljs-name, .hljs-function { color: var(--code-title); }
.hljs-attr, .hljs-attribute, .hljs-variable, .hljs-template-variable, .hljs-type { color: var(--code-attr); }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 600; }

/* Writing index ----------------------------------------------------------- */

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.25rem 0 1rem;
}

.tag-filter button {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  cursor: pointer;
}

.tag-filter button:hover {
  color: var(--text-strong);
  border-color: var(--text-muted);
}

.tag-filter button[aria-pressed="true"] {
  color: var(--bg);
  background: var(--text-strong);
  border-color: var(--text-strong);
}

.year-group {
  margin-top: 1.75rem;
}

.year-group h2 {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 1.35rem;
}

.post-list a {
  color: var(--text-strong);
  font-weight: 550;
}

.post-list a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-list .post-meta {
  margin: 0.15rem 0 0;
}

.post-list li[hidden],
.year-group[hidden] {
  display: none;
}

/* Flying page ------------------------------------------------------------- */

.logbook,
.vatsim {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.vatsim {
  color: var(--accent);
}

#map {
  height: 400px;
  margin: 1rem 0 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
}

.map-route {
  stroke: var(--accent);
  opacity: 0.55;
}

.map-dot {
  stroke: var(--accent);
  fill: var(--accent);
  fill-opacity: 0.5;
}

/* Leaflet chrome, matched to the site theme */
.leaflet-container {
  font-family: var(--font-sans);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-raised);
  color: var(--text);
}

.leaflet-popup-content {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin: 0.6rem 0.85rem;
}

.leaflet-bar a {
  background: var(--bg-raised);
  color: var(--text);
  border-color: var(--border);
}

.leaflet-bar a:hover {
  background: var(--border);
  color: var(--text-strong);
}

.leaflet-container .leaflet-control-attribution {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.625rem;
}

.leaflet-container .leaflet-control-attribution a {
  color: var(--text-muted);
}

/* Blog post chrome --------------------------------------------------------- */

/* A little runway: grey asphalt strip, dashed centerline, and a plane that
   rolls along it as the reader scrolls. */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
  z-index: 100;
  background-color: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  background-image: repeating-linear-gradient(
    90deg,
    var(--text-muted) 0 5px,
    transparent 5px 28px
  );
  background-size: 100% 1px;
  background-position: 0 50%;
  background-repeat: no-repeat;
}

.progress-trail {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 1.5px;
  transform: translateY(-50%);
  background: var(--accent);
  opacity: 0.55;
}

.progress-plane {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px;
  height: 16px;
  transform: translate(0, -50%) rotate(90deg);
  color: var(--accent);
}

.post-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.post-meta-row .post-meta {
  margin-bottom: 0;
}

.heading-anchor {
  margin-left: 0.4em;
  color: var(--text-muted);
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
}

h1:hover .heading-anchor,
h2:hover .heading-anchor,
h3:hover .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--accent);
  text-decoration: none;
}

/* On this page (sidebar on wide screens, disclosure on narrow) */

.toc {
  display: none;
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.toc ul,
.toc-mobile ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc li,
.toc-mobile li {
  margin: 0.35rem 0;
}

.toc-h3 {
  padding-left: 0.9rem;
}

.toc a,
.toc-mobile a {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
  display: inline-block;
}

.toc a:hover,
.toc-mobile a:hover {
  color: var(--text-strong);
  text-decoration: none;
}

.toc a.active {
  color: var(--accent);
}

.toc-mobile {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.toc-mobile summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.toc-mobile[open] summary {
  margin-bottom: 0.5rem;
}

@media (min-width: 1160px) {
  .toc {
    display: block;
    position: fixed;
    top: 7.5rem;
    left: calc(50% + 22rem);
    width: 14rem;
    max-height: calc(100vh - 10rem);
    overflow-y: auto;
  }

  .toc-mobile {
    display: none;
  }
}

/* Post menu dropdown */

.post-menu {
  position: relative;
  flex-shrink: 0;
}

#post-menu-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem 0.45rem;
}

#post-menu-btn:hover,
#post-menu-btn[aria-expanded="true"] {
  color: var(--text-strong);
  background: var(--bg-raised);
}

.post-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  width: 17rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.post-menu-list a,
.post-menu-list button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-sans);
  text-decoration: none;
}

.post-menu-list a:hover,
.post-menu-list button:hover {
  background: var(--border);
  text-decoration: none;
}

.post-menu-list strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-strong);
}

.post-menu-list span {
  display: block;
  font-size: 0.71875rem;
  color: var(--text-muted);
}

.post-menu-list hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.35rem 0.25rem;
}

/* MDX callout component */

.callout {
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--bg-raised);
  padding: 0.75rem 1rem;
  margin-bottom: 1.1rem;
  font-size: 0.9375rem;
}

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

/* Radar cursor (flying page only, applied via .radar-page) ----------------- */

:root {
  --radar: #3dff6e;
}

[data-theme="light"] {
  --radar: #1d9e45;
}

.radar-page,
.radar-page * {
  cursor: none !important;
}

.radar-head {
  position: fixed;
  top: 0;
  left: 0;
  width: 9px;
  height: 9px;
  background: var(--radar);
  box-shadow: 0 0 6px var(--radar);
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  will-change: transform;
}

.radar-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 5px;
  height: 5px;
  background: var(--radar);
  pointer-events: none;
  z-index: 998;
  opacity: 0;
  will-change: transform, opacity;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.metar {
  flex-basis: 100%;
  font-size: 0.625rem;
  cursor: help;
}

.metar-raw {
  font-size: 1em;
}

.metar[hidden] {
  display: none;
}

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

.site-footer a:hover {
  color: var(--text-strong);
  text-decoration: none;
}

.footer-links {
  display: flex;
  gap: 1rem;
}
