/* White paper with retro accents: oxblood red for accents, sage green for highlights. */
:root {
  --bg: #ffffff;
  --fg: #1f1a17;
  --muted: #7d7470;
  --line: #e4e0dc;
  --line-soft: #eeebe8;
  --panel: #f6f4f1;
  --red: #6a0c06;
  --green: #b2c7ab;
  --green-soft: #dfe8dc;
  --on-red: #ffffff;
  --tile-1: #dfe8dc;
  --tile-2: #cfdcc9;
  --tile-3: #e8efe5;
  --tile-4: #d6e2d1;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --page: 880px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1512;
    --fg: #ece7e2;
    --muted: #9d948e;
    --line: #342d29;
    --line-soft: #2a2420;
    --panel: #241e1a;
    --red: #d65a45;
    --green: #b2c7ab;
    --green-soft: rgba(178, 199, 171, 0.22);
    --on-red: #1a1512;
    --tile-1: #b2c7ab;
    --tile-2: #a6bd9f;
    --tile-3: #c3d4bd;
    --tile-4: #b9ccb2;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.65;
  overflow-wrap: break-word;
}

::selection { background: var(--green); color: #1f1a17; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--red); text-decoration-thickness: 2px; }

strong { font-weight: 600; }
.muted { color: var(--muted); }

/* key phrases: ==text== in markdown, set on a green block */
mark {
  background: var(--green);
  color: #1f1a17;
  padding: 0.05em 0.3em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* small spaced capitals used for labels */
.caps {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78em;
  font-weight: 500;
}

.container {
  width: 100%;
  max-width: calc(var(--page) + 48px);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
main.container { flex: 1; padding-top: 2.5rem; padding-bottom: 3.5rem; }

/* ---------- nav ---------- */

.nav { padding-top: 1.25rem; padding-bottom: 0.9rem; border-bottom: 1.5px solid var(--red); }
.menu { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; }
.menu a {
  padding: 0.15em 0.55em;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8em;
  font-weight: 500;
}
.menu a:hover { color: var(--red); }
.menu a.active { background: var(--red); color: var(--on-red); }

/* ---------- headings ---------- */

.kicker { margin: 0 0 0.35rem; color: var(--red); font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.12em; }
.kicker a { color: inherit; text-decoration: none; }

.title {
  margin: 0 0 0.9rem;
  font-size: clamp(2rem, 4.4vw, 2.9rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.title .dot { color: var(--red); }
.title .cn { font-weight: 400; color: var(--muted); font-size: 0.55em; letter-spacing: 0; }

.lead { max-width: 56ch; margin: 0 0 1.25rem; font-size: 1.05em; }
.lead em { font-style: normal; font-weight: 600; }

/* ---------- home: hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 2.5rem;
}
.hero-photo { position: relative; margin: 0 12px 12px 0; }
.hero-photo::before {
  content: "";
  position: absolute;
  inset: 12px -12px -12px 12px;
  border: 1.5px solid var(--red);
}
.hero-photo::after {
  content: "";
  position: absolute;
  right: -17px;
  bottom: -17px;
  width: 9px;
  height: 9px;
  background: var(--red);
}
.hero-photo img {
  position: relative;
  display: block;
  width: clamp(150px, 20vw, 200px);
  aspect-ratio: 1;
  object-fit: cover;
}
.buttons { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.button {
  display: inline-block;
  padding: 0.3em 0.75em;
  border: 1px solid var(--line);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75em;
  font-weight: 500;
}
.button:hover { background: var(--red); border-color: var(--red); color: var(--on-red); }

/* ---------- home: numbered sections ---------- */

.sections {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  column-gap: 1.5rem;
}
.sections .label,
.sections .content {
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}
.sections .label {
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78em;
  font-weight: 500;
  padding-top: calc(1.25rem + 0.2em);
}
.sections .label .num { color: var(--red); }
.sections .label .num::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.6em;
  vertical-align: 0.1em;
  background: var(--red);
}
.sections .label .slash { color: var(--muted); }

.prose p { margin: 0 0 0.8em; }
.prose p:last-child { margin-bottom: 0; }
.prose code {
  padding: 0.05em 0.35em;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  font-family: inherit;
  font-size: 0.95em;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.chips li {
  padding: 0.1em 0.65em;
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  font-size: 0.92em;
}

/* date | text rows used for news, experience, publications, posts */
ul.rows { list-style: none; margin: 0; padding: 0; }
ul.rows li {
  display: grid;
  grid-template-columns: 9ch minmax(0, 1fr);
  gap: 1rem;
  padding: 0.3rem 0;
}
ul.rows li + li { border-top: 1px dashed var(--line-soft); }
ul.rows .when { color: var(--muted); font-size: 0.88em; padding-top: 0.1em; font-variant-numeric: tabular-nums; }
ul.rows .what p { margin: 0; }
ul.rows .where { color: var(--muted); }
ul.rows.posts li { grid-template-columns: 11ch minmax(0, 1fr); }

.authors .me { font-weight: 600; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }

.links { display: inline-flex; flex-wrap: wrap; gap: 0 0.5rem; margin-left: 0.25rem; }
.links a { color: var(--red); text-decoration: none; font-size: 0.88em; font-weight: 500; }
.links a:hover { text-decoration: underline; }

details.more { margin-top: 0.5rem; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 0.88em; }
details.more summary:hover { color: var(--red); }
details.more ul.rows { margin-top: 0.35rem; }

.tags { display: inline-flex; flex-wrap: wrap; gap: 0 0.6rem; margin-left: 0.5rem; font-size: 0.85em; }
.tags a { text-decoration: none; color: var(--muted); }
.tags a:hover { color: var(--red); }

/* ---------- projects: cover tile + name + one line, as on shikun.io ---------- */

.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem 1.75rem;
  margin-top: 2rem;
}
.project:nth-child(4n+1) .project-cover { background: var(--tile-1); }
.project:nth-child(4n+2) .project-cover { background: var(--tile-2); }
.project:nth-child(4n+3) .project-cover { background: var(--tile-3); }
.project:nth-child(4n+4) .project-cover { background: var(--tile-4); }
.project-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border: 1px solid transparent;
  text-decoration: none;
  overflow: hidden;
  transition: box-shadow 0.4s ease, transform 0.4s ease;
}
.project-cover:hover {
  border-color: var(--red);
  box-shadow: 6px 6px 0 var(--red);
  transform: translate(-3px, -3px);
}
.project-cover img {
  width: auto;
  max-width: 92%;
  max-height: 86%;
  mix-blend-mode: multiply;
}
.cover-text {
  color: #6a0c06;
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.05em;
}
.project-title { margin: 0.8rem 0 0.15rem; font-size: 1.05em; font-weight: 700; line-height: 1.35; }
.project-title a { text-decoration: none; }
.project-title a:hover { color: var(--red); }
.project-intro { margin: 0 0 0.3rem; line-height: 1.45; }
.project-meta { margin: 0; color: var(--muted); font-size: 0.85em; }
.project-meta .links { margin-left: 0.4rem; }


/* ---------- blog post ---------- */

.post { max-width: 72ch; }
.post .title { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
.post-meta { color: var(--muted); font-size: 0.88em; margin: 0 0 1.75rem; }
.post .prose h1, .post .prose h2, .post .prose h3 { font-weight: 700; line-height: 1.3; margin: 1.8em 0 0.5em; }
.post .prose h1 { font-size: 1.35em; }
.post .prose h2 { font-size: 1.15em; }
.post .prose h3 { font-size: 1.05em; }
.post .prose h1::before, .post .prose h2::before { content: "# "; color: var(--red); }
.post .prose ul, .post .prose ol { padding-left: 1.5em; }
.post .prose figure { margin: 1.5rem 0; text-align: center; }
.post .prose img { max-width: 100%; height: auto; }
.post .prose figcaption { color: var(--muted); font-size: 0.85em; margin-top: 0.4rem; }
.post .prose figcaption h4 { margin: 0; font-weight: 400; }
.post .prose blockquote { margin: 1.25em 0; padding-left: 1em; border-left: 3px solid var(--green); color: var(--muted); }
.post .prose pre { padding: 0.9rem; border: 1px solid var(--line-soft); background: var(--panel); overflow-x: auto; }
.post .prose pre code { padding: 0; border: 0; background: none; }

/* ---------- footer ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1.5rem;
  border-top: 1.5px solid var(--red);
  color: var(--muted);
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.footer p { margin: 0; }

/* ---------- small screens ---------- */

@media (max-width: 680px) {
  .container { padding-left: 16px; padding-right: 16px; }
  main.container { padding-top: 1.75rem; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; margin-bottom: 1.75rem; }
  .hero-photo { order: -1; justify-self: start; }
  .hero-photo img { width: 120px; }
  .sections { grid-template-columns: minmax(0, 1fr); }
  .sections .content { border-top: 0; padding-top: 0; }
  .sections .label { padding-bottom: 0.5rem; }
  ul.rows li, ul.rows.posts li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .projects { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- home: news bulletin ---------- */

.news {
  margin: 0 0 2.25rem;
  border: 1.5px solid var(--red);
  box-shadow: 7px 7px 0 var(--green);
}
.news-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.3rem 0.9rem;
  background: var(--red);
  color: var(--on-red);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78em;
}
.news-head h2 { margin: 0; font-size: inherit; font-weight: 600; }
.news-head h2::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.6em;
  vertical-align: 0.1em;
  background: var(--on-red);
}
.news-head span { opacity: 0.8; }
.news-list { list-style: none; margin: 0; padding: 0.2rem 0.9rem; font-size: 0.93em; line-height: 1.55; }
.news-list li {
  display: grid;
  grid-template-columns: 10ch minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding: 0.35rem 0;
}
.news-list li + li { border-top: 1px dashed var(--line); }
.stamp {
  justify-self: start;
  padding: 0 0.4em;
  border: 1px solid var(--red);
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75em;
  white-space: nowrap;
}
.news-list .what p { margin: 0; }
.new {
  padding: 0.05em 0.4em;
  background: var(--green);
  color: #1f1a17;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7em;
  font-weight: 600;
  vertical-align: 0.1em;
}
.news details.more { margin: 0; padding: 0 0.9rem 0.45rem; }
.news details.more .news-list { padding: 0; }
.news details.more > summary { padding-top: 0.25rem; border-top: 1px dashed var(--line); }

@media (max-width: 680px) {
  .news { box-shadow: 5px 5px 0 var(--green); margin-right: 5px; }
  .news-head span { display: none; }
  .news-list li { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; }
}
