/* Warm paper with retro accents: oxblood red for accents, sage green for highlights. */

/* IBM Plex Mono (SIL Open Font License 1.1), self-hosted from static/fonts/.
   font-display: optional means text never visibly swaps fonts on refresh. */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/plex-mono-regular-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/plex-mono-regular-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/plex-mono-regular-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("../fonts/plex-mono-regular-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url("../fonts/plex-mono-medium-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url("../fonts/plex-mono-medium-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("../fonts/plex-mono-semibold-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("../fonts/plex-mono-semibold-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("../fonts/plex-mono-bold-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("../fonts/plex-mono-bold-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #fbf9f5;
  --fg: #1f1a17;
  --muted: #6e6561;
  --line: #e6e1da;
  --line-soft: #efebe5;
  --panel: #f3efe9;
  --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;
}

/* dark palette: follows the system setting unless the visitor picked a theme with the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --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;
  }
}
:root[data-theme="dark"] {
  --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;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: light dark;
  /* always reserve the scrollbar's space, so short and long pages line up */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.9375rem;
  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; }

/* small arrow after external links that have no underline (buttons, [paper]-style
   links, project titles); underlined text links are already clearly links.
   Drawn as an empty inline box with an icon mask, so it takes the link's color
   and never wraps onto a line of its own. */
:is(.button, .links a, .project-title a)[href^="http"]:not([href^="https://effyli.github.io"])::after {
  content: "";
  padding-left: 0.7em;
  margin-left: 0.1em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M3 9L9 3M4 3h5v5'/%3E%3C/svg%3E") no-repeat 50% 35% / 0.7em 0.7em;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M3 9L9 3M4 3h5v5'/%3E%3C/svg%3E") no-repeat 50% 35% / 0.7em 0.7em;
  opacity: 0.55;
}
:is(.button, .links a, .project-title a):hover::after { opacity: 1; }

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

/* keyboard focus: visible ring on every interactive element */
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* 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 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem 1rem;
  padding-top: 1.25rem;
  padding-bottom: 0.9rem;
  border-bottom: 1.5px solid var(--red);
}
.theme-toggle {
  padding: 0.15em 0.55em;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8em;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--red); color: var(--red); }
.theme-toggle[hidden] { display: none; }
.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);
  height: auto; /* the width/height attributes only reserve space; keep it square */
  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[hidden] { display: none; }
button.button { font-family: inherit; background: transparent; color: inherit; cursor: pointer; }
.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); }
.sections .content > p.summary { margin: 0 0 0.5rem; }
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; /* tiles stay light in both themes, so keep the dark red */
  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; }

/* ---------- cv: PDF pages drawn inline ---------- */

.cv-actions { margin: 0 0 1.75rem; }
.cv-viewer { display: grid; justify-items: start; gap: 1.75rem; padding-bottom: 7px; }
.cv-page {
  position: relative;
  max-width: calc(100% - 7px);
  background: #ffffff;
  border: 1.5px solid var(--red);
  box-shadow: 7px 7px 0 var(--green);
}
.cv-page canvas { display: block; width: 100%; height: 100%; }
.cv-link { position: absolute; }
.cv-link:hover { background: rgba(178, 199, 171, 0.35); }
.cv-status { margin: 0; }

/* ---------- 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.8em;
  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.75em;
  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); }

/* touch screens: tap targets of at least ~40px */
@media (pointer: coarse) {
  .menu a { padding: 0.6em 0.7em; }
  .theme-toggle { padding: 0.6em 0.7em; }
  .button { padding: 0.75em 0.9em; }
  .links a { display: inline-block; padding: 0.35em 0; }
  details.more summary { padding-block: 0.5em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .project-cover:hover { transform: none; }
}

@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; }
}
