/* ============================================================
   GreenFlagged blog — palette lifted verbatim from the product
   site (web/src/main/resources/static/style.css) so blog and app
   read as one identity.
   ============================================================ */
:root {
  --green-950: #091a16;
  --green-900: #0f2e25;
  --green-800: #14453a;
  --green-700: #1a5c4e;
  --green-600: #227a68;
  --green-500: #2a9d8f;
  --green-400: #52b7a8;
  --green-300: #7fd1c4;

  --amber-500: #d4a037;
  --amber-400: #e4b44a;
  --red-500:   #c44536;
  --red-400:   #e05a4f;

  --white:    #faf9f7;
  --gray-50:  #f5f4f1;
  --gray-100: #eae8e3;
  --gray-200: #d5d2cb;
  --gray-300: #b8b4aa;
  --gray-400: #8a8578;
  --gray-500: #6b665a;
  --gray-600: #4a4640;
  --gray-700: #33302b;
  --gray-800: #1f1d19;
  --gray-900: #0e0d0b;

  --primary: var(--green-600);
  --primary-hover: var(--green-700);
  --accent: var(--green-500);

  --bg: var(--gray-50);
  --surface: #fff;
  --border: var(--gray-200);
  --border-light: #eee;

  --text: var(--green-900);
  --text-secondary: var(--gray-500);
  --text-muted: var(--gray-400);
  --text-heading: var(--gray-700);

  --nav-bg: var(--green-900);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Menlo', monospace;

  --measure: 42rem;   /* comfortable reading column */
  color-scheme: light;
}

/* --- Dark palette ---
   Applied when the reader explicitly picks dark (data-theme="dark"), OR when
   their OS prefers dark and they haven't explicitly chosen light. A no-flash
   init script in <head> stamps data-theme from localStorage before first paint;
   the nav toggle sets/persists it. The var block is duplicated (not DRY) because
   a CSS rule can't span both a media query and a plain selector. */
:root[data-theme="dark"] {
  --bg: var(--green-950);
  --surface: #10241e;
  --border: #244038;
  --border-light: #1c322b;
  --text: #e7efec;
  --text-secondary: #9db3ac;
  --text-muted: #6f8a82;
  --text-heading: #cfe0da;
  --primary: var(--green-400);
  --primary-hover: var(--green-300);
  --nav-bg: #0a1f19;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--green-950);
    --surface: #10241e;
    --border: #244038;
    --border-light: #1c322b;
    --text: #e7efec;
    --text-secondary: #9db3ac;
    --text-muted: #6f8a82;
    --text-heading: #cfe0da;
    --primary: var(--green-400);
    --primary-hover: var(--green-300);
    --nav-bg: #0a1f19;
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }
main.container { flex: 1 0 auto; padding-top: 3rem; padding-bottom: 4rem; }

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

/* ---- Nav ---- */
#main-nav {
  background: var(--nav-bg);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 3.25rem;
  padding: 0 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.55rem; color: #fff !important; font-weight: 700; letter-spacing: -0.02em; margin-right: auto; }
.brand-text { font-size: 1.05rem; }
.brand-sub { color: var(--green-300); font-weight: 500; }
.mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--green-600);
  border-radius: 5px; font-size: 0.78rem; font-weight: 800; color: #fff;
}
.mark.small { width: 20px; height: 20px; font-size: 0.68rem; }
.nav-links { display: flex; gap: 1.4rem; align-items: center; }
.nav-links a { color: var(--gray-300); font-size: 0.88rem; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: #fff; }
.nav-links a.active { color: #fff; border-bottom-color: var(--green-400); }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.35rem; cursor: pointer; line-height: 1; }

/* theme toggle (sun/moon) */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; background: none; border: none;
  color: var(--gray-300); cursor: pointer; border-radius: 6px; padding: 0;
}
.theme-toggle:hover { color: #fff; background: rgba(255,255,255,0.08); }
.theme-toggle svg { width: 18px; height: 18px; }
/* show the icon matching the *active* theme; the other is hidden.
   [data-theme] state is resolved by theme.js on load + toggle. */
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: none; }
}

/* ---- Hero (home + 404) ---- */
.hero { padding: 1rem 0 2.5rem; border-bottom: 1px solid var(--border); margin-bottom: 2.5rem; }
.eyebrow { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); margin-bottom: 0.75rem; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 1rem; color: var(--text); }
.hero-lede { font-size: 1.1rem; color: var(--text-secondary); max-width: 34rem; }

/* ---- Post list ---- */
.section-heading, .list-header h1 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; margin-bottom: 1.25rem; }
.list-header { margin-bottom: 2rem; }
.list-header h1 { font-size: 1.6rem; text-transform: none; letter-spacing: -0.01em; color: var(--text); }
.list-intro { color: var(--text-secondary); margin-top: 0.5rem; }

.posts { list-style: none; }
.post-item { border-top: 1px solid var(--border); }
.post-item:last-child { border-bottom: 1px solid var(--border); }
.post-item-link { display: block; padding: 1.5rem 0; color: inherit; }
.post-item-link:hover { color: inherit; }
.post-item-link time { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.post-item-link h3 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -0.01em; margin: 0.35rem 0 0.5rem; color: var(--text); transition: color 0.12s ease; }
.post-item-link:hover h3 { color: var(--primary); }
.post-item-link p { color: var(--text-secondary); font-size: 0.98rem; }

/* ---- Tags ---- */
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.75rem; }
.tag { font-family: var(--font-mono); font-size: 0.72rem; padding: 0.12rem 0.5rem; border-radius: 3px; background: var(--gray-100); color: var(--text-secondary); border: 1px solid var(--border); }
a.tag:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Article ---- */
.post-header { margin-bottom: 2.5rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--border); }
.post-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.9rem; display: flex; gap: 0.6rem; align-items: center; }
.post-meta .dot { opacity: 0.6; }
.post-header h1 { font-size: clamp(1.8rem, 4.5vw, 2.5rem); line-height: 1.15; letter-spacing: -0.022em; color: var(--text); }
.post-lede { font-size: 1.2rem; color: var(--text-secondary); margin-top: 1rem; line-height: 1.5; }

.post-body { font-size: 1.06rem; }
.post-body > * + * { margin-top: 1.25rem; }
.post-body h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin-top: 2.75rem; color: var(--text); }
.post-body h3 { font-size: 1.2rem; margin-top: 2rem; color: var(--text); }
.post-body p, .post-body li { color: var(--text); }
.post-body a { text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--green-300); }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body li + li { margin-top: 0.4rem; }
.post-body img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }
.post-body strong { color: var(--text-heading); }

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.25rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* inline + block code */
.post-body code { font-family: var(--font-mono); font-size: 0.86em; background: var(--gray-100); padding: 0.12em 0.36em; border-radius: 4px; color: var(--gray-700); }
.post-body pre { background: var(--gray-900); color: #e7efec; padding: 1rem 1.15rem; border-radius: 8px; overflow-x: auto; font-size: 0.86rem; line-height: 1.55; border: 1px solid var(--border); }
.post-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

.post-body table { width: 100%; border-collapse: collapse; font-size: 0.9rem; display: block; overflow-x: auto; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
.post-body th { background: var(--gray-100); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); }

.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* callout box for highlighting findings */
.post-body .callout { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--amber-500); border-radius: 6px; padding: 1rem 1.25rem; }
.post-body .callout.danger { border-left-color: var(--red-500); }
.post-body .callout.good { border-left-color: var(--green-500); }

.post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.back-link { font-family: var(--font-mono); font-size: 0.85rem; }

/* ---- Buttons ---- */
.btn-primary { display: inline-block; background: var(--primary); color: #fff !important; padding: 0.55rem 1.1rem; border-radius: 6px; font-weight: 500; font-size: 0.9rem; margin-top: 1rem; }
.btn-primary:hover { background: var(--primary-hover); }

.empty { color: var(--text-muted); font-style: italic; }

/* ---- Footer ---- */
.site-footer { flex-shrink: 0; background: var(--nav-bg); color: var(--gray-300); padding: 2.5rem 0; margin-top: auto; }
.footer-inner { display: flex; flex-direction: column; gap: 0.6rem; }
.footer-brand { display: flex; align-items: center; gap: 0.5rem; color: #fff; font-weight: 600; }
.footer-tagline { color: var(--gray-300); font-size: 0.95rem; }
.footer-links { display: flex; gap: 1.25rem; margin: 0.4rem 0; }
.footer-links a { color: var(--green-300); font-size: 0.88rem; }
.footer-links a:hover { color: #fff; }
.footer-copy { color: var(--gray-400); font-size: 0.8rem; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 3.25rem; left: 0; right: 0; flex-direction: column; gap: 0; background: var(--nav-bg); padding: 0.5rem 1.5rem 1rem; z-index: 20; }
  #main-nav.menu-open .nav-links { display: flex; }
  .nav-links a { padding: 0.6rem 0; width: 100%; }
  #main-nav { position: relative; }
}
