/* Colour scheme adopted from the Investing dashboard: dark default, mint accent, light variant. */
/* DM Sans (self-hosted, latin subset): the edge CSP allows only 'self' for fonts/styles, so Google Fonts cannot be used. Fetched only when light mode uses it. */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url(../fonts/dmsans-300.woff2) format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/dmsans-400.woff2) format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/dmsans-500.woff2) format("woff2"); }
:root {
  color-scheme: dark;
  --bg: #1a1d23; --card: #272b33; --card2: #30353e; --line: #3a404b; --track: #1d2026; --side: #0d0f12;
  --fg: #eef2f6; --muted: #c0c8d2; --accent: #5fe3c0; --onacc: #06201c; --good: #5fe3c0; --bad: #ff9a9a;
  --bar1: #5fe3c0; --bar2: #2f9c83;
  --t1: #5470ff; --t2: #19c9b3; --t3: #2fb86a; --t4: #b2c42a; --tmix: 34%;
  --ok: #5fe3c0; --expired: #ff9a8a;
  --fact-bg: #0f3a33; --fact-fg: #86f3e0; --disc-bg: #4a1c1c; --disc-fg: #ffb4ac;
  --shadow: 0 6px 18px #0006;
}
/* Light theme: look of unclutteredtech.com (white surfaces, warm border, blue accent, DM Sans). Accent text uses the darker #2E6089 (AA on white); #3D7EAA is kept for borders. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fff; --card: #fff; --card2: #f7f9fb; --line: #e2ded8; --track: #e2ded8; --side: #fff;
  --fg: #1c1c1a; --muted: #6b6860; --accent: #2e6089; --accent-hi: #3d7eaa; --accent-dark: #234d6e; --onacc: #fff; --good: #1a7f37; --bad: #b42318;
  --bar1: #3d7eaa; --bar2: #2e6089;
  --t1: #3b5bdb; --t2: #0e9f8e; --t3: #2f9e44; --t4: #8a9a1d; --tmix: 10%;
  --ok: #1a7f37; --expired: #b42318;
  --fact-bg: #dcf5e4; --fact-fg: #14532d; --disc-bg: #fde0de; --disc-fg: #8f1d14;
  --shadow: none; --radius: 10px;
  --sans: "DM Sans", -apple-system, system-ui, "Segoe UI", sans-serif;
  --heading: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.6 -apple-system, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--fg); }
a { color: var(--accent); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.site-header { background: var(--side); color: #e8eef5; position: sticky; top: 0; z-index: 10; box-shadow: var(--shadow); }
.bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.15rem; color: #e8eef5; text-decoration: none; }
nav a { margin-left: 6px; padding: 6px 12px; border-radius: 10px; color: #e8eef5; text-decoration: none; }
nav a:hover { background: #1a1f26; }
nav a.active { background: #1a1f26; box-shadow: inset 0 -3px 0 #5fe3c0; font-weight: 600; }
.iconbtn { background: transparent; color: #e8eef5; border: 1px solid #3a404b; width: 34px; height: 34px; border-radius: 50%; margin-left: 10px; cursor: pointer; font-size: 1rem; }
main { padding-top: 32px; padding-bottom: 48px; }
/* .wrap (0,1,0) overrides the main rule above, so the top gap is set here; same 16px Home always had */
main.wrap { padding-top: 16px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; padding: 20px 0; text-align: center; }
h1 { font-size: 2.4rem; margin: 0 0 4px; line-height: 1.2; }
h2 { margin: 40px 0 12px; font-size: 1.4rem; }
h3 { margin: 0; font-size: 1.1rem; }
.lead { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; }
.hero { padding: 0 0 8px; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.stat { background: linear-gradient(150deg, color-mix(in srgb, var(--tk, var(--t1)) var(--tmix), var(--card)), var(--card) 75%); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 12px 18px; }
.stat:nth-child(4n+1){--tk:var(--t1)} .stat:nth-child(4n+2){--tk:var(--t2)} .stat:nth-child(4n+3){--tk:var(--t3)}
.stat b { display: block; font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.grid .card:nth-child(4n+1){--tk:var(--t1)} .grid .card:nth-child(4n+2){--tk:var(--t2)} .grid .card:nth-child(4n+3){--tk:var(--t3)} .grid .card:nth-child(4n+4){--tk:var(--t4)}
.grid .card { background: linear-gradient(150deg, color-mix(in srgb, var(--tk, var(--t1)) var(--tmix), var(--card)), var(--card) 75%); }
.card h3 { margin-bottom: 8px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 3px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: .8rem; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; color: var(--fg); }
.timeline { border-left: 2px solid var(--line); padding-left: 22px; margin-left: 6px; }
.job { position: relative; margin-bottom: 30px; }
.job::before { content: ""; position: absolute; left: -29px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(90deg, var(--bar2), var(--bar1)); }
.job .meta { color: var(--muted); font-size: .9rem; }
.job ul { margin: 8px 0; padding-left: 20px; }
.badge { font-size: .66rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.badge.active { background: var(--fact-bg); color: var(--fact-fg); } .badge.expired { background: var(--card2); color: var(--muted); }
.cert { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.cert:first-of-type { border-top: 0; }
.cert small { display: block; color: var(--muted); }
.cert.expired { opacity: .5; }
.meta { color: var(--muted); font-size: .9rem; }
.card h3 a { color: var(--fg); text-decoration: none; } .card h3 a:hover { color: var(--accent); }
.btnlike { display: inline-block; background: var(--accent); color: var(--onacc); border-radius: 99px; padding: 8px 18px; text-decoration: none; font-weight: 600; }
.btnlike:hover { filter: brightness(1.1); }
.prose { margin-top: 20px; max-width: 70ch; }
/* Blog posts break out of the 960px page wrap for a wider reading column */
.post { width: min(1200px, calc(100vw - 40px)); position: relative; left: 50%; transform: translateX(-50%); }
.post .prose { max-width: none; }
.prose h2 { margin-top: 28px; }
.prose table { border-collapse: collapse; margin: 14px 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; }
.prose th { background: var(--card2); }
.prose code { background: var(--card2); padding: 0 5px; border-radius: 5px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head .btnlike { margin-top: 8px; }
.job.shift { margin: -12px 0 18px; }
.job.shift::before { background: var(--bg); border: 2px solid var(--bar1); width: 12px; height: 12px; top: 4px; box-sizing: border-box; }
.job.shift .meta { font-size: .8rem; }
button.btnlike { border: 0; font: inherit; font-weight: 600; cursor: pointer; padding: 4px 14px; }
.card ul.plain li { padding: 10px 0; }
.grid .card.wide { grid-column: 1 / -1; }
.grid .card.span-3 { grid-column: span 3; }
@media (max-width: 980px) { .grid .card.span-3 { grid-column: 1 / -1; } }

.prose img { max-width: 100%; height: auto; cursor: zoom-in; }

.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; cursor: zoom-out; }
.lightbox::backdrop { background: #000c; }
.lightbox img { display: block; max-width: 96vw; max-height: 96vh; object-fit: contain; border-radius: 6px; background: #fff; }

.prose pre.mermaid { cursor: zoom-in; background: #fff; border: 0; border-radius: 8px; padding: 12px; text-align: center; overflow-x: auto; }
.lightbox-svg { display: block; width: 92vw; max-width: 1400px; height: auto; max-height: 92vh; background: #fff; border-radius: 6px; padding: 12px; box-sizing: border-box; }

/* Admin */
.admin-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.admin-form input { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border, currentColor); background: transparent; color: inherit; }
.admin-table { border-collapse: collapse; width: 100%; margin: 16px 0 24px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 12px 8px 0; vertical-align: middle; }
/* Signed-in admin link: pinned to the right edge of the viewport; its own row when too narrow for that */
.admin-link { display: block; text-align: right; padding: 0 20px 8px; color: #5fe3c0; text-decoration: none; font-family: ui-monospace, monospace; }
.admin-link:hover, .admin-link.active { text-decoration: underline; }
@media (min-width: 1100px) { .admin-link { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); padding: 0; } }
.icon-link { display: inline-flex; align-items: center; color: #0a66c2; }
.contact-list li { display: grid; grid-template-columns: 6rem 1fr; align-items: center; }

/* ---- Light theme overrides (dark is untouched) ---- */
:root[data-theme="light"] body { font: 300 16px/1.7 var(--sans); }
:root[data-theme="light"] h1, :root[data-theme="light"] h2, :root[data-theme="light"] h3 { font-family: var(--heading); font-weight: 500; letter-spacing: -0.02em; }
:root[data-theme="light"] a:hover { text-decoration: underline; }
:root[data-theme="light"] .site-header { background: var(--card); color: var(--fg); border-bottom: 1px solid var(--line); box-shadow: none; }
:root[data-theme="light"] .brand { color: var(--fg); font-family: var(--heading); font-weight: 500; letter-spacing: -0.02em; }
:root[data-theme="light"] nav a { color: var(--muted); font-weight: 400; letter-spacing: .02em; transition: color .2s; }
:root[data-theme="light"] nav a:hover { background: transparent; color: var(--accent); text-decoration: none; }
:root[data-theme="light"] nav a.active { background: transparent; box-shadow: none; color: var(--accent); font-weight: 500; }
:root[data-theme="light"] .iconbtn { color: var(--fg); border-color: var(--line); }
:root[data-theme="light"] .iconbtn:hover { border-color: var(--accent-hi); color: var(--accent); }
:root[data-theme="light"] .admin-link { color: var(--accent); }
:root[data-theme="light"] .stat,
:root[data-theme="light"] .grid .card,
:root[data-theme="light"] .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
:root[data-theme="light"] .grid .card { transition: border-color .2s, transform .2s; }
:root[data-theme="light"] .grid .card:hover { border-color: var(--accent-hi); transform: translateY(-2px); }
:root[data-theme="light"] .chip { background: var(--card2); border-radius: 6px; }
:root[data-theme="light"] .badge { border-radius: 6px; }
:root[data-theme="light"] .btnlike { background: var(--accent); color: var(--onacc); border-radius: var(--radius); font-weight: 500; transition: background .2s; }
:root[data-theme="light"] .btnlike:hover { background: var(--accent-dark); filter: none; text-decoration: none; }
:root[data-theme="light"] .prose th { background: var(--card2); }
:root[data-theme="light"] .prose blockquote { background: var(--card2); border-left: 3px solid var(--accent-hi); margin: 14px 0; padding: 4px 16px; border-radius: 0 var(--radius) var(--radius) 0; }
:root[data-theme="light"] .prose code { background: var(--card2); border: 1px solid var(--line); }
:root[data-theme="light"] .prose pre.mermaid { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
:root[data-theme="light"] .lightbox-svg { background: var(--card); border-radius: var(--radius); }
:root[data-theme="light"] .lightbox img { border-radius: var(--radius); }
:root[data-theme="light"] .site-footer { background: var(--card2); }
