/* StarLab Control Theme — systems UI aesthetic */
/* Design tokens */
:root {
  --saber-blue: #00A3FF;
  --amber-alert: #FFB800;

  --bg: #000205;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(0, 163, 255, 0.18);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,0.5);
  --glow: 0 0 0 1px rgba(0,163,255,0.25), 0 0 24px rgba(0,163,255,0.12);

  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --container: 980px;
}

/* Light mode tokens (optional) */
html[data-theme="light"] {
  --bg: #f7fbff;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-2: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 80, 140, 0.22);
  --text: rgba(0, 0, 0, 0.88);
  --muted: rgba(0, 0, 0, 0.62);
  --shadow: 0 10px 30px rgba(0,0,0,0.12);
  --glow: 0 0 0 1px rgba(0,80,140,0.22), 0 0 20px rgba(0,80,140,0.10);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

/* subtle blueprint grid */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgba(0,163,255,0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,163,255,0.08) 1px, transparent 1px),
    radial-gradient(circle at 20% 10%, rgba(0,163,255,0.12), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(255,184,0,0.08), transparent 45%);
  background-size: 64px 64px, 64px 64px, 100% 100%, 100% 100%;
  opacity: 0.45;
}


.site-main { padding: 38px 0 60px; }

/* Nav */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(0,2,5,0.92), rgba(0,2,5,0.45));
  border-bottom: 1px solid rgba(0,163,255,0.16);
}

html[data-theme="light"] .nav-wrap {
  background: linear-gradient(to bottom, rgba(247,251,255,0.92), rgba(247,251,255,0.45));
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
}

.nav__brand {
  font-family: var(--font-mono);
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.04em;
}

.nav__brand-suffix { color: var(--saber-blue); }

.nav__links :is(a) {
  color: var(--muted);
  text-decoration: none;
  margin: 0 10px;
  font-family: var(--font-mono);
  font-size: 14px;
}

.nav__links :is(a):hover { color: var(--text); }

.nav__actions { display: flex; align-items: center; gap: 10px; }

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(0,163,255,0.22);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
}

.theme-btn:hover { box-shadow: var(--glow); }

/* Sections */
.section__header { margin: 18px 0 18px; display: grid; gap: 10px; }

.section-num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.section__title { margin: 0; font-size: 34px; letter-spacing: -0.02em; }

.section__line {
  height: 1px;
  background: linear-gradient(to right, rgba(0,163,255,0.35), transparent);
}

.section__sub { margin: 0; max-width: 70ch; }

.section__footer { margin-top: 18px; }

/* Cards */
.card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  padding: 18px;
}

.card--interactive:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), var(--glow);
  transform: translateY(-1px);
}

.post-feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.post-feed--compact { grid-template-columns: 1fr; }

.post-card__link { text-decoration: none; color: inherit; display: block; }
.post-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.post-card__title { margin: 0 0 8px; font-size: 18px; line-height: 1.25; }
.post-card__excerpt { margin: 0; color: var(--muted); }

/* Post page */
.post-header__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-title { margin: 10px 0 6px; font-size: 38px; line-height: 1.12; letter-spacing: -0.02em; }
.post-excerpt { margin: 0; color: var(--muted); max-width: 75ch; }
.post-header__divider { margin: 14px 0; height: 1px; background: linear-gradient(to right, rgba(0,163,255,0.25), transparent); }
.post-content { margin-top: 14px; padding: 22px; }
.post-footer { margin-top: 14px; }

/* Typography helpers */
.h3 { margin: 0 0 8px; font-size: 18px; font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.label--dim { color: var(--muted); }
.label--red { color: #ff6b6b; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.12);
}
.badge--blue { background: rgba(0,163,255,0.14); border-color: rgba(0,163,255,0.35); color: var(--text); }
.badge--outline { background: transparent; border-color: rgba(0,163,255,0.22); color: var(--muted); }
.badge--outline:hover { color: var(--text); box-shadow: var(--glow); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn--primary { background: rgba(0,163,255,0.18); border-color: rgba(0,163,255,0.38); color: var(--text); }
.btn--primary:hover { box-shadow: var(--glow); }
.btn--outline { background: transparent; border-color: rgba(0,163,255,0.22); color: var(--muted); }
.btn--outline:hover { color: var(--text); box-shadow: var(--glow); }

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.divider { margin: 14px 0; height: 1px; background: linear-gradient(to right, rgba(0,163,255,0.22), transparent); }

/* Author card */
.author-card__inner { display: flex; gap: 14px; align-items: flex-start; }
.author-card__avatar { width: 56px; height: 56px; border-radius: 999px; border: 1px solid rgba(0,163,255,0.25); }
.author-card__name { margin: 0 0 6px; font-size: 16px; }
.author-card__bio { margin: 0 0 10px; color: var(--muted); }
.author-card__links { display: flex; gap: 10px; flex-wrap: wrap; }

/* Member form */
.member-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.member-form__input {
  flex: 1 1 240px;
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,163,255,0.22);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  outline: none;
}
.member-form__input:focus { box-shadow: var(--glow); }

/* Content styles */
.post-content :is(p, ul, ol) { max-width: 75ch; }
.post-content a { color: var(--saber-blue); }
.post-content pre {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0,163,255,0.22);
  background: rgba(0,0,0,0.35);
  overflow: auto;
}
html[data-theme="light"] .post-content pre { background: rgba(0,0,0,0.06); }
.post-content code { font-family: var(--font-mono); font-size: 0.95em; }

/* Hero */
.hero__title { margin: 6px 0 6px; font-size: 38px; line-height: 1.05; }
.hero__subtitle { margin: 0 0 12px; color: var(--muted); max-width: 70ch; }
.hero__actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 6px; }
.hero__status { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,163,255,0.18);
  background: rgba(255,255,255,0.03);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.dot--ok { background: rgba(0,255,160,0.85); }
.dot--warn { background: rgba(255,184,0,0.9); }

/* Layout helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.list { margin: 0; padding-left: 18px; color: var(--muted); }
.link { color: var(--muted); }
.link:hover { color: var(--text); }

/* Footer */
.site-footer { border-top: 1px solid rgba(0,163,255,0.16); padding: 22px 0; background: rgba(0,0,0,0.18); }
html[data-theme="light"] .site-footer { background: rgba(0,0,0,0.02); }
.site-footer__inner { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Responsive */
@media (max-width: 820px) {
  .post-feed { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .section__title { font-size: 28px; }
  .post-title { font-size: 32px; }
  .hero__title { font-size: 36px; }
  .nav__links { display: none; }
}


/* --- Layout helper: allow full-width card inside grid sections --- */
.grid-span-2 {
  grid-column: 1 / -1;
}

/* --- Bullet alignment (Featured Systems) --- */
.list {
  margin: 0;
  padding-left: 0;
  list-style-position: outside;
}

.list li {
  margin-left: 1.2rem;
  padding-left: 0.4rem;
  margin-bottom: 6px;
}

/* --- Keep markdown looking traditional; add subtle color accents --- */
.post-content :is(h1,h2,h3,h4) {
  margin-top: 1.6em;
  margin-bottom: 0.6em;
}

.post-content h2 {
  border-bottom: 1px solid rgba(0,163,255,0.22);
  padding-bottom: 0.35em;
}

.post-content blockquote {
  margin: 1.2em 0;
  padding: 0.4em 0 0.4em 1em;
  border-left: 3px solid rgba(0,163,255,0.55);
  background: rgba(0,163,255,0.06);
  border-radius: 10px;
}

.post-content hr {
  border: none;
  height: 1px;
  margin: 1.8em 0;
  background: linear-gradient(to right, rgba(0,163,255,0.35), transparent);
}

.post-content a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-content code {
  background: rgba(0,163,255,0.10);
  border: 1px solid rgba(0,163,255,0.18);
  padding: 0.15em 0.35em;
  border-radius: 8px;
}

.post-content pre code {
  background: transparent;
  border: none;
  padding: 0;
}

.post-content ul, .post-content ol {
  padding-left: 1.2em;
}

.post-content li {
  margin: 0.35em 0;
}


/* --- Koenig editor: wide + full widths --- */
.kg-width-wide,
.post-content .kg-width-wide {
  width: 100%;
  max-width: min(1100px, calc(100vw - 40px));
  margin-left: auto;
  margin-right: auto;
}

.kg-width-full,
.post-content .kg-width-full {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.kg-width-full img,
.kg-width-wide img {
  width: 100%;
  height: auto;
  display: block;
}


/* --- Nav: remove separator dots completely --- */
.nav__links a::before {
  content: none !important;
}


/* --- FORCE REMOVE NAV DOT SEPARATORS --- */
.nav__links a::before,
.nav__links a + a::before {
    content: none !important;
    display: none !important;
}


/* --- NAV: URL-Based Color System --- */

.nav__links a {
  position: relative;
  transition: color 0.2s ease;
}

/* Default Colors by URL */
.nav__links a[href="/"] { color: var(--saber-blue); }
.nav__links a[href*="writeups"] { color: #ff5f5f; }
.nav__links a[href*="projects"] { color: #00ffae; }
.nav__links a[href*="fleet"] { color: #ffd84d; }
.nav__links a[href*="github"] { color: #a78bfa; }

/* Hover = White */
.nav__links a:hover {
  color: #ffffff !important;
}

/* Underline Accent */
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0%;
  height: 2px;
  transition: width 0.25s ease;
}

/* Underline colors by URL */
.nav__links a[href="/"]::after { background: var(--saber-blue); }
.nav__links a[href*="writeups"]::after { background: #ff5f5f; }
.nav__links a[href*="projects"]::after { background: #00ffae; }
.nav__links a[href*="fleet"]::after { background: #ffd84d; }
.nav__links a[href*="github"]::after { background: #a78bfa; }

/* Active Page Underline */
.nav__links .nav-current::after {
  width: 100%;
}


/* --- Improved Centered Layout --- */

.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px;
}

.post-content {
  max-width: 760px;
  margin: 0 auto;
}

.hero {
  max-width: 860px;
  margin: 0 auto;
}


/* --- Post header + tag badges --- */
.post-header {
  margin-bottom: 14px;
}

.post-header__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.post-title {
  margin-top: 10px;
  margin-bottom: 0;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badge--tag {
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.35);
  color: rgba(255,255,255,0.92);
}

html[data-theme="light"] .badge--tag {
  color: rgba(0,0,0,0.88);
}

.badge--tag:hover {
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.30), 0 0 18px rgba(167, 139, 250, 0.18);
}

/* If Ghost/Markdown emits <mark>, make it subtle purple instead of yellow */
.post-content mark {
  background: rgba(167, 139, 250, 0.18);
  color: inherit;
  padding: 0.05em 0.15em;
  border-radius: 6px;
}


/* --- Nav: remove any marker elements + ensure clean spacing --- */
.nav__links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav__links li {
  margin: 0;
  padding: 0;
}

.nav__links .marker {
  display: none !important;
}

/* --- Post card with thumbnail --- */
.post-card {
  padding: 0;
  overflow: hidden;
}

.post-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.post-card__media {
  width: 100%;
  height: 140px;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.post-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05) contrast(1.02);
}

.post-card__body {
  padding: 16px 16px 18px;
}

.post-card__title {
  margin: 6px 0 8px;
  font-size: 18px;
  line-height: 1.25;
}

.post-card__excerpt {
  margin: 0;
  color: rgba(255,255,255,0.68);
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 820px) {
  .nav__links ul { gap: 14px; }
  .post-card__media { height: 160px; }
}


/* Assumes markdown renders: <p><strong>Title:</strong> ...</p> */


.post-content p:has(> strong:first-child) {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}

.post-content p > strong:first-child + br,
.post-content p > strong:first-child + span {
  /* no-op, keeps flow */
}

/* Slightly tighten the first few meta paragraphs (common at top of posts) */
.post-content > p:first-child,
.post-content > p:nth-child(2),
.post-content > p:nth-child(3) {
  margin-top: 0.2em;
}


/* --- Nav actions spacing when Subscribe removed --- */
.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* --- Footer: Main Site link --- */
.footer-link--mainsite {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,145,255,0.25);
  background: rgba(0,145,255,0.06);
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-link--mainsite:hover {
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0,145,255,0.28), 0 0 18px rgba(0,145,255,0.18);
}


/* --- Reverted: meta label strong should look like normal markdown bold --- */
.post-content p > strong:first-child {
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  color: inherit;
}

.post-card__kv p strong {
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
  color: rgba(255,255,255,0.78);
}


/* --- Post layout: match header card padding/margins to article card --- */
.post-header.card {
  padding: 22px;
  margin: 0 0 30px;
}

/* Post header subtitle (extracted from first H2) */
.post-header__subtitle {
  margin: 8px 0 4px;
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.35;
  max-width: 75ch;
}
.post-header__subtitle:empty { display: none; }

.post-content.card {
  padding: 22px;
}

/* Keep consistent spacing inside header */
.post-header__meta {
  margin-bottom: 10px;
}

.post-header .divider {
  margin: 18px 0 18px;
}


/* --- Post layout: lock header + article to identical width --- */
.post-template .post-header.card,
.post-template .post-content.card {
  max-width: 820px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}


/* --- Footer: standard link styling (Main Site) --- */
.site-footer__right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.site-footer__link {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-footer__link:hover {
  color: #fff;
}

/* --- Post cards: subtitle + tags --- */
.post-card__subtitle {
  margin-top: 10px;
  margin-bottom: 0;
  color: rgba(255,255,255,0.86);
  font-size: 14px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card__subtitle:empty { display: none; }

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.badge--sm {
  padding: 3px 8px;
  font-size: 10px;
}

/* Hide parsing container */
.post-card__kv {
  display: none !important;
}


/* --- Footer icons --- */
.footer-icons{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:flex-end;
}
.footer-icon{
  display:inline-flex;
  width:28px;
  height:28px;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(0,145,255,0.25);
  border-radius:999px;
  background:rgba(13,17,23,0.55);
  text-decoration:none;
  transition: box-shadow 0.2s ease;
}
.footer-icon svg{
  width:16px;
  height:16px;
  fill:rgba(255,255,255,0.75);
  transition: fill 0.2s ease;
}
.footer-icon:hover{
  box-shadow: 0 0 0 1px rgba(0,145,255,0.28), 0 0 18px rgba(0,145,255,0.18);
}
.footer-icon:hover svg{
  fill:#fff;
}
/* Defensive: hide any legacy fixed mainsite button if present */
.main-site-fab, .mainsite-fab, .floating-mainsite, .footer-link-mainsite, .footer-main-link{
  display:none !important;
}


/* Latest Logs progressive reveal */
#latestLogsGrid .is-hidden{
  display:none !important;
}

.load-more{
  margin: 14px auto 0;
  display: inline-flex;
  gap: 8px;
  align-items:center;
  justify-content:center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,145,255,0.25);
  background: rgba(13,17,23,0.55);
  color: rgba(255,255,255,0.85);
  cursor:pointer;
  user-select:none;
}
.load-more__label{
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .85;
}
.load-more__icon{
  width: 18px;
  height: 18px;
  fill: rgba(255,255,255,0.8);
}
.load-more:hover{
  border-color: rgba(0,145,255,0.45);
}
.load-more:hover .load-more__icon{
  fill: #fff;
}
