/* ==========================================================================
   ritacyber.com
   Cobalt ink on paper, with a highlighter for the few things worth marking.
   Type: Newsreader (headings), Atkinson Hyperlegible Next (text),
         Atkinson Hyperlegible Mono (the agent prompt only).
   Fonts are self-hosted in /assets/fonts (SIL Open Font License).
   ========================================================================== */

@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-standard-normal.woff2") format("woff2-variations"),
       url("fonts/newsreader-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-latin-wght-italic.woff2") format("woff2-variations"),
       url("fonts/newsreader-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2-variations"),
       url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2-variations"),
       url("fonts/atkinson-hyperlegible-next-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono";
  src: url("fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2") format("woff2-variations"),
       url("fonts/atkinson-hyperlegible-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --paper: #F7F8FB;
  --sheet: #FFFFFF;
  --ink: #141A33;
  --ink-2: #4A5273;
  --ink-3: #5F6788;
  --cobalt: #2041C8;
  --cobalt-tint: #E6EBFA;
  --on-cobalt: #FFFFFF;
  --night: #0E1A5C;
  --night-text: #E3E8FF;
  --night-muted: #AEB9F2;
  --hl: #F7E36A;
  --rule: #D9DEEB;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --margin-col: 12rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0C1126;
    --sheet: #121A36;
    --ink: #E6E9F5;
    --ink-2: #AEB5D2;
    --ink-3: #959DBF;
    --cobalt: #93A9FF;
    --cobalt-tint: #1B2550;
    --on-cobalt: #0C1126;
    --night: #070D2E;
    --hl: rgba(247, 214, 64, 0.42);
    --rule: #263055;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0C1126;
  --sheet: #121A36;
  --ink: #E6E9F5;
  --ink-2: #AEB5D2;
  --ink-3: #959DBF;
  --cobalt: #93A9FF;
  --cobalt-tint: #1B2550;
  --on-cobalt: #0C1126;
  --night: #070D2E;
  --hl: rgba(247, 214, 64, 0.42);
  --rule: #263055;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

p { margin: 0 0 1rem; }

a {
  color: var(--cobalt);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection { background: var(--hl); color: var(--ink); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  font-optical-sizing: auto;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

em, cite { font-style: italic; }
cite { font-family: var(--serif); font-size: 1.04em; }

code, kbd, pre { font-family: var(--mono); }
:where(p, li, dd) > code {
  font-size: 0.9em;
  padding: 0.08em 0.32em;
  border-radius: 4px;
  background: var(--cobalt-tint);
  color: var(--ink);
}

/* The highlighter: used on a phrase or two per page, never in headings. */
mark {
  color: inherit;
  background: linear-gradient(100deg, transparent 0.15em, var(--hl) 0.3em, var(--hl) calc(100% - 0.3em), transparent calc(100% - 0.15em));
  background-size: 100% 0.95em;
  background-position: 0 72%;
  background-repeat: no-repeat;
  padding: 0 0.15em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--cobalt);
  color: var(--on-cobalt);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

/* A two-column "page with a margin": section names and dates live in the
   margin, the reading column stays under ~70 characters. */
.row {
  display: grid;
  gap: 1rem 3rem;
}
@media (min-width: 56rem) {
  .row { grid-template-columns: var(--margin-col) minmax(0, 1fr); }
}

.section {
  padding-block: clamp(2.75rem, 6vw, 4.75rem);
  border-top: 1px solid var(--rule);
}

.margin-label {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--cobalt);
  margin: 0;
}
@media (min-width: 56rem) {
  .margin-label { position: sticky; top: 1.5rem; align-self: start; }
}

.measure { max-width: 40rem; }
.more { margin: 1.5rem 0 0; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 2rem;
  padding-block: 1.1rem;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: inline-block;
  padding-block: 0.3rem;
  font-size: 1rem;
  color: var(--ink-2);
  text-decoration: none;
}
.site-nav a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 2px; text-underline-offset: 0.4em; }
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--cobalt);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.4em;
}
@media (max-width: 30rem) {
  .site-nav ul { gap: 0.1rem 1rem; }
}

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.15rem;
  border: 1.5px solid var(--cobalt);
  border-radius: 8px;
  background: transparent;
  color: var(--cobalt);
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--cobalt-tint); }
.btn-primary {
  background: var(--cobalt);
  color: var(--on-cobalt);
}
.btn-primary:hover { background: var(--cobalt); filter: brightness(1.12); }

/* ---------- Home: hero ---------- */
.hero { padding-block: clamp(2.75rem, 7vw, 5.5rem) clamp(2.75rem, 6vw, 4.5rem); }
.hero-grid {
  display: grid;
  gap: 2.75rem;
  align-items: center;
}
@media (min-width: 62rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 4rem; }
}
.portrait {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
  border: 3px solid var(--sheet);
  box-shadow: 0 0 0 1px var(--rule);
}
.name {
  font-size: clamp(3rem, 7.5vw, 4.75rem);
  font-weight: 340;
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem;
}
.role {
  font-family: var(--serif);
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
  line-height: 1.32;
  max-width: 33rem;
  margin: 0 0 1.25rem;
}
.intro {
  max-width: 37rem;
  color: var(--ink-2);
  margin: 0;
}
.creds {
  max-width: 37rem;
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 1rem;
  line-height: 1.55;
}

/* ---------- Home: the agent approval prompt ---------- */
.prompt { margin: 0; }
.prompt-card {
  background: var(--night);
  color: var(--night-text);
  border-radius: 14px;
  padding: 1.4rem 1.5rem 1.5rem;
  box-shadow: 0 30px 60px -36px rgba(14, 26, 92, 0.65);
  font-size: 1.0625rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .prompt-card { box-shadow: 0 0 0 1px var(--rule); }
}
:root[data-theme="dark"] .prompt-card { box-shadow: 0 0 0 1px var(--rule); }

.prompt-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.1rem;
  color: var(--night-muted);
  font-size: 0.9375rem;
}
.prompt-bar .dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #7C93FF;
  flex: none;
}
.prompt-bar code { font-size: 0.9em; color: var(--night-text); }
.prompt-text { margin: 0 0 0.5rem; }
.prompt-cmd {
  margin: 0 0 1.1rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  font-size: 1.125rem;
  line-height: 1.4;
  overflow-x: auto;
}
.prompt-cmd .typo { border-radius: 2px; }
.prompt-cmd .typo.is-marked {
  color: #141A33;
  background: linear-gradient(#F7E36A, #F7E36A) no-repeat left / 100% 100%;
}
@media (prefers-reduced-motion: no-preference) {
  .prompt-cmd .typo.is-marked { animation: swipe 0.45s 0.05s ease-out both; }
  @keyframes swipe {
    from { background-size: 0% 100%; color: #FFFFFF; }
    to { background-size: 100% 100%; color: #141A33; }
  }
}
.prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.prompt-actions[hidden] { display: none; }
.prompt-actions button {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1.05rem 0.55rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: transparent;
  color: #FFFFFF;
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
}
.prompt-actions button:hover { background: rgba(255, 255, 255, 0.09); }
.prompt-card :focus-visible { outline-color: #F7E36A; }
.prompt-actions kbd {
  display: inline-block;
  min-width: 1.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: #FFFFFF;
  color: var(--night);
  font-size: 0.9375rem;
  text-align: center;
  box-shadow: 0 2px 0 #AEB9F2;
}
.prompt-result:empty { display: none; }
.prompt-result {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.prompt-result p { margin: 0 0 0.75rem; }
.prompt-result p:last-child { margin-bottom: 0; }
.prompt-result strong { color: #FFFFFF; }
.prompt-result code { color: #FFFFFF; background: rgba(255, 255, 255, 0.1); }
.prompt-result a { color: #FFFFFF; }
.prompt-result .linklike {
  margin-left: 1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--night-muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.prompt-fallback { margin-top: 0.75rem; color: var(--night-muted); }
.prompt-fallback summary { cursor: pointer; color: #FFFFFF; }
.prompt-fallback p { margin: 0.5rem 0 0; }
.prompt figcaption {
  margin-top: 0.85rem;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

/* ---------- Lists: news, entries, facts ---------- */
.news {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 44rem;
}
.news li {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  gap: 0 1.25rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}
.news li:first-child { border-top: 0; padding-top: 0.2rem; }
.news time, .entry-date {
  color: var(--ink-3);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.12rem;
  white-space: nowrap;
}
.news p { margin: 0; }
@media (max-width: 30rem) {
  .news li { grid-template-columns: 1fr; gap: 0.15rem; }
  .news time { font-size: 0.9375rem; }
}

.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.02rem 0.55rem;
  border-radius: 999px;
  background: var(--cobalt-tint);
  color: var(--cobalt);
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.5;
  vertical-align: 0.12em;
  white-space: nowrap;
  font-family: var(--sans);
  letter-spacing: 0;
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry {
  display: grid;
  gap: 0.2rem 1.5rem;
  padding: 1.35rem 0;
  border-top: 1px solid var(--rule);
}
.entry:first-child { border-top: 0; padding-top: 0.2rem; }
@media (min-width: 40rem) {
  .entry { grid-template-columns: 8.75rem minmax(0, 1fr); }
}
.entry-body { max-width: 44rem; }
.entry-title {
  font-family: var(--serif);
  font-size: 1.3125rem;
  font-weight: 450;
  line-height: 1.3;
  margin: 0 0 0.3rem;
}
.entry-meta {
  margin: 0;
  color: var(--ink-2);
  font-size: 1rem;
}
.entry-body > p:not(.entry-meta):not(.entry-title) { margin: 0.5rem 0 0; }
.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 1rem;
}

.facts-list {
  margin: 1.25rem 0 0;
  padding-left: 1.2rem;
}
.facts-list li { margin-bottom: 0.5rem; padding-left: 0.25rem; }
.facts-list li::marker { color: var(--cobalt); }

.subhead {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 2.75rem 0 1rem;
}
.subhead:first-child { margin-top: 0; }

/* ---------- Home: research threads ---------- */
.threads {
  display: grid;
  gap: 2rem 2.25rem;
}
@media (min-width: 48rem) {
  .threads { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.thread {
  border-top: 2px solid var(--cobalt);
  padding-top: 1rem;
}
.thread h3 {
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 0 0 0.6rem;
}
.thread h3 a { color: var(--ink); text-decoration-color: var(--rule); }
.thread h3 a:hover { text-decoration-color: var(--cobalt); }
.thread p { margin: 0; color: var(--ink-2); font-size: 1.0625rem; }

/* ---------- Inner pages ---------- */
.page-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem); }
.page-head h1 {
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 340;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.lede {
  max-width: 40rem;
  margin: 0;
  font-size: clamp(1.1875rem, 2vw, 1.3125rem);
  line-height: 1.5;
  color: var(--ink-2);
}

/* Research projects */
.project + .project {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--rule);
}
.project h3 {
  font-size: clamp(1.625rem, 2.8vw, 2rem);
  line-height: 1.15;
  margin: 0 0 0.35rem;
}
.project .when {
  margin: 0 0 1.25rem;
  color: var(--ink-3);
  font-size: 1rem;
}
.project-body { max-width: 42rem; }
.dl {
  display: grid;
  gap: 0.35rem 1.5rem;
  margin: 1.5rem 0 0;
  max-width: 42rem;
}
@media (min-width: 40rem) {
  .dl { grid-template-columns: 7.5rem minmax(0, 1fr); }
}
.dl dt {
  font-weight: 700;
  font-size: 1rem;
  padding-top: 0.12rem;
}
.dl dd { margin: 0 0 0.75rem; }
.dl dd ul { margin: 0; padding-left: 1.1rem; }
.dl dd li { margin-bottom: 0.35rem; }

/* Citations with hanging indents */
.cites {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 44rem;
}
.cites li {
  margin: 0 0 1.1rem;
  padding-left: 2rem;
  text-indent: -2rem;
}
.cites .status { color: var(--ink-3); }

/* Labs */
.lab + .lab {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--rule);
}
.lab h3 { font-size: clamp(1.625rem, 2.8vw, 2rem); margin: 0 0 0.35rem; }
.lab .when { margin: 0 0 1rem; color: var(--ink-3); font-size: 1rem; }
.lab-body { max-width: 42rem; }

/* Topics list on the talks page */
.topics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem 2.25rem;
}
@media (min-width: 48rem) { .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.topics h3 { font-size: 1.3125rem; margin: 0 0 0.35rem; }
.topics p { margin: 0; color: var(--ink-2); font-size: 1.0625rem; }

/* CV */
.cv-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.25rem 2rem; }
.cv-contact { margin: 0; color: var(--ink-2); font-size: 1.0625rem; }
.plain-list { margin: 0; padding-left: 1.2rem; max-width: 44rem; }
.plain-list li { margin-bottom: 0.5rem; padding-left: 0.2rem; }
.plain-list li::marker { color: var(--cobalt); }

.cv-page .section { padding-block: clamp(1.75rem, 3.5vw, 2.75rem); }
.cv-page .entry { padding-block: 0.9rem; }
.cv-page .entry:first-child { padding-top: 0.2rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--night);
  color: var(--night-text);
}
.site-footer .wrap { padding-block: clamp(2.75rem, 6vw, 4rem) 2rem; }
.site-footer h2 {
  color: #FFFFFF;
  font-size: 1.75rem;
  margin: 0;
}
.site-footer a { color: #FFFFFF; }
.contact-lede { max-width: 38rem; margin: 0 0 1.25rem; font-size: 1.1875rem; line-height: 1.5; }
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fineprint {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--night-muted);
  font-size: 0.9375rem;
}
.fineprint a { color: var(--night-text); }
.footer-grid { display: grid; gap: 1rem 3rem; }
@media (min-width: 56rem) { .footer-grid { grid-template-columns: var(--margin-col) minmax(0, 1fr); } }

/* ---------- 404 ---------- */
.notfound { padding-block: clamp(3rem, 10vw, 7rem); }

/* ---------- Print (the CV page prints cleanly) ---------- */
@media print {
  :root {
    --paper: #FFFFFF; --ink: #000000; --ink-2: #222222; --ink-3: #444444;
    --cobalt: #0E1A5C; --rule: #BBBBBB;
  }
  body { font-size: 10pt; line-height: 1.35; background: #FFFFFF; }
  .site-header, .site-footer, .skip-link, .no-print { display: none !important; }
  a { color: inherit; text-decoration: none; }
  .wrap { max-width: none; padding-inline: 0; }
  .page-head { padding-block: 0 10pt; }
  .page-head h1 { font-size: 22pt; margin-bottom: 4pt; }
  .section { padding-block: 9pt; break-inside: auto; }
  .row { display: block; }
  .margin-label { position: static; font-size: 12.5pt; margin: 0 0 4pt; break-after: avoid; }
  .cv-page .section { padding-block: 6pt; }
  .entry, .cv-page .entry { grid-template-columns: 6.5rem minmax(0, 1fr); padding: 3pt 0; break-inside: avoid; }
  .entry-body > p:not(.entry-meta):not(.entry-title) { margin-top: 2pt; }
  .plain-list li { margin-bottom: 2pt; }
  .entry-title { font-size: 11pt; }
  .entry-meta, .entry-date { font-size: 9.5pt; }
  .cites li { margin-bottom: 5pt; break-inside: avoid; }
}
