/* juliantay.org — all colours and fonts are defined here, at the top. */
:root {
  --bg: #ffffff;
  --text: #101418;
  --muted: #5d6671;
  --rule: #e3e7ec;
  --accent: #0a5c8f;        /* ocean blue */
  --accent-soft: #e9f2f9;
  --serif: "EB Garamond", Garamond, "Adobe Garamond Pro", Georgia, serif;
  --sans: var(--serif);
  --mono: var(--serif);   /* labels and dates also use Garamond, in small capitals */
  --measure: 44rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1116; --text: #e7ebef; --muted: #939ca7; --rule: #252c34;
    --accent: #6bb6e6; --accent-soft: #10263a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1116; --text: #e7ebef; --muted: #939ca7; --rule: #252c34;
  --accent: #6bb6e6; --accent-soft: #10263a; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--serif); font-size: 1.25rem; line-height: 1.6;
  font-variant-numeric: oldstyle-nums proportional-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: var(--measure); margin: 0 auto; padding-inline: 1.25rem; }

/* Header */
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 2rem; padding-block: 2rem 0;
}
.site-title { color: var(--text); font-weight: 600; font-size: 1.25rem; }
.site-title:hover { text-decoration: none; }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
nav a { color: var(--muted); font-size: 1.125rem; }
nav a:hover { color: var(--text); text-decoration: none; }
nav a[aria-current="page"] { color: var(--accent); }

/* Back / forward buttons */
.brand { display: flex; align-items: center; gap: 0.9rem; }
.history-nav { display: flex; gap: 0.25rem; }
.history-nav button {
  width: 1.75rem; height: 1.75rem; display: grid; place-items: center; padding: 0;
  background: transparent; color: var(--text); border: 1px solid var(--rule); border-radius: 4px; cursor: pointer;
}
.history-nav button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.history-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.history-nav button:disabled { opacity: 0.35; cursor: default; }
.history-nav svg { width: 0.875rem; height: 0.875rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.site-header .wrap { align-items: center; }

/* Content */
main { padding-block: 3.5rem 5rem; }
h1, h2, h3 { font-weight: 600; letter-spacing: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 2.6rem; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
h2 {
  font-family: var(--serif); font-weight: 400; font-size: 1rem; letter-spacing: 0.1em;
  text-transform: lowercase; font-variant-caps: small-caps; color: var(--muted); margin: 3.5rem 0 1.25rem;
}
h3 { font-size: 1.125rem; letter-spacing: -0.01em; margin: 0 0 0.25rem; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.1875rem; color: var(--muted); margin-bottom: 2.5rem; max-width: 36rem; }
.meta { font-family: var(--serif); font-size: 1rem; font-style: italic; color: var(--muted); margin: 0 0 0.5rem; font-variant-numeric: tabular-nums; }
.prose { max-width: 38rem; }
.prose h2 { margin-top: 2.5rem; }
.prose img { max-width: 100%; height: auto; border-radius: 4px; margin: 0.5rem 0 1rem; }
.prose blockquote { margin: 1.5rem 0; padding-left: 1rem; border-left: 2px solid var(--accent); color: var(--muted); }

.status {
  display: inline-block; font-family: var(--serif); font-size: 0.875rem; letter-spacing: 0.06em;
  text-transform: lowercase; font-variant-caps: small-caps; font-style: normal; color: var(--accent); border: 1px solid currentColor;
  border-radius: 3px; padding: 0 0.4rem; vertical-align: 0.2em; font-weight: 400;
}

/* Sub-navigation (Writings, Projects) */
.subnav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0 0 2.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--rule); }
.subnav a { color: var(--muted); font-size: 1.125rem; }
.subnav-sep { width: 1px; background: var(--rule); align-self: stretch; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* Cards */
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
a.card {
  display: flex; flex-direction: column; gap: 0.35rem; color: var(--text);
  border: 1px solid var(--rule); border-radius: 6px; padding: 1.1rem 1.2rem;
}
a.card:hover { border-color: var(--accent); text-decoration: none; }
.card-label { font-family: var(--serif); font-size: 0.9375rem; letter-spacing: 0.08em; text-transform: lowercase; font-variant-caps: small-caps; color: var(--accent); }
.card-title { font-weight: 600; line-height: 1.3; }
.card-summary { color: var(--muted); font-size: 1.0625rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }

/* Lists: CV, papers, journal */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  display: grid; grid-template-columns: 1fr; gap: 0.1rem 1.5rem;
  padding-block: 0.7rem; border-top: 1px solid var(--rule);
}
.rows li:last-child { border-bottom: 1px solid var(--rule); }
.rows .when { font-family: var(--serif); font-size: 1rem; font-variant-numeric: lining-nums tabular-nums; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 0.15rem; }
.rows .what { min-width: 0; }
.rows .sub { color: var(--muted); font-size: 1.0625rem; }
@media (min-width: 40rem) { .rows li { grid-template-columns: 8rem 1fr; } }
.num { font-family: var(--serif); font-size: 1rem; font-variant-numeric: lining-nums; color: var(--accent); margin-right: 0.5rem; }

.links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

.empty { color: var(--muted); }

/* Previous / next under an entry */
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.9375rem; }
.pager a:last-child { text-align: right; }

/* Footer */
.site-footer .wrap { padding-block: 1.5rem 2.5rem; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; font-family: var(--serif); font-size: 0.9375rem; color: var(--muted); }
.site-footer a { color: var(--muted); }

/* Papers and the proposal: title block and footnotes */
.intro { margin-top: 1.5rem; }
.paper-head { margin: 3rem 0 2rem; padding-top: 2rem; border-top: 1px solid var(--rule); text-align: center; }
.paper-kicker { font-variant-caps: small-caps; text-transform: lowercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 0.75rem; }
.paper-head .paper-title { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; letter-spacing: 0; text-transform: none; font-variant-caps: normal; color: var(--text); margin: 0 0 0.5rem; }
.paper-subtitle { font-style: italic; margin-bottom: 1rem; }
.paper-byline { color: var(--muted); font-size: 1.0625rem; }
.prose h3 { font-size: 1.25rem; margin: 2rem 0 0.5rem; }
.prose p { hyphens: auto; }
sup { line-height: 0; }
a.footnote { padding: 0 0.1em; text-decoration: none; }
.footnotes { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 1rem; color: var(--muted); }
.footnotes ol { padding-left: 1.25rem; }
.footnotes li { margin-bottom: 0.6rem; overflow-wrap: anywhere; }
.footnotes li p { margin: 0; }
a.reversefootnote { text-decoration: none; margin-left: 0.25rem; }

/* Figures, tables, bibliography and asides inside papers */
.paper-body figure { margin: 2rem 0; }
.paper-body figure img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; background: #fff; margin: 0; }
.paper-body figcaption { font-size: 1rem; color: var(--muted); margin-top: 0.6rem; overflow-wrap: anywhere; }
.table-caption { text-align: center; font-size: 1rem; margin: 2rem 0 0.5rem; }
.table-wrap { overflow-x: auto; margin: 0 0 2rem; }
.table-wrap table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: 1rem; }
.table-wrap th, .table-wrap td { border: 1px solid var(--rule); padding: 0.45rem 0.6rem; text-align: center; vertical-align: top; }
.table-wrap th { font-weight: 600; }
.bibliography p { padding-left: 2rem; text-indent: -2rem; font-size: 1.0625rem; overflow-wrap: anywhere; margin-bottom: 0.6rem; }
.aside { font-size: 1rem; color: var(--muted); margin-top: -0.5rem; }
.paper-byline { color: var(--muted); font-size: 1.0625rem; margin-bottom: 2.5rem; }

/* Assignment prompt and works discussed, above an essay */
.prompt { max-width: 38rem; background: var(--accent-soft); border-left: 2px solid var(--accent); padding: 1rem 1.25rem; margin: 0 0 1.5rem; font-size: 1.0625rem; }
.prompt p { margin: 0 0 0.6rem; }
.prompt p:last-child, .prompt ul:last-child { margin-bottom: 0; }
.prompt ul { margin: 0 0 0.6rem; padding-left: 1.25rem; }
.prompt-label { font-variant-caps: small-caps; text-transform: lowercase; letter-spacing: 0.1em; color: var(--accent); margin: 0 0 0.4rem; }
.works { max-width: 38rem; margin: 0 0 2.5rem; font-size: 1.0625rem; }
.works ul { list-style: none; margin: 0; padding: 0; }
.works li { padding: 0.15rem 0; }
.paper-body figure.fig-narrow { max-width: 22rem; }
.data-pair { display: flex; flex-wrap: wrap; gap: 0.5rem 3rem; font-variant-numeric: lining-nums tabular-nums; }
.prose figure { margin: 2rem 0; }
.prose figure img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; background: #fff; margin: 0; }
.prose figcaption { font-size: 1rem; color: var(--muted); margin-top: 0.6rem; }
.prose .table-wrap table td:first-child { text-align: left; }
.paper-summary { font-size: 1.125rem; margin: 0.5rem 0 1rem; }
