/*
Theme Name: JR
Theme URI: https://www.j-r.me
Author: JR
Description: Minimal digital blog theme for j-r.me — notes on the projects I build.
Version: 1.0.0
Requires PHP: 8.1
Text Domain: jr
*/

/* ---------- tokens ---------- */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --faint: #a3a3a3;
  --rule: #e6e6e6;
  --accent: #e9141b;
  --code-bg: #f1f1f1;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 960px;
  --measure: 680px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0c; --surface: #131315; --fg: #ededed; --muted: #9a9a9a;
    --faint: #5c5c5c; --rule: #232326; --accent: #ff3b41; --code-bg: #17171a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0c; --surface: #131315; --fg: #ededed; --muted: #9a9a9a;
  --faint: #5c5c5c; --rule: #232326; --accent: #ff3b41; --code-bg: #17171a;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: inherit; text-decoration-color: var(--faint); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
::selection { background: var(--accent); color: #fff; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.measure { max-width: var(--measure); }
.mono { font-family: var(--mono); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header ---------- */
.site-header { padding: 28px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  background: var(--fg); color: var(--bg);
  font: 600 16px/1 var(--mono); letter-spacing: .02em;
  text-decoration: none;
}
.brand:hover { background: var(--accent); color: #fff; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; }
.site-nav a {
  font: 400 13px/1 var(--mono); text-transform: lowercase; letter-spacing: .02em;
  text-decoration: none; color: var(--muted);
}
.site-nav a:hover, .site-nav .current-menu-item > a, .site-nav .current_page_item > a, .site-nav a[aria-current] { color: var(--fg); }
.site-nav .current-menu-item > a::before, .site-nav a[aria-current]::before { content: "/"; color: var(--accent); margin-right: 2px; }

/* ---------- hero ---------- */
.hero { padding: 72px 0 56px; border-bottom: 1px solid var(--rule); }
.hero .kicker { font: 400 12px/1 var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 20px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.15; letter-spacing: -.02em; font-weight: 600; margin: 0; max-width: 18ch; }
.hero h1 .caret { display: inline-block; width: .55em; height: .9em; background: var(--accent); vertical-align: -0.08em; margin-left: 6px; animation: blink 1.1s steps(1) infinite; }
.hero p { color: var(--muted); font-size: 19px; margin: 20px 0 0; max-width: 52ch; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hero h1 .caret { animation: none; } }

/* ---------- project filter ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 28px 0 8px; margin: 0; list-style: none; }
.filters a {
  display: inline-block; font: 400 12px/1 var(--mono); padding: 8px 10px;
  border: 1px solid var(--rule); color: var(--muted); text-decoration: none;
}
.filters a:hover, .filters a.is-active { border-color: var(--fg); color: var(--fg); }
.filters .count { color: var(--faint); margin-left: 6px; }

/* ---------- post index ---------- */
.section-label { font: 400 12px/1 var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 48px 0 8px; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { border-bottom: 1px solid var(--rule); }
.post-row a {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 24px; align-items: baseline;
  padding: 22px 0; text-decoration: none;
}
.post-row time, .post-row .tag { font: 400 12px/1.4 var(--mono); color: var(--muted); }
.post-row .tag { text-transform: lowercase; }
.post-row .title { font-size: 19px; font-weight: 500; letter-spacing: -.01em; line-height: 1.35; }
.post-row .excerpt { display: block; color: var(--muted); font-size: 15px; font-weight: 400; margin-top: 6px; line-height: 1.55; }
.post-row a:hover .title { color: var(--accent); }
@media (max-width: 640px) {
  .post-row a { grid-template-columns: auto 1fr; gap: 6px 14px; }
  .post-row .tag { grid-column: 2; grid-row: 1; }
  .post-row .tag::before { content: "/ "; color: var(--faint); }
  .post-row .title { grid-column: 1 / -1; grid-row: 2; }
}

.pagination { display: flex; justify-content: space-between; padding: 32px 0; font: 400 13px/1 var(--mono); }
.pagination a { text-decoration: none; color: var(--muted); }
.pagination a:hover { color: var(--fg); }

/* ---------- archive header ---------- */
.archive-head { padding: 56px 0 8px; }
.archive-head .kicker { font: 400 12px/1 var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 14px; }
.archive-head h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -.02em; line-height: 1.2; margin: 0; font-weight: 600; }
.archive-head p { color: var(--muted); margin: 12px 0 0; }

/* ---------- article ---------- */
.entry { padding: 56px 0 24px; }
.entry-meta { font: 400 12px/1.6 var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 14px; margin-bottom: 18px; }
.entry-meta a { text-decoration: none; }
.entry-meta .sep { color: var(--faint); }
.entry-title { font-size: clamp(30px, 5vw, 44px); line-height: 1.15; letter-spacing: -.02em; font-weight: 600; margin: 0 0 18px; }
.entry-lede { font-size: 20px; color: var(--muted); margin: 0 0 32px; line-height: 1.55; }
.entry-hero { margin: 32px 0 40px; border: 1px solid var(--rule); }
.entry-hero img { display: block; width: 100%; }

.entry-content { font-size: 18px; }
.entry-content > * { max-width: var(--measure); }
.entry-content > .alignwide { max-width: var(--wrap); }
.entry-content > .alignfull { max-width: none; }
.entry-content h2 { font-size: 24px; letter-spacing: -.01em; line-height: 1.3; margin: 2.2em 0 .6em; font-weight: 600; }
.entry-content h3 { font-size: 19px; margin: 1.8em 0 .5em; font-weight: 600; }
.entry-content h2::before { content: "## "; font-family: var(--mono); font-weight: 400; color: var(--accent); font-size: .8em; }
.entry-content p, .entry-content ul, .entry-content ol { margin: 0 0 1.3em; }
.entry-content li { margin-bottom: .35em; }
.entry-content blockquote { margin: 1.8em 0; padding: 0 0 0 20px; border-left: 2px solid var(--accent); color: var(--muted); }
.entry-content hr, .wp-block-separator { border: 0; border-top: 1px solid var(--rule); margin: 3em 0; }
.entry-content figure { margin: 2em 0; }
.entry-content figure img { border: 1px solid var(--rule); }
.entry-content figcaption, .wp-element-caption { font: 400 12px/1.5 var(--mono); color: var(--muted); margin-top: 10px; }
.entry-content code { font: 400 .86em var(--mono); background: var(--code-bg); padding: .15em .4em; }
.entry-content pre, .wp-block-code {
  font: 400 14px/1.65 var(--mono); background: var(--code-bg); border: 1px solid var(--rule);
  padding: 18px 20px; overflow-x: auto; margin: 1.8em 0;
}
.entry-content pre code { background: none; padding: 0; font-size: inherit; }
.entry-content table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 1.8em 0; }
.entry-content th, .entry-content td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); }
.entry-content th { font: 400 12px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.wp-block-button__link { background: var(--fg); color: var(--bg); border-radius: 0; font: 400 14px/1 var(--mono); padding: 14px 20px; text-decoration: none; }
.wp-block-button__link:hover { background: var(--accent); color: #fff; }

.project-card {
  display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--rule); background: var(--surface); padding: 16px 20px; margin: 40px 0 0;
  font: 400 13px/1.5 var(--mono);
}
.project-card .label { color: var(--muted); }
.project-card a { text-decoration: none; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; border-top: 1px solid var(--rule); margin-top: 56px; padding: 28px 0; }
.post-nav a { text-decoration: none; display: block; }
.post-nav .dir { display: block; font: 400 12px var(--mono); color: var(--muted); margin-bottom: 6px; }
.post-nav .next { text-align: right; }

/* ---------- page ---------- */
.page-entry .entry-title { margin-bottom: 32px; }
.about-photo { width: 250px; height: 250px; max-width: 100%; object-fit: cover; object-position: 50% 35%; border-radius: 50%; margin: 0 0 28px; border: 1px solid var(--rule); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 72px; padding: 28px 0 40px; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font: 400 12px/1.6 var(--mono); color: var(--muted); }
.site-footer a { text-decoration: none; }
.site-footer nav a + a { margin-left: 18px; }
.theme-toggle { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; margin-left: 18px; }
.theme-toggle:hover { color: var(--fg); }

/* ---------- 404 ---------- */
.not-found { padding: 120px 0; }
.not-found .code { font: 400 13px var(--mono); color: var(--accent); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .site-nav ul { gap: 14px; }
  .hero { padding: 48px 0 40px; }
  .entry-content { font-size: 17px; }
}
