/* ------------------------------------------------------------------
   fonts
   IntoneMono (Intel One Mono, Nerd Fonts patch) is only used by the
   dracula theme, so the browser only downloads it there. Subset to
   Latin + punctuation; license in fonts/OFL.txt.
------------------------------------------------------------------- */
@font-face {
  font-family: "IntoneMono Nerd Font Mono";
  src: url("../fonts/IntoneMonoNerdFontMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IntoneMono Nerd Font Mono";
  src: url("../fonts/IntoneMonoNerdFontMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IntoneMono Nerd Font Mono";
  src: url("../fonts/IntoneMonoNerdFontMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IntoneMono Nerd Font Mono";
  src: url("../fonts/IntoneMonoNerdFontMono-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ------------------------------------------------------------------
   tokens
   dark is the default; light and dracula are picked from the toggle.
------------------------------------------------------------------- */
:root {
  --font-fallback: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
  --font: "JetBrains Mono", var(--font-fallback);

  --bg: #0c0c0d;
  --surface: #141416;
  --fg: #d6d6d1;
  --strong: #f5f5f0;
  --dim: #8a8a90;
  --faint: #4b4b51;
  --line: #222226;
  --accent: #7ee0a5;

  --heading: var(--strong);
  --label: var(--dim);
  --slug: var(--accent);
  --link: var(--strong);
  --link-line: var(--faint);
  --draft: var(--dim);
  --published: var(--accent);
  --manuscript: var(--dim);
  --select: rgb(126 224 165 / 0.22);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f6f2;
  --surface: #efede7;
  --fg: #2a2a2c;
  --strong: #0d0d0e;
  --dim: #6a6a70;
  --faint: #b4b2ab;
  --line: #e2e0d9;
  --accent: #137a47;
  --select: rgb(19 122 71 / 0.16);
  color-scheme: light;
}

/* same palette as the curl version */
:root[data-theme="dracula"] {
  --font: "IntoneMono Nerd Font Mono", "JetBrains Mono", var(--font-fallback);

  --bg: #282a36;
  --surface: #21222c;
  --fg: #f8f8f2;
  --strong: #f8f8f2;
  --dim: #8b93c4;
  --faint: #6272a4;
  --line: #44475a;
  --accent: #50fa7b;

  --heading: #bd93f9;
  --label: #ff79c6;
  --slug: #ff79c6;
  --link: #8be9fd;
  --link-line: #6272a4;
  --draft: #f1fa8c;
  --published: #50fa7b;
  --manuscript: #bd93f9;
  --select: rgb(189 147 249 / 0.3);
  color-scheme: dark;
}

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

html {
  font-size: 93.75%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p,
ul,
dl,
dd {
  margin: 0;
}

::selection {
  background: var(--select);
  color: var(--strong);
}

:focus-visible {
  outline: 1px dashed var(--accent);
  outline-offset: 3px;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

a[target="_blank"]::after {
  content: " ↗";
  color: var(--dim);
  font-weight: 400;
}

button {
  font: inherit;
  color: inherit;
}

code {
  font: inherit;
}

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

.line {
  display: block;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 20;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.skip:focus {
  left: 16px;
}

/* ------------------------------------------------------------------
   frame
------------------------------------------------------------------- */
.page {
  max-width: 54rem;
  margin: 0 auto;
  padding: 0 24px;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2ch;
  margin-top: 12px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem;
}

.bar-links {
  display: flex;
  gap: 2.5ch;
  flex: 1;
  min-width: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.bar-links::-webkit-scrollbar {
  display: none;
}

.bar-links a {
  color: var(--dim);
  text-decoration: none;
  white-space: nowrap;
}

.bar-links a:hover {
  color: var(--strong);
}

.bar-links a[aria-current] {
  color: var(--accent);
}

.theme-toggle {
  flex: none;
  padding: 2px 8px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

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

.theme-toggle span {
  margin-left: 1ch;
  color: var(--strong);
}

/* ------------------------------------------------------------------
   hero
------------------------------------------------------------------- */
.hero {
  padding: 40px 0 24px;
}

.greet {
  min-height: 1.7em;
  color: var(--accent);
  font-size: 0.9375rem;
}

.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero h1 {
  margin-top: 14px;
  color: var(--strong);
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.role {
  margin-top: 12px;
  font-size: 1.0625rem;
}

.synopsis {
  margin-top: 28px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--strong);
  font-size: 0.875rem;
}

.synopsis .opt {
  color: var(--dim);
}

.synopsis .opt,
.synopsis .arg {
  white-space: nowrap;
}

.synopsis .arg {
  color: var(--accent);
  font-style: italic;
}

/* ------------------------------------------------------------------
   sections
------------------------------------------------------------------- */
.section {
  padding-top: 64px;
}

.section h2 {
  display: flex;
  align-items: center;
  gap: 2ch;
  margin-bottom: 28px;
  color: var(--heading);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.body {
  padding-left: 4ch;
}

.body > p + .kv {
  margin-top: 24px;
}

/* entries: experience, projects, research */
.entry + .entry {
  margin-top: 40px;
}

.entry > * + * {
  margin-top: 8px;
}

.entry-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 3ch;
}

.entry-head h3 {
  color: var(--strong);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.entry-head h3 a {
  color: inherit;
}

.entry-head h3 a:hover {
  color: var(--accent);
}

.at {
  color: var(--dim);
  font-weight: 400;
}

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

.when {
  color: var(--dim);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.status-draft {
  color: var(--draft);
}

.status-published {
  color: var(--published);
}

.status-manuscript {
  color: var(--manuscript);
}

.tags {
  color: var(--dim);
  font-size: 0.8125rem;
}

.dash {
  padding: 0;
  list-style: none;
}

.dash li {
  position: relative;
  padding-left: 2ch;
}

.dash li::before {
  content: "-";
  position: absolute;
  left: 0;
  color: var(--dim);
}

/* project details */
summary {
  display: inline-block;
  color: var(--dim);
  font-size: 0.8125rem;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "[+] ";
}

details[open] > summary::before {
  content: "[-] ";
}

summary:hover {
  color: var(--strong);
}

.more {
  margin: 12px 0 4px;
  padding-left: 2ch;
  border-left: 1px solid var(--line);
}

.more > * + * {
  margin-top: 10px;
}

.more h4 {
  margin-top: 20px;
  color: var(--dim);
  font-size: 0.8125rem;
  font-weight: 500;
}

.more h4::before {
  content: "# ";
}

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
  padding-top: 10px;
}

.shot {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  transition: border-color 0.15s;
}

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

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* key / value lists: about, skills, contact */
.kv {
  display: grid;
  grid-template-columns: 14ch 1fr;
  gap: 8px 2ch;
}

.kv dt {
  color: var(--label);
}

.cmd {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 1.5ch;
}

.cmd code {
  color: var(--strong);
  overflow-wrap: anywhere;
}

.copy {
  padding: 0 6px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--dim);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.copy:hover {
  border-color: var(--faint);
  color: var(--strong);
}

/* ------------------------------------------------------------------
   footer
------------------------------------------------------------------- */
.footer {
  margin-top: 96px;
  padding: 16px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.8125rem;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 2ch;
}

/* ------------------------------------------------------------------
   screenshot viewer
------------------------------------------------------------------- */
.viewer {
  max-width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.viewer::backdrop {
  background: rgb(0 0 0 / 0.75);
}

.viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2ch;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.8125rem;
}

.viewer-bar button {
  flex: none;
  padding: 0;
  background: none;
  border: 0;
  color: var(--dim);
  cursor: pointer;
}

.viewer-bar button:hover {
  color: var(--strong);
}

.viewer img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 32px - 46px);
  margin: 0 auto;
  object-fit: contain;
}

/* ------------------------------------------------------------------
   small screens
------------------------------------------------------------------- */
@media (max-width: 720px) {
  .body {
    padding-left: 0;
  }
}

@media (max-width: 560px) {
  html {
    font-size: 87.5%;
  }

  .page {
    padding: 0 16px;
  }

  .bar-links {
    mask-image: linear-gradient(to right, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
  }

  .hero {
    padding-top: 28px;
  }

  .section {
    padding-top: 52px;
  }

  .entry-head {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .kv dd + dt {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .caret {
    animation: none;
  }
}
