/* Danuka Ravishan — portfolio styles. Plain CSS, no external dependencies. */
:root {
  --bg: #ffffff;
  --bg-soft: #f4f6fa;
  --card: #ffffff;
  --text: #1b2333;
  --muted: #5a6478;
  --line: #e2e6ee;
  --accent: #1f3864;
  --accent-2: #2e74b5;
  --accent-soft: #e8eef8;
  --good: #1d7a55;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --max: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1320;
    --bg-soft: #141b2c;
    --card: #172036;
    --text: #e6eaf2;
    --muted: #a3adc2;
    --line: #26304a;
    --accent: #8fb4ff;
    --accent-2: #6ea0ff;
    --accent-soft: #1c2a48;
    --good: #5fd3a1;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { font-weight: 700; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); font-size: 14.5px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--bg-soft); text-decoration: none; }

/* Hero */
.hero { padding-top: 72px; padding-bottom: 48px; }
.hero-grid { display: grid; grid-template-columns: 1fr 220px; gap: 48px; align-items: center; }
.eyebrow { color: var(--accent-2); font-weight: 600; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 12px; }
h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -.025em; margin: 0 0 16px; }
.lede { font-size: clamp(17px, 2vw, 19.5px); color: var(--muted); margin: 0 0 24px; max-width: 640px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; padding: 0; list-style: none; }
.chips li { font-size: 13.5px; padding: 5px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 15px; border: 1px solid var(--line); color: var(--text); background: var(--card); }
.btn:hover { text-decoration: none; border-color: var(--accent-2); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0e1320; } }
.avatar { width: 220px; height: 220px; border-radius: 50%; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: var(--shadow); justify-self: end; }
.avatar .initials { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 64px; font-weight: 700; letter-spacing: .02em; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 8px 0 0; }
.stat { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat b { display: block; font-size: 26px; letter-spacing: -.02em; color: var(--accent); line-height: 1.2; }
.stat span { font-size: 14px; color: var(--muted); }

/* Sections */
section { padding: 56px 0; border-top: 1px solid var(--line); }
h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 8px; }
.section-intro { color: var(--muted); margin: 0 0 28px; max-width: 720px; }
h3 { font-size: 18px; margin: 0 0 6px; letter-spacing: -.01em; }
p { margin: 0 0 14px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card p { color: var(--muted); font-size: 15.5px; margin: 0; }
.card .metric { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 13px; color: var(--good); background: color-mix(in srgb, var(--good) 10%, transparent); padding: 3px 8px; border-radius: 6px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 8px; }

/* Diagram */
.figure { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 24px; overflow-x: auto; }
.figure svg { min-width: 760px; width: 100%; height: auto; display: block; }
.figure figcaption { font-size: 14px; color: var(--muted); margin-top: 10px; }
.svg-box { fill: var(--card); stroke: var(--line); stroke-width: 1.5; }
.svg-box.hl { stroke: var(--accent-2); stroke-width: 2; }
.svg-title { fill: var(--text); font: 600 14px var(--font); }
.svg-sub { fill: var(--muted); font: 12.5px var(--font); }
.svg-arrow { stroke: var(--muted); stroke-width: 1.6; fill: none; }
.svg-head { fill: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 28px 24px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 7px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent-2); }
.timeline .when { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.timeline h3 { margin-top: 2px; }
.timeline .org { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.timeline ul { margin: 0; padding-left: 18px; color: var(--text); }
.timeline ul li { padding: 0; margin: 0 0 4px; border: 0; }
.timeline ul li::before { display: none; }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pubs li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.pubs .title { font-weight: 600; }
.pubs .meta { color: var(--muted); font-size: 14.5px; }
.pubs .status { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; margin-left: 6px; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.me { font-weight: 700; color: var(--text); }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.skills .card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.skills .card li { font-size: 13.5px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; }

/* Contact */
.contact-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-radius: 18px; padding: 32px; }
.contact-card h2 { color: #fff; }
.contact-card p { color: rgba(255,255,255,.88); margin: 0; max-width: 560px; }
.contact-card .btn { background: #fff; color: #1f3864; border-color: #fff; }
@media (prefers-color-scheme: dark) { .contact-card { color: #0e1320; } .contact-card h2 { color: #0e1320; } .contact-card p { color: rgba(14,19,32,.85); } .contact-card .btn { background: #0e1320; color: #e6eaf2; border-color: #0e1320; } }

footer { padding: 32px 0 48px; color: var(--muted); font-size: 14px; }

/* CV page */
.cv { max-width: 860px; margin: 40px auto 64px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 48px 56px; box-shadow: var(--shadow); }
.cv h1 { font-size: 34px; margin-bottom: 4px; }
.cv .headline { font-weight: 600; color: var(--accent); margin: 0 0 6px; }
.cv .contact { color: var(--muted); font-size: 14.5px; margin: 0 0 4px; }
.cv h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); border-bottom: 1.5px solid var(--accent); padding-bottom: 4px; margin: 28px 0 12px; }
.cv .role { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.cv .role h3 { font-size: 16px; margin: 0; }
.cv .role .dates { color: var(--muted); font-size: 14.5px; white-space: nowrap; }
.cv .org { font-style: italic; color: var(--muted); font-size: 15px; margin: 0 0 6px; }
.cv ul { margin: 0 0 6px; padding-left: 20px; }
.cv li { margin-bottom: 4px; font-size: 15px; }
.cv p { font-size: 15.5px; }
.cv-note { text-align: center; color: var(--muted); font-size: 13.5px; margin: -40px auto 48px; max-width: 860px; }
@media print { .cv-page body, body.cv-page { display: none !important; } }

/* Posters */
.posters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.poster { all: unset; cursor: zoom-in; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease; }
.poster:hover, .poster:focus-visible { transform: translateY(-2px); border-color: var(--accent-2); }
.poster:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.poster img { width: 100%; height: auto; aspect-ratio: 520 / 735; object-fit: cover; object-position: top; border-bottom: 1px solid var(--line); background: #fff; -webkit-user-select: none; user-select: none; }
.poster-meta { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.poster-meta .tag { margin: 0; font-size: 11px; }
.poster-title { font-weight: 600; font-size: 14.5px; line-height: 1.35; color: var(--text); }
.poster-sum { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(8, 12, 22, .97); display: flex; flex-direction: column; }
.lightbox[hidden] { display: none; }
.lb-bar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; color: #e6eaf2; font-size: 14px; }
.lb-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-hint { color: #a3adc2; white-space: nowrap; }
.lb-close { all: unset; cursor: pointer; font-size: 20px; padding: 4px 10px; border-radius: 8px; color: #fff; }
.lb-close:hover, .lb-close:focus-visible { background: rgba(255,255,255,.12); }
.lb-stage { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 0 16px 24px; }
.lb-stage img { max-height: calc(100vh - 80px); max-width: 100%; width: auto; cursor: zoom-in; border-radius: 6px; background: #fff; -webkit-user-select: none; user-select: none; }
.lb-stage.zoom img { max-height: none; max-width: none; width: min(2000px, 220vw); cursor: zoom-out; }
@media print { .posters, .lightbox { display: none !important; } }

/* Responsive */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .posters { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .hero { padding-top: 40px; padding-bottom: 32px; }
  .stat b { font-size: 21px; }
  .stat { padding: 14px; }
  .figure figcaption::before { content: "Scroll sideways to see the full diagram. "; font-weight: 600; }
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .avatar { width: 132px; height: 132px; justify-self: start; order: -1; }
  .avatar .initials { font-size: 42px; }
  .grid-2, .grid-3, .skills { grid-template-columns: 1fr; }
  .posters { grid-template-columns: 1fr 1fr; gap: 12px; }
  .poster-sum { display: none; }
  .lb-hint { display: none; }
  section { padding: 44px 0; }
  .cv { padding: 28px 20px; margin: 20px 16px 48px; border-radius: 12px; }
  .brand { font-size: 15px; }
}
