/* Thomas Lacour — personal site. Sober, minimal, fast.      */
/* Accent borrowed from the old bipbip.ida.upmc.fr style:    */
/* green in light theme, warm coral in dark theme.            */
/* Theme is controlled by the [data-theme] attribute and     */
/* falls back to the OS preference when it is not set.       */
/* Fonts come from config.json (fonts.body / fonts.display / */
/* fonts.mono) and are self-hosted in static/fonts/ (OFL).   */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fcfbf9;
  --fg: #1c1b19;
  --muted: #62605c;
  --accent: #0e9e91;
  --accent-strong: #0a7f74;
  --border: #e7e4df;
  --card-bg: #f6f4f0;
  --max-width: 42rem;
  --font: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131211;
    --fg: #e9e7e3;
    --muted: #9b9893;
    --accent: #ff6b55;
    --accent-strong: #ff9773;
    --border: #2b2926;
    --card-bg: #1b1918;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) img {
    filter: brightness(0.95) contrast(1.05);
  }
}

:root[data-theme="dark"] {
  --bg: #131211;
  --fg: #e9e7e3;
  --muted: #9b9893;
  --accent: #ff6b55;
  --accent-strong: #ff9773;
  --border: #2b2926;
  --card-bg: #1b1918;
  color-scheme: dark;
}

:root[data-theme="dark"] img {
  filter: brightness(0.95) contrast(1.05);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

::-moz-selection {
  background: var(--accent);
  color: #131211;
}

::selection {
  background: var(--accent);
  color: #131211;
}

/* Layout */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  z-index: 10;
  transition: transform 0.22s ease;
}

html.header-hidden .site-header {
  transform: translateY(-100%);
}

.site-header nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  border-bottom: none;
  transition: color 0.15s ease;
}

.brand:hover {
  color: var(--accent);
}

.brand-home {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.nav-links a {
  border-bottom: none;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 500;
  font-family: var(--font-display);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--fg);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.theme-toggle[data-mode="auto"] svg[data-icon="auto"],
.theme-toggle[data-mode="light"] svg[data-icon="light"],
.theme-toggle[data-mode="dark"] svg[data-icon="dark"] {
  display: block;
}

main.container {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-links {
  display: inline-flex;
  gap: 0.9rem;
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-bottom: none;
  color: var(--muted);
  line-height: 0;
}

.footer-icon:hover {
  color: var(--accent);
}

.footer-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-icon-github svg,
.footer-icon-linkedin svg {
  fill: currentColor;
  stroke: none;
}

/* Typography */

h1 {
  font-size: 1.4rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
  font-weight: 500;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.updated-ago {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7em;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.05em;
  opacity: 0.55;
  margin-left: 0.4rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* Hacker titles: hidden until the typewriter JS reveals them. A <noscript>
   override in base.html restores visibility when JS is disabled. */

h1.hacker-title {
  visibility: hidden;
  font-family: var(--mono) !important;
  color: var(--accent); /* accent while typing */
}

h1.hacker-title.hacker-playing,
h1.hacker-title.hacker-static {
  visibility: visible;
}

h1.hacker-title.hacker-static {
  color: var(--fg); /* no animation → plain text colour */
}

h1.hacker-title.hacker-done .hk-settled {
  color: var(--fg); /* after typing → back to text colour */
}

/* Typewriter character states — colours resolve via CSS variables so they
   adapt automatically when the theme changes. */

.hk {
  color: var(--fg);
  transition: color 220ms ease;
}

.hk-settled {
  color: var(--accent);
}

.hk-cursor {
  color: var(--accent);
}

h2 {
  font-size: 1rem;
  margin: 2.5rem 0 0.75rem;
  font-weight: 500;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

h3 {
  font-size: 1.05rem;
  margin: 1.75rem 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

.lede {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 1.75rem;
}

.prose {
  max-width: 100%;
}

.prose p,
.prose li {
  color: var(--fg);
}

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

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: color-mix(in srgb, var(--accent) 9%, var(--card-bg));
  color: var(--fg);
  padding: 0.15em 0.35em;
  border-radius: 2px;
}

.prose pre {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1rem;
  overflow-x: auto;
}

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

.prose img {
  max-width: 100%;
  border-radius: 4px;
}

.exp-at {
  color: var(--accent);
  white-space: nowrap;
}

/* Content cards */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.about-summary .prose {
  margin: 0;
}

.about-summary h2:first-child {
  margin-top: 0;
}

/* Entry lists (blog + photo) */

.entry-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.entry-list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

.entry-list li:last-child {
  border-bottom: none;
}

.entry-list .entry-title,
.entry-list li > a {
  font-size: 0.95rem;
  font-weight: 480;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: none;
  font-family: var(--font-display);
}

.entry-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.entry-main {
  min-width: 0;
}

.entry-reading {
  flex: none;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 400;
  white-space: nowrap;
  opacity: 0.75;
}

.entry-type {
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-display);
}

.list-sub {
  margin: -0.4rem 0 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.entry-meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-meta .summary {
  margin: 0.2rem 0 0.15rem;
  color: var(--muted);
}

/* Post page */

.post-header {
  margin-bottom: 1.75rem;
}

.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: 0.5rem;
  vertical-align: baseline;
}

.chip {
  display: inline-block;
  padding: 0.05rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.68em;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 400;
  font-family: var(--font-display);
  color: var(--muted);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

a.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Tags pages */

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-list .chip {
  font-size: 0.78rem;
  padding: 0.3rem 0.85rem;
  margin-left: 0;
}

.tag-count {
  color: var(--muted);
  margin-left: 0.4rem;
  font-size: 0.85em;
}

.back-link {
  margin-top: 2.5rem;
}

/* Inline SVG figures in prose (hand-authored diagrams) */

.prose figure {
  margin: 1.5rem 0;
}

.prose figure svg {
  display: block;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  height: auto;
}

.prose figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Photos */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 1rem;
}

.gallery figure {
  margin: 0;
}

.gallery img {
  width: 100%;
  display: block;
  border-radius: 4px;
}

.album-description {
  margin-bottom: 1.5rem;
}

/* Math (KaTeX, rendered at build time) */

.katex {
  font-size: 1em;
}

.katex-display {
  margin: 1.25rem 0;
  padding: 0.25rem 0;
  overflow-x: auto;
  overflow-y: hidden;
}

[data-theme="dark"] .katex,
[data-theme="dark"] .katex-display {
  color: inherit;
}

/* Prose tables */

.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.prose table th,
.prose table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

.prose table th {
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prose table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Responsive */

@media (max-width: 480px) {
  .site-header nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}