/* kgajulapalli.org — one stylesheet for every page. No frameworks, no JS. */

:root {
  --paper: #fdfdfb;
  --ink: #1a1d1f;
  --muted: #646c73;
  --rule: #dcdfe2;
  --link: #1f5fa8;
  --link-ul: rgba(31, 95, 168, 0.4);
  --venue: #1e7f4a;
  --measure: 46rem;
  color-scheme: light;
}

/* Dark palette: follows the OS setting unless the toggle has set a preference. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16181a;
    --ink: #e6e4df;
    --muted: #9aa1a8;
    --rule: #2e3236;
    --link: #7fb2e8;
    --link-ul: rgba(127, 178, 232, 0.45);
    --venue: #5fc48b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16181a;
  --ink: #e6e4df;
  --muted: #9aa1a8;
  --rule: #2e3236;
  --link: #7fb2e8;
  --link-ul: rgba(127, 178, 232, 0.45);
  --venue: #5fc48b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "onum", "kern";
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.14em;
  text-decoration-color: var(--link-ul);
}
a:hover { text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 2px; }

/* Layout ------------------------------------------------------------- */

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

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--rule);
}
.site-header .name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.25rem;
}
.site-header nav a:first-child { margin-left: 0; }
.site-header nav a:hover,
.site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
}

main { padding: 2.5rem 0 4rem; }

/* Light/dark toggle */
.site-header nav { display: flex; align-items: center; }
.theme-toggle {
  margin-left: 1.25rem;
  padding: 0;
  width: 1.4rem;
  height: 1.4rem;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: linear-gradient(90deg, var(--ink) 50%, var(--paper) 50%);
  cursor: pointer;
  flex: none;
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.no-js .theme-toggle { display: none; }

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Text --------------------------------------------------------------- */

h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0 0 0.75rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; margin-top: 2.5rem; }
h3 { font-size: 1.0625rem; margin-bottom: 0.25rem; }
main > h2:first-child { margin-top: 0; }
p { margin: 0 0 1rem; }
ul { padding-left: 1.25rem; margin: 0 0 1rem; }
li { margin-bottom: 0.25rem; }
.muted { color: var(--muted); }
.venue { color: var(--venue); font-style: italic; }

/* Home --------------------------------------------------------------- */

.bio {
  display: grid;
  grid-template-columns: 22.5rem 1fr;
  gap: 2.75rem;
  align-items: start;
}
.bio img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
}
.bio .contact {
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--muted);
}
.bio .contact a { color: inherit; }

/* Publications / notes list ----------------------------------------- */

.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
}
.pubs li:first-child { border-top: 0; padding-top: 0; }
.pubs .year {
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: oldstyle-nums;
  padding-top: 0.1em;
}
.pubs .year.repeat { visibility: hidden; }  /* same year as the entry above */
.pubs .title { font-weight: 600; margin: 0 0 0.15rem; }
.pubs .authors { margin: 0 0 0.15rem; }
.pubs .meta { margin: 0; }
.pubs .links { margin: 0.25rem 0 0; font-size: 0.95rem; }
.pubs .links a { margin-right: 0.75rem; white-space: nowrap; }
.me { font-weight: 600; }

/* Teaching ----------------------------------------------------------- */

.courses { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.courses li {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--rule);
  line-height: 1.45;
}
.courses li:first-child { border-top: 0; }
.courses .course { font-weight: 600; }
.courses .code { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.courses .role { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.courses .terms { color: var(--venue); font-style: italic; text-align: right; white-space: nowrap; flex: none; }
h2 + .courses { margin-top: -0.25rem; }
.courses .award .course::before { content: "\2605\00a0"; color: var(--venue); font-size: 0.85em; }  /* small star */

/* Course page -------------------------------------------------------- */

.course-page { --measure: 56rem; }
.home { --measure: 58rem; }  /* wider so the photo can be ~360px, as on the old site */
.facts {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 1.5rem;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1rem 0 2rem;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.75rem 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}
th { font-weight: 600; color: var(--muted); }
td.num { color: var(--muted); font-variant-numeric: tabular-nums; }
tr.hw td { text-align: center; font-weight: 600; }
tr.hw .due { color: var(--venue); font-style: italic; font-weight: 400; margin-left: 0.5rem; }
tbody tr:last-child td { border-bottom: 0; }

/* Button-style link ------------------------------------------------- */

a.button {
  display: inline-block;
  padding: 0.45rem 1rem;
  color: var(--paper);
  background: var(--ink);
  border-radius: 3px;
  text-decoration: none;
  font-size: 0.95rem;
}
a.button:hover { background: var(--link); }

/* Small screens ------------------------------------------------------ */

@media (max-width: 800px) {
  .bio { grid-template-columns: 1fr; gap: 1.25rem; }
  .bio img { max-width: 22.5rem; }
}

@media (max-width: 600px) {
  .courses li { flex-direction: column; gap: 0; }
  .courses .terms { text-align: left; white-space: normal; }
  body { font-size: 1rem; }
  .pubs li { grid-template-columns: 1fr; }
  .pubs .year { padding-top: 0; margin-bottom: 0.15rem; }
  .pubs .year.repeat { display: none; }
  .facts { grid-template-columns: 1fr; gap: 0 }
  .facts dt { margin-top: 0.5rem; }
  table { display: block; overflow-x: auto; }
}

@media print {
  .site-header nav, .site-footer { display: none; }
  a { color: inherit; text-decoration: none; }
}
