/* Self-hosted JetBrains Mono (variable, latin subset) so headings/UI render
   identically across devices instead of falling back to SF Mono/Consolas. */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

:root {
  --bg: #fdfdfc;
  --text: #1a1a1a;
  --link: #2a4d8f;
  --muted: #666;
  --code-bg: #f0eee6;
  --rule: #e2e0d8;
  --heading: #00356b;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* Dark palette — opt-in only; the site defaults to light regardless of OS */
:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e8e6e3;
  --link: #8ab4f8;
  --muted: #999;
  --code-bg: #2a2a2a;
  --rule: #333;
  --heading: #7fa6d6;
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* Two-column layout: sticky sidebar + content */
.layout {
  display: flex;
  gap: 4.5rem;
  padding: 3rem 4rem 4rem;
  min-height: 100vh;
  box-sizing: border-box;
}

.sidebar {
  flex: 0 0 210px;
  position: sticky;
  top: 3rem;
  align-self: flex-start;
}

main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 70rem;
}

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

img { max-width: 100%; height: auto; }

h1, h2, h3 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; color: var(--heading); }
h2 { font-size: 1.15rem; margin: 1.75rem 0 0.75rem; color: var(--heading); }
h3 { font-size: 1rem; margin: 0; color: var(--heading); }

p { margin: 0.75rem 0; }

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

ul { padding-left: 1.25rem; }
li { margin: 0.35rem 0; }

code, pre {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
}

code { padding: 0.1em 0.35em; border-radius: 3px; }

pre {
  padding: 0.9rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
}

pre code { background: none; padding: 0; }

blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}

.muted { color: var(--muted); }

.profile {
  float: right;
  width: 160px;
  height: auto;
  margin: 0.25rem 0 1.25rem 2rem;
  border-radius: 6px;
}

.more-link {
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--link);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--link);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--link);
  color: var(--bg);
  text-decoration: none;
}

.summary-list { list-style: none; padding-left: 0; }
.summary-list li { margin: 0.55rem 0; }

/* Sidebar */
.site-name {
  display: block;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--text);
  text-decoration: none;
}

.tagline {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
}

nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
  color: var(--link);
  text-decoration: none;
}

nav a:hover { text-decoration: underline; }

nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

.icon { flex: none; }

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 1.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.sidebar-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  width: max-content;
}

.sidebar-heading {
  margin: 1.75rem 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.tt-label { color: var(--muted); }

.theme-toggle:not([aria-pressed="true"]) .tt-light,
.theme-toggle[aria-pressed="true"] .tt-dark {
  color: var(--text);
  font-weight: 600;
}

.tt-track {
  position: relative;
  box-sizing: border-box;
  flex: none;
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: var(--code-bg);
  border: 1px solid var(--rule);
}

.tt-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.18s ease;
}

.theme-toggle[aria-pressed="true"] .tt-knob {
  transform: translateX(18px);
}

/* sun/moon icons: hidden by default, shown only in the mobile toggle */
.tt-icon { display: none; }

/* Footer */
footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

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

/* CV role headers: title left, dates right */
.role-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 1.25rem;
}

.dates {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Date right-aligned within a list item (e.g. extracurricular entries) */
.li-dates {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

/* Writing list */
.post-list { list-style: none; padding-left: 0; }
.post-list li { margin: 1.25rem 0; }
.post-list .dates { margin-left: 0.5rem; }
.post-list p { margin: 0.25rem 0 0; }

/* Phone view: stacked header + app-style bottom icon bar for page nav */
@media (max-width: 680px) {
  .layout {
    flex-direction: column;
    gap: 1.75rem;
    padding: 0.5rem 1.25rem 5rem;   /* tight top for mobile; bottom space clears the fixed nav bar */
  }
  .sidebar {
    position: relative;
    flex-basis: auto;
    align-self: stretch;       /* fill full width so the toggle can pin to the right edge */
  }

  /* breathing room between the header (social links) and the first content heading */
  main { margin-top: 2.25rem; }

  /* GitHub / LinkedIn / X stay as text links just under the tagline */
  .sidebar-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 1rem;
  }

  /* Page nav: fixed bottom bar, icons only */
  nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0.55rem 0.5rem;
    background: var(--bg);
    border-top: 1px solid var(--rule);
  }
  nav a {
    width: auto;
    gap: 0;
    padding: 0.3rem 0.7rem;
    font-size: 0;            /* hide the text label, keep the icon (still read by screen readers) */
    color: var(--muted);
  }
  nav a[aria-current="page"] { color: var(--link); }
  nav .icon { width: 22px; height: 22px; }

  /* instant feedback on tap, since the next page can take a moment to load */
  nav a:active {
    color: var(--link);
    transform: scale(0.85);
  }

  /* Theme toggle: sun · pill switch · moon, pinned top-right on the name's line */
  .sidebar-heading { display: none; }
  .theme-control {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
  }
  .theme-toggle { gap: 0.4rem; }
  .theme-toggle .tt-label { display: none; }      /* hide the "Light"/"Dark" words */
  .tt-icon { display: inline; width: 15px; height: 15px; color: var(--muted); }
  .tt-sun { order: 1; }
  .tt-track { order: 2; width: 42px; height: 24px; border-radius: 12px; }
  .tt-moon { order: 3; }
  .tt-knob { width: 18px; height: 18px; }
  .theme-toggle[aria-pressed="true"] .tt-knob { transform: translateX(18px); }
  .theme-toggle:not([aria-pressed="true"]) .tt-sun { color: var(--text); }   /* highlight active mode */
  .theme-toggle[aria-pressed="true"] .tt-moon { color: var(--text); }

  .profile {
    float: right;
    width: 110px;
    margin: 0 0 1rem 1.25rem;
  }

  .role-header,
  .li-dates {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
}
