/* ============================================================
   Shankar Sharma — Academic Website
   Theme: Climate-inspired (deep teal + warm amber)
   Author: Shankar Sharma, CCRC, UNSW Sydney
   Licence: MIT (code) / CC-BY-4.0 (content)
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Brand */
  --brand-primary: #0d5e6f;        /* deep teal */
  --brand-primary-dark: #084450;
  --brand-accent: #e2902c;         /* warm amber */
  --brand-accent-soft: #f4c98a;

  /* Surfaces (light) */
  --bg: #fbfaf6;
  --bg-soft: #f1ede4;
  --surface: #ffffff;
  --surface-2: #f6f3ec;
  --border: #e3ddd1;
  --border-strong: #c9c0ad;

  /* Text */
  --text: #11161b;
  --text-soft: #4a5560;
  --text-muted: #6b7682;
  --link: #0d5e6f;
  --link-hover: #e2902c;

  /* Misc */
  --max: 1080px;
  --max-narrow: 780px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 32, 39, 0.05);
  --shadow: 0 4px 16px rgba(15, 32, 39, 0.08);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0e1419;
  --bg-soft: #131c22;
  --surface: #16202a;
  --surface-2: #1b2731;
  --border: #243341;
  --border-strong: #34495a;

  --text: #e8eef2;
  --text-soft: #b5c1cc;
  --text-muted: #8896a3;
  --link: #6dd4ec;
  --link-hover: #f5b259;

  --brand-primary: #1d8fa6;
  --brand-primary-dark: #2aa9c2;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease, color .25s ease;
}

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

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
a:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); margin: 0 0 .5rem; }
h2 { font-size: 1.5rem; margin: 2.25rem 0 .9rem; }
h3 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; }
p  { margin: .55rem 0; }

code, pre, .mono { font-family: var(--font-mono); font-size: .92em; }
pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  overflow-x: auto;
}
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .05rem .35rem;
  border-radius: 4px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ---------- Layout primitives ---------- */
.container      { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: var(--max-narrow); margin: 0 auto; padding: 0 1.25rem; }

.section { padding: 2.5rem 0; }
.section + .section { padding-top: 0; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.25rem;
  max-width: var(--max);
  margin: 0 auto;
  gap: 1rem;
}
.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  border: 0;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.brand:hover { color: var(--brand-primary); }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand-primary) 18%, transparent);
}
.nav-links { display: flex; gap: 1.15rem; align-items: center; flex-wrap: wrap; }
.nav-links a {
  font-size: .95rem;
  font-weight: 500;
  color: var(--text-soft);
  border: 0;
  padding: .25rem 0;
  position: relative;
}
.nav-links a:hover { color: var(--brand-primary); }
.nav-links a.active { color: var(--brand-primary); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--brand-accent);
  border-radius: 2px;
}

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 999px;
  width: 36px; height: 36px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.theme-toggle:hover { color: var(--brand-primary); border-color: var(--brand-primary); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 3.5rem 0 2.5rem;
  background:
    radial-gradient(ellipse at 80% -10%, color-mix(in oklab, var(--brand-accent) 22%, transparent) 0%, transparent 55%),
    radial-gradient(ellipse at 0% 110%, color-mix(in oklab, var(--brand-primary) 28%, transparent) 0%, transparent 55%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2.5rem;
  align-items: center;
}
.hero h1 { margin-bottom: .25rem; }
.hero .role {
  font-family: var(--font-serif);
  color: var(--brand-primary);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0;
}
.hero .affil { color: var(--text-soft); margin-top: .25rem; }
.hero .lede {
  font-size: 1.08rem;
  color: var(--text-soft);
  max-width: 56ch;
  margin: 1.1rem 0 1.5rem;
}
.hero-portrait-wrap {
  justify-self: end;
  margin: 0;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 1 / 1;
  position: relative;
}
.hero-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;     /* favours the face */
  border-radius: 50%;
  border: 6px solid var(--surface);
  box-shadow:
    0 0 0 4px color-mix(in oklab, var(--brand-primary) 18%, transparent),
    var(--shadow);
  background: var(--surface-2);
  display: block;
}
.hero-portrait {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, var(--brand-accent-soft), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--brand-primary), var(--brand-primary-dark));
  border: 6px solid var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 4.5rem;
  font-weight: 600;
  letter-spacing: -2px;
}
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait-wrap { justify-self: center; max-width: 200px; }
  .hero-portrait { font-size: 3.25rem; }
}

/* ---------- Buttons / chips ---------- */
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: .92rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all .15s ease;
}
.btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  color: #fff;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  background: color-mix(in oklab, var(--brand-primary) 12%, transparent);
  color: var(--brand-primary);
  border: 1px solid color-mix(in oklab, var(--brand-primary) 22%, transparent);
}
.chip.amber {
  background: color-mix(in oklab, var(--brand-accent) 18%, transparent);
  color: color-mix(in oklab, var(--brand-accent) 60%, var(--text));
  border-color: color-mix(in oklab, var(--brand-accent) 35%, transparent);
}
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; margin: .75rem 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; }
.card .meta { color: var(--text-muted); font-size: .88rem; margin-top: .25rem; }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ---------- Publication entry ---------- */
.pub {
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--brand-primary);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: .65rem 0;
}
.pub.featured { border-left-color: var(--brand-accent); }
.pub .pub-title {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--text);
}
.pub .pub-venue { color: var(--text-soft); font-size: .94rem; }
.pub .pub-meta { color: var(--text-muted); font-size: .85rem; margin-top: .35rem; }
.pub a { font-size: .88rem; }

.year-heading {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: .85rem;
  letter-spacing: .15em;
  color: var(--brand-accent);
  margin: 2rem 0 .75rem;
}

/* ---------- Timeline ---------- */
.timeline { position: relative; margin: 1rem 0 0 .25rem; padding-left: 1.5rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: .3rem; bottom: .3rem;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding: 0 0 1.1rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.5rem; top: .55rem;
  width: 12px; height: 12px;
  background: var(--brand-primary);
  border: 2px solid var(--bg);
  border-radius: 50%;
}
.timeline-item .when { font-family: var(--font-mono); font-size: .82rem; color: var(--brand-accent); text-transform: uppercase; letter-spacing: .1em; }
.timeline-item .what { font-weight: 600; }
.timeline-item .where { color: var(--text-soft); font-size: .95rem; }

/* ---------- Section heading ---------- */
.section-title {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1rem;
}
.section-title h2 { margin: 0; }
.section-title .kicker {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brand-accent);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 1.25rem;
  color: var(--text-muted);
  font-size: .9rem;
  background: var(--bg-soft);
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--brand-primary); }

/* ---------- Misc utilities ---------- */
.small { font-size: .9rem; color: var(--text-soft); }
.muted { color: var(--text-muted); }
.center { text-align: center; }
.divider {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  margin: 2rem 0;
}

details.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem 1rem;
  background: var(--surface);
  margin: .75rem 0;
}
details.collapsible summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--brand-primary);
  padding: .35rem 0;
}
details.collapsible[open] summary { margin-bottom: .5rem; }

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--brand-primary);
  color: white;
  padding: .5rem 1rem;
  z-index: 100;
}
.skip-link:focus { top: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
