/* ===========================================================================
   kr-ramesh.github.io

   Mono-forward minimalism: IBM Plex Mono carries the structure (name, nav,
   dates, years, labels) and IBM Plex Sans carries the prose. No cards, no
   shadows, no fills -- hairline rules do all the dividing work.

   Everything you would want to change is in :root below.
   =========================================================================== */

/* --- palette ------------------------------------------------------------ */

:root {
  --bg: #141417;
  --bg-soft: #1b1b1f;
  --ink: #e6e4df;
  --dim: #b3afa6;          /* 8.4:1 on --bg -- readable at the small mono sizes */
  --rule: rgba(230, 228, 223, 0.22);
  --accent: #6fbfa8;

  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --measure: 68ch;   /* max line length for prose */
  --page: 840px;     /* content column width (prose stays at --measure) */
  --gutter: 5.5rem;  /* width of the mono date column */

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #fbfaf7;
  --bg-soft: #f2f0eb;
  --ink: #17171a;
  --dim: #55534d;          /* 7.4:1 on --bg */
  --rule: rgba(23, 23, 26, 0.20);
  --accent: #2e6a5b;

  color-scheme: light;
}

/* --- reset -------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection { background: var(--accent); color: var(--bg); }

/* headings shouldn't leave a single orphan word on the last line */
h1, h2, h3 { text-wrap: balance; }
p, .pub-title, .news-body { text-wrap: pretty; }

a { color: inherit; }

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- header ------------------------------------------------------------- */

.site-head {
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
}

/* no color-mix -> fall back to the flat background */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .site-head { background: var(--bg); }
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 52px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--dim);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  position: relative;
  transition: color 0.15s ease;
}

.nav-link:hover { color: var(--accent); }

/* the current page gets a hairline marker rather than bold weight */
.nav-link.active { color: var(--ink); }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0.6rem;
  right: 0.6rem;
  bottom: 0.15rem;
  height: 1px;
  background: var(--accent);
}

#theme-toggle {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0.35rem 0.3rem 0.35rem 0.7rem;
  line-height: 1;
  font-family: var(--font-mono);
}

#theme-toggle:hover { color: var(--accent); }

/* --- main --------------------------------------------------------------- */

main { padding: 3rem 1.5rem 4rem; }

/* --- hero --------------------------------------------------------------- */

.hero {
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

.hero-portrait { flex: 0 0 auto; }

.hero-portrait img {
  width: 132px;
  height: 132px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--rule);
  display: block;
}

.hero-id { min-width: 0; padding-top: 0.1rem; }

.hero-name {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 0.8rem;
  line-height: 1.3;
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.9;
  color: var(--dim);
  margin: 0 0 0.9rem;
}

.hero-meta span { display: block; }

.hero-links {
  margin: 0.3rem 0 0;
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

/* soft round buttons -- the glyph carries the weight, not a hard border */
.ico {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid transparent;
  transition: color 0.18s ease, background 0.18s ease,
              border-color 0.18s ease, transform 0.18s ease;
}

.ico:hover,
.ico:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
  transform: translateY(-2px);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .ico:hover, .ico:focus-visible { background: var(--bg-soft); }
}

@media (prefers-reduced-motion: reduce) {
  .ico:hover, .ico:focus-visible { transform: none; }
}

/* --- prose -------------------------------------------------------------- */

.prose { max-width: var(--measure); }

.prose p { margin: 0 0 1.15rem; }

.prose a,
.news-body a,
.people-name a,
.pub-title a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: color 0.15s ease;
}

.prose a:hover,
.news-body a:hover,
.people-name a:hover,
.pub-title a:hover { color: var(--accent); }

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

/* small mono label + a hairline running out to the right margin */
.section-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 3rem 0 1rem;
  scroll-margin-top: 4.5rem;
}

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

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0;
  white-space: nowrap;
}

.section-label a { text-decoration: none; color: inherit; }
.section-label a:hover { color: var(--accent); }

/* --- page heads --------------------------------------------------------- */

.page-head { margin-bottom: 0.5rem; }

.page-title {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0 0 0.35rem;
}

.page-desc {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--dim);
  margin: 0;
}

/* --- news --------------------------------------------------------------- */

.news-list { list-style: none; margin: 0; padding: 0; }

.news-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.news-item:last-child { border-bottom: none; }

.news-item:hover .news-date,
.pub:hover .pub-venue { color: var(--ink); }

.news-date {
  flex: 0 0 var(--gutter);
  transition: color 0.15s ease;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.news-body { min-width: 0; font-size: 0.96rem; line-height: 1.62; }

.more { margin-top: 0.9rem; }

.more a {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  color: var(--dim);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.1rem;
}

.more a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* --- publications ------------------------------------------------------- */

.pub-list { list-style: none; margin: 0; padding: 0; }

.pub {
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
}

.pub:last-child { border-bottom: none; }

.pub-title {
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 0.22rem;
}

.pub-authors {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--dim);
}

/* your own name, picked out without shouting */
.pub-authors .me { color: var(--ink); font-weight: 500; }

.pub-venue {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
  color: var(--dim);
  margin-top: 0.2rem;
  transition: color 0.15s ease;
}

.pub-links { margin-top: 0.5rem; }

.chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.6rem;
  margin-right: 0.3rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--dim);
  text-decoration: none;
  display: inline-block;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.chip-press {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

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

@supports not (border-color: color-mix(in srgb, red 50%, transparent)) {
  .chip-press { border-color: var(--accent); }
}

/* abstract disclosure -- plain <details>, no JavaScript */
.pub-abstract { margin-top: 0.45rem; }

.pub-abstract summary {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
  display: inline-block;
  border-bottom: 1px dotted var(--rule);
}

.pub-abstract summary::-webkit-details-marker { display: none; }
.pub-abstract summary::before { content: "+ "; }
.pub-abstract[open] summary::before { content: "\2212 "; }
.pub-abstract summary:hover { color: var(--accent); }

.pub-abstract p {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--dim);
  margin: 0.55rem 0 0;
  padding-left: 0.9rem;
  border-left: 1px solid var(--rule);
  max-width: var(--measure);
}

/* --- people ------------------------------------------------------------- */

.people-list { list-style: none; margin: 0; padding: 0; }

.people-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--rule);
}

.people-row:last-child { border-bottom: none; }

.people-name { font-size: 0.94rem; min-width: 0; }

.people-affil {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--dim);
  text-align: right;
  flex: 0 0 auto;
}

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

.site-foot {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding: 1rem 0;
}

.site-foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--dim);
}

.site-foot a { color: inherit; }

/* --- focus + motion ----------------------------------------------------- */

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

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

@media (max-width: 640px) {
  main { padding-top: 2rem; }

  .head-inner { min-height: 0; padding-top: 0.5rem; padding-bottom: 0.5rem; }

  .hero { gap: 1.1rem; }

  .hero-portrait img { width: 92px; height: 92px; }

  .hero-name { font-size: 1rem; letter-spacing: 0.1em; }

  .news-item { display: block; }

  .news-date { display: block; margin-bottom: 0.1rem; }

  .people-row { display: block; }

  .people-affil { display: block; text-align: left; margin-top: 0.05rem; }
}

/* --- print -------------------------------------------------------------- */

@media print {
  .site-head, .site-foot, .pub-links, #theme-toggle { display: none; }
  body { background: #fff; color: #000; }
}
