/* ==========================================================================
   memreandiran.com
   Clean minimal academic layout. No dependencies, no external fonts.
   Colour and spacing decisions live in the :root block below.
   ========================================================================== */

:root {
  /* Warm paper light theme */
  --bg:            #fdfcfa;
  --bg-subtle:     #f5f2ec;
  --text:          #1c1b19;
  --text-muted:    #5d5a54;
  --text-faint:    #8b867d;
  --rule:          #e2ddd3;
  --accent:        #8c2f39;
  --accent-hover:  #6f242c;
  --focus:         #2f6f9e;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 34rem;   /* comfortable reading width */
  --gutter:  1.5rem;
}

/* Dark theme: applied by system preference, overridden by the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #12110f;
    --bg-subtle:    #1c1a17;
    --text:         #e8e4dd;
    --text-muted:   #a9a39a;
    --text-faint:   #78726a;
    --rule:         #2e2b26;
    --accent:       #dd909a;
    --accent-hover: #ecaab2;
    --focus:        #7fb4d8;
  }
}

:root[data-theme="dark"] {
  --bg:           #12110f;
  --bg-subtle:    #1c1a17;
  --text:         #e8e4dd;
  --text-muted:   #a9a39a;
  --text-faint:   #78726a;
  --rule:         #2e2b26;
  --accent:       #dd909a;
  --accent-hover: #ecaab2;
  --focus:        #7fb4d8;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;   /* keeps anchored headings clear of the sticky header */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------- links & focus */

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.875rem;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

.nowrap { white-space: nowrap; }

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.9rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}

/* Fallback for browsers without color-mix support */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header { background: var(--bg); }
}

.site-header__name {
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__name:hover { color: var(--accent); }

.site-nav {
  display: flex;
  gap: 1.1rem;
  margin-left: auto;
  font-family: var(--sans);
  font-size: 0.875rem;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }

/* Tighten the gaps before the five labels start crowding the name. */
@media (max-width: 48rem) {
  .site-nav { gap: 0.8rem; }
}

/* On narrow screens the nav labels are the first thing to go. Every section
   is still reachable by scrolling, since this is a single page. The threshold
   accounts for the full name in the header, which is wide. */
@media (max-width: 44rem) {
  .site-nav { display: none; }
  .theme-toggle { margin-left: auto; }
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* Show the icon for the theme you would switch *to*. */
.theme-toggle__sun  { display: none; }
.theme-toggle__moon { display: block; }
:root[data-theme="dark"] .theme-toggle__sun  { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__sun  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle__moon { display: none; }
}

/* ---------------------------------------------------------------- layout */

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter) 4rem;
}

.hero { padding: 4rem 0 0; }

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 7vw, 2.75rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero__role {
  margin: 0 0 1.75rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.5;
}

.prose p { margin: 0 0 1.1rem; }
.prose p:last-child { margin-bottom: 0; }

.prose__aside {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Inline list of profile links under the bio. */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
  font-size: 0.9375rem;
}

.section {
  margin-top: 4rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--rule);
}

h2 {
  margin: 0 0 1.5rem;
  font-size: 0.8125rem;
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
}

h3 {
  margin: 0 0 0.3rem;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
}

.section__note {
  margin: -0.75rem 0 1.5rem;
  color: var(--text-faint);
  font-size: 0.875rem;
}

.marker { color: var(--accent); }

/* ------------------------------------------------- research interests */

.interests { margin: 0; }

.interests__item + .interests__item { margin-top: 1.25rem; }

.interests dt {
  font-weight: 600;
}

.interests dd {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
}

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

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

.pub {
  position: relative;
  padding-left: 2.25rem;
}
.pub + .pub { margin-top: 2rem; }

/* Numbering that reads like a CV rather than a browser default list. */
.pub::before {
  counter-increment: pub;
  content: "[" counter(pub) "]";
  position: absolute;
  left: 0;
  top: 0.1rem;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.pub__authors,
.pub__venue {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.pub__me { color: var(--text); font-weight: 600; }

.pub__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.85rem;
  margin: 0.55rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
  font-size: 0.8125rem;
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg-subtle);
  color: var(--text-faint);
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

/* --------------------------------------------- experience & education */

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

.entry + .entry {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.entry__role { margin: 0; }

.entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.75rem;
  margin: 0.1rem 0 0.6rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* City and country, kept quieter than the institution it follows. */
.entry__place {
  color: var(--text-faint);
  white-space: nowrap;
}

.entry__dates {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-faint);
  white-space: nowrap;
}

/* Dates sit on the far right on wide screens, below the org on narrow ones. */
@media (min-width: 34rem) {
  .entry__meta { flex-wrap: nowrap; align-items: baseline; }
  .entry__org { flex: 1 1 auto; }
  .entry__dates { flex: 0 0 auto; }
}

.entry__points {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
}
.entry__points li + li { margin-top: 0.35rem; }
.entry__points::marker { color: var(--text-faint); }

/* ---------------------------------------------------------------- skills */

.skills { margin: 0; }

.skills__row + .skills__row { margin-top: 0.9rem; }

.skills dt {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.skills dd {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
}

@media (min-width: 34rem) {
  .skills__row {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 1rem;
    align-items: baseline;
  }
  .skills dt { padding-top: 0.25rem; }
  .skills dd { margin-top: 0; }
}

/* ------------------------------------------------------------ projects */

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

.project + .project {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

.project__title a { text-decoration: none; }
.project__title a:hover { text-decoration: underline; }

.project__desc {
  margin: 0;
  color: var(--text-muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  background: var(--bg-subtle);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 0.75rem;
}

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

.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-faint);
}
.site-footer p { margin: 0; }

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

@media print {
  .site-header, .skip-link { display: none; }
  body { font-size: 11pt; color: #000; background: #fff; }
  main { max-width: none; }
  a { color: #000; }
  .section { break-inside: avoid; }
}
