/* ============================================================
   ankitpansari.com — pure static, centered, light/dark by OS.
   Chrome (titles, nav, meta, footer) in monospace — the original
   マリウス-inspired theme. Reading text in the system sans-serif
   (the original site font). Code in monospace.
   Colors come from CSS variables: a light palette by default and a
   dark palette under @media (prefers-color-scheme: dark).
   One stylesheet for the whole site. Hand-edit freely.
   ============================================================ */

:root {
  /* Light palette (default). The dark palette below follows the OS setting. */
  --bg:      #faf8f3;
  --fg:      #14171b;
  --muted:   #5c626a;
  --accent:  #a85d1a;
  --border:  #e3ded2;
  --code-bg: #f1ece1;
  --strong:  #111315;
  --accent-line: rgba(168, 93, 26, 0.35);
  --width:   720px;

  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
           Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --mono:  "SF Mono", SFMono-Regular, ui-monospace, "JetBrains Mono", Menlo,
           Consolas, "Liberation Mono", monospace;
}

/* Dark palette — the original マリウス theme, applied automatically when
   the operating system prefers dark. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #0f1214;
    --fg:      #f0ebdf;
    --muted:   #8a8f98;
    --accent:  #e7a15a;
    --border:  #262b2f;
    --code-bg: #1a1f23;
    --strong:  #f3efe3;
    --accent-line: rgba(231, 161, 90, 0.35);
  }
}

* { box-sizing: border-box; }

/* Skip-to-content link: hidden until focused (keyboard / screen-reader). */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 100;
  font-family: var(--mono);
  font-size: 0.8rem;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  border-bottom: none;
}
.skip-link:focus { left: 0.5rem; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 450;
  line-height: 1.62;
  word-break: break-word;
}

/* Centered column. */
.wrap {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Links: hover inverts (fills background) --------------- */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-line);
  transition: background 0.1s ease, color 0.1s ease;
}
/* In-prose links get a gentle highlight; the bold invert is reserved for
   nav/footer chrome (their own :hover rules below). */
a:hover {
  border-bottom-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Header / nav (monospace chrome) ----------------------- */
.site-header {
  padding: 2.6rem 0 1.3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.2rem;
}
.site-header .site-name {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.site-header .site-name:hover { background: transparent; color: var(--accent); }
/* Boxless signature dot before the name — picks up the theme accent. */
.site-header .site-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--accent);
}
.site-header .tagline {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.4rem 0 1.1rem;
}
nav.site-nav {
  font-family: var(--mono);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  font-size: 0.82rem;
}
nav.site-nav a { color: var(--muted); border-bottom: none; }
nav.site-nav a:hover { background: var(--accent); color: var(--bg); }
nav.site-nav a.active { color: var(--fg); }

/* ---- Layout regions ---------------------------------------- */
main { padding-bottom: 2rem; }

/* ---- Titles & headings (monospace) ------------------------- */
h1, h2, h3, h4 { font-family: var(--mono); line-height: 1.3; font-weight: 700; text-wrap: balance; }
h1 { font-size: 1.55rem; margin: 0 0 0.45rem; }
h2 { font-size: 1.2rem; margin: 2.1rem 0 0.7rem; }
h3 { font-size: 1.02rem; margin: 1.7rem 0 0.55rem; }
h4 { font-size: 0.95rem; margin: 1.5rem 0 0.5rem; color: var(--muted); }

/* ---- Reading text (sans) ----------------------------------- */
p { margin: 0 0 1.05rem; text-wrap: pretty; }
strong { font-weight: 700; color: var(--strong); }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

ul, ol { padding-left: 1.4rem; margin: 0 0 1.05rem; }
li { margin: 0.3rem 0; }

blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

code {
  font-family: var(--mono);
  background: var(--code-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}
pre {
  font-family: var(--mono);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: 1em; }

img { max-width: 100%; height: auto; border-radius: 6px; }

figure { margin: 1.6rem 0; }
figure img { display: block; }
figcaption {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 0.5rem;
}

table { border-collapse: collapse; width: 100%; font-size: 0.9rem; margin: 1.3rem 0; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.7rem; text-align: left; }
th { background: var(--code-bg); }

details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0;
  background: var(--code-bg);
}
summary { cursor: pointer; font-weight: 600; }

sup a { border-bottom: none; }
.footnote { font-size: 0.9rem; color: var(--muted); }
.footnote hr { margin-top: 2.6rem; }

/* ---- Home: profile + intro --------------------------------- */
.profile { max-width: 130px; border-radius: 50%; margin: 0 0 1.4rem; display: block; }
.contact-list { list-style: none; padding-left: 0; }
.contact-list li::before { content: "• "; color: var(--muted); }
.badge {
  font-family: var(--mono);
  background: #2e7d4f; color: #fff; padding: 1px 7px; border-radius: 11px;
  font-size: 0.68em; font-weight: 700; margin-right: 6px; vertical-align: middle;
}

/* ---- Post / entry listings --------------------------------- */
.entry-list { list-style: none; padding-left: 0; }
.entry-list li { margin: 0 0 1.5rem; }
.entry-list .entry-head { display: block; }
.entry-list .entry-title {
  font-family: var(--mono);
  font-weight: 700; font-size: 1.0rem;
  color: var(--fg); border-bottom: none;
}
.entry-list .entry-title:hover { color: var(--accent); background: transparent; }
.entry-list .entry-date {
  font-family: var(--mono);
  display: block;
  color: var(--muted); font-size: 0.76rem;
  margin-top: 0.15rem;
}
.entry-list .entry-excerpt { color: var(--muted); font-size: 0.92rem; margin: 0.3rem 0 0; }

/* ---- Single post meta -------------------------------------- */
.post-meta { font-family: var(--mono); color: var(--muted); font-size: 0.78rem; margin: 0 0 2rem; }
.post-meta .tag { margin-left: 0.6rem; }
.post-description { color: var(--muted); margin: 0.3rem 0 1.4rem; font-size: 1rem; }

/* ---- Footer (monospace chrome) ----------------------------- */
.site-footer {
  font-family: var(--mono);
  margin-top: 3.5rem;
  padding: 1.6rem 0 2.4rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.76rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  justify-content: space-between;
}
.site-footer a { color: var(--muted); border-bottom: none; }
.site-footer a:hover { background: var(--accent); color: var(--bg); }
.site-footer .footer-brand { display: inline-flex; align-items: center; gap: 0.55rem; }
.site-footer .footer-mark { height: 14px; width: auto; display: block; }

/* ---- Prev/next navigation between posts -------------------- */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 2.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.post-nav a { color: var(--muted); border-bottom: none; max-width: 48%; }
.post-nav a:hover { background: transparent; color: var(--accent); }
.post-nav a:hover .post-nav-title { color: var(--accent); }
.post-nav .newer { margin-left: auto; text-align: right; }
.post-nav-title { display: block; color: var(--fg); margin-top: 0.25rem; line-height: 1.3; }

/* ---- Book flashcards (replaces repeated inline styles) ------ */
.cards { margin: 1.8rem 0; }
.answer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Anchored jumps (footnotes, in-page links) clear the top edge. */
:target { scroll-margin-top: 2rem; }

@media (max-width: 560px) {
  .wrap { padding: 0 18px; }
  .site-header { padding-top: 2rem; }
  .site-footer { justify-content: flex-start; }
}
