:root {
  --page: #fff;
  --ink: #252525;
  --muted: #666;
  --line: #e7e7e7;
  --soft: #f7f7f7;
  --link: #3b5bdb;
  --accent-1: #6366f1;
  --accent-2: #ec4899;
  --accent-3: #14b8a6;
  --accent-4: #f59e0b;
  --max: 1020px;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { width: min(var(--max), calc(100% - 48px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.nav { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { color: var(--ink); font-weight: 650; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { display: none; }
.nav-links { display: flex; align-items: center; gap: 25px; color: var(--muted); font-size: .94rem; }
.nav-links a { padding: 21px 0 19px; color: inherit; border-bottom: 2px solid transparent; }
.nav-links a.active { color: var(--ink); border-color: var(--ink); }
main { padding: 52px 0 96px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(2.35rem, 5vw, 3.4rem); line-height: 1.12; letter-spacing: -.055em; font-weight: 650; }
h2 { margin-bottom: 16px; font-size: clamp(1.7rem, 3vw, 2.1rem); line-height: 1.25; letter-spacing: -.04em; font-weight: 620; }
h3 { margin-bottom: 5px; font-size: 1.18rem; line-height: 1.4; letter-spacing: -.02em; font-weight: 650; }
.page-kicker { margin-bottom: 12px; color: var(--muted); font-size: .84rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.page-kicker::before { content: none; }
.highlight { color: inherit; }
.highlight::after { content: none; }
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 55px; align-items: start; min-height: 0; }
.page-grid > div { padding-top: 22px; }
.lede { max-width: 680px; margin-bottom: 20px; color: #444; font-size: 1.08rem; }
.portrait-card { grid-column: 2; grid-row: 1; margin-top: 25px; padding: 0; border: 0; border-radius: 3px; background: none; box-shadow: none; }
.portrait-card::before { content: none; }
.portrait-card img { display: block; width: 100%; aspect-ratio: 4 / 5; border-radius: 3px; object-fit: cover; filter: none; }
.actions, .socials { display: flex; flex-wrap: wrap; gap: 18px; }
.button { display: inline-flex; align-items: center; min-height: 40px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--link); font-size: .95rem; font-weight: 500; box-shadow: none; }
.button:hover, .button.primary:hover { background: none; color: #163e5d; text-decoration: underline; transform: none; box-shadow: none; }
.button.primary, .actions .button:nth-child(2) { background: none; color: var(--link); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.stat { padding: 0 15px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: none !important; }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: 0; }
.stat span, .meta, .date { color: var(--muted); font-size: .9rem; }
.stat strong { display: block; margin-top: 3px; font-size: .96rem; font-weight: 600; }
.page-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; align-items: start; }
.side-card { position: sticky; top: 28px; padding: 4px 24px 4px 0; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: none; color: var(--ink); box-shadow: none; }
.side-card .page-kicker { color: var(--muted); }
.side-card p { color: var(--muted); font-size: .95rem; }
.side-card h2 { font-size: 1.55rem; }
.content-stack { display: grid; gap: 0; }
.content-card { padding: 26px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none !important; box-shadow: none; }
.content-card:first-child { padding-top: 0; }
.content-card:last-child { border-bottom: 0; }
.project-card { border-top: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.date { white-space: nowrap; padding-top: 3px; }
ul { margin: 12px 0 0; padding-left: 20px; color: #444; }
li + li { margin-top: 6px; }
.project-media { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; margin: 0 0 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #f4f5f6; color: var(--muted); font-size: .95rem; text-align: center; }
.media-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; aspect-ratio: auto; overflow: visible; border: 0; background: none; }
.media-gallery > img, .media-gallery > video { width: 100%; height: 100%; min-width: 0; min-height: 0; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 6px; background: #f4f5f6; object-fit: contain; }
.hyd-media { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rubiknet-media { grid-template-columns: 2fr 3fr; }
.rubiknet-media > img, .rubiknet-media > video, .hyd-media > img, .hyd-media > video { aspect-ratio: 4 / 5; }
.diary-card .meta { margin-bottom: 0; }
.project-media:not(.media-gallery) img, .project-media:not(.media-gallery) video { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; border: 0; border-radius: 0; background: #f4f5f6; object-fit: contain; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { padding: 2px 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--soft); color: #555; font-size: .8rem; font-weight: 500; }
.project-links { margin-top: 14px; }
.repo-link { color: var(--link); font-size: .92rem; font-weight: 500; }
.skill-grid, .mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.skill-card p, .mini-link p { margin-bottom: 0; color: #444; }
.mini-link { display: block; padding: 18px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); }
.contact-card { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; padding: 30px 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.contact-links { display: grid; gap: 12px; align-content: center; }
.home-page { max-width: 850px; }
.directory-page { max-width: 850px; }
.directory-intro { padding: 8px 0 30px; }
.directory-intro .page-kicker { margin-bottom: 7px; }
.directory-intro h1 { margin-bottom: 9px; font-size: clamp(2.25rem, 5vw, 3rem); }
.directory-intro > p:last-child { max-width: 680px; margin-bottom: 0; color: #555; }
.directory-page .content-stack { border-top: 1px solid var(--line); }
.directory-page .content-card:first-child { padding-top: 24px; }
.profile-intro { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 38px; align-items: center; padding: 8px 0 42px; }
.profile-intro .portrait-card { grid-column: auto; grid-row: auto; width: 170px; margin: 0; }
.profile-intro .portrait-card img { aspect-ratio: 1; border-radius: 50%; }
.intro-copy .page-kicker { margin-bottom: 8px; }
.intro-copy h1 { margin-bottom: 14px; font-size: clamp(2.3rem, 5vw, 3.1rem); }
.intro-copy .lede { margin-bottom: 12px; font-size: 1rem; }
.intro-affiliation { margin-bottom: 14px; color: var(--muted); font-size: .93rem; }
.social-links { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .93rem; }
.portfolio-section { padding: 28px 0 30px; border-top: 1px solid var(--line); }
.portfolio-section h2, .contact-section h2 { margin-bottom: 10px; font-size: 1.45rem; letter-spacing: -.035em; }
.portfolio-section > p, .contact-section p { max-width: 720px; margin-bottom: 18px; color: #4d4d4d; }
.profile-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 22px; }
.profile-facts > div { display: grid; align-content: start; gap: 2px; }
.profile-facts span, .profile-facts small { color: var(--muted); font-size: .85rem; }
.profile-facts strong { font-size: .96rem; font-weight: 600; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section-heading > a { flex: 0 0 auto; font-size: .9rem; }
.work-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 16px 0; border-top: 1px solid var(--line); }
.work-item h3 { margin: 0 0 3px; font-size: 1rem; }
.work-item p { margin: 0; color: #555; font-size: .93rem; }
.work-year { flex: 0 0 auto; padding-top: 2px; color: var(--muted); font-size: .88rem; }
.experience-summary { padding-bottom: 24px; }
.contact-section { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px 0; border-top: 1px solid var(--line); }
.contact-section p { margin: 0; font-size: .93rem; }
.contact-email { flex: 0 0 auto; font-size: .94rem; }
@media (max-width: 760px) {
  .shell { width: min(var(--max), calc(100% - 32px)); }
  .nav { min-height: 62px; }
  .nav-links { gap: 16px; font-size: .9rem; }
  .page-grid { grid-template-columns: minmax(0, 1fr) 190px; gap: 28px; }
  .page-layout { grid-template-columns: 1fr; gap: 26px; }
  .side-card { position: static; padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .profile-facts { gap: 16px; }
}
@media (max-width: 560px) {
  .shell { width: min(var(--max), calc(100% - 28px)); }
  .nav { align-items: flex-start; flex-direction: column; gap: 0; padding-top: 13px; }
  .nav-links { width: 100%; gap: 22px; overflow-x: auto; }
  .nav-links a { padding: 10px 0 12px; }
  main { padding: 34px 0 48px; }
  .page-grid { display: flex; flex-direction: column; gap: 28px; }
  .page-grid > div { padding-top: 0; }
  .portrait-card { order: -1; width: min(220px, 70%); margin: 0 auto; }
  .profile-intro { grid-template-columns: 1fr; gap: 22px; padding: 0 0 30px; }
  .profile-intro .portrait-card { order: 0; width: 128px; margin: 0; }
  .profile-facts { grid-template-columns: 1fr; gap: 14px; }
  .portfolio-section { padding: 23px 0; }
  .work-item { gap: 12px; }
  .contact-section { align-items: flex-start; flex-direction: column; gap: 10px; }
  .stats { grid-template-columns: 1fr; gap: 12px; }
  .stat, .stat:first-child { padding: 0; border: 0; }
  .card-head { display: block; }
  .date { display: block; margin-top: 4px; white-space: normal; }
  .media-gallery, .rubiknet-media, .hyd-media { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-media { aspect-ratio: 4 / 3; }
  .media-gallery > img, .media-gallery > video, .rubiknet-media > img, .rubiknet-media > video, .hyd-media > img, .hyd-media > video { aspect-ratio: 4 / 5; }
}

/* ---------- Animations ---------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes portrait-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20%, 40% { transform: rotate(-8deg); } }

.site-header { animation: fade-in .5s ease both; }
.profile-intro .portrait-card { animation: portrait-in .7s cubic-bezier(.2, .7, .2, 1) both; }
.intro-copy > *, .directory-intro > * { animation: fade-up .6s cubic-bezier(.2, .7, .2, 1) both; }
.intro-copy > :nth-child(1), .directory-intro > :nth-child(1) { animation-delay: .08s; }
.intro-copy > :nth-child(2), .directory-intro > :nth-child(2) { animation-delay: .16s; }
.intro-copy > :nth-child(3), .directory-intro > :nth-child(3) { animation-delay: .24s; }
.intro-copy > :nth-child(4) { animation-delay: .32s; }
.intro-copy > :nth-child(5) { animation-delay: .4s; }

/* Scroll reveal (class added by animations.js, so content stays visible without JS) */
.reveal { opacity: 0; }
.reveal.is-visible { animation: fade-up .6s cubic-bezier(.2, .7, .2, 1) var(--reveal-delay, 0s) both; }

/* Nav */
.nav-links a { transition: color .2s ease, border-color .25s ease; }
.nav-links a:hover { color: var(--ink); text-decoration: none; border-color: #cfcfcf; }
.nav-links a.active:hover { border-color: var(--ink); }
.brand { transition: opacity .2s ease; }
.brand:hover { opacity: .7; }

/* Sliding underline on inline links */
.social-links a, .section-heading > a, .contact-email, .repo-link {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .3s ease, color .2s ease;
}
.social-links a:hover, .section-heading > a:hover, .contact-email:hover, .repo-link:hover { text-decoration: none; background-size: 100% 1px; }

/* Arrow nudges */
.section-heading > a span, .contact-email span { display: inline-block; transition: transform .25s ease; }
.section-heading > a:hover span { transform: translateX(4px); }
.contact-email:hover span { transform: translate(3px, -3px); }

/* Portrait */
.portrait-card img { transition: transform .4s cubic-bezier(.2, .7, .2, 1), box-shadow .4s ease; }
.profile-intro .portrait-card img:hover { transform: rotate(-3deg) scale(1.04); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }

/* Lists and cards */
.work-item { transition: transform .25s ease, background-color .25s ease; }
.work-item:hover { transform: translateX(6px); }
.work-item h3 { transition: color .2s ease; }
.work-item:hover h3 { color: var(--link); }
.content-card h3 { transition: color .2s ease; }
.content-card:hover h3 { color: var(--link); }
.media-gallery > img, .media-gallery > video, .project-media:not(.media-gallery) { transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease; }
.media-gallery > img:hover, .media-gallery > video:hover, .project-media:not(.media-gallery):hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .08); }
.tag { transition: transform .2s ease, border-color .2s ease, color .2s ease; }
.tag:hover { transform: translateY(-2px); }
.profile-facts > div { transition: transform .25s ease; }
.profile-facts > div:hover { transform: translateY(-3px); }

/* Little wave on the contact heading */
.contact-section h2::after { content: " 👋"; display: inline-block; transform-origin: 70% 70%; }
.contact-section:hover h2::after { animation: wave 1.4s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; }
}

/* ---------- Colour ---------- */
.site-header { position: relative; }
.site-header::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent-1), var(--accent-2), var(--accent-4), var(--accent-1)); background-size: 200% 100%; animation: grad-shift 8s linear infinite; }
@keyframes grad-shift { to { background-position: 200% 0; } }
.nav-links a.active { border-color: var(--accent-1); }
.nav-links a.active:hover { border-color: var(--accent-1); }

.page-kicker { color: var(--accent-1); }
.intro-copy h1, .directory-intro h1 { color: #312e81; }

/* Section headings take a deeper shade of their marker colour */
.portfolio-section h2 { color: #3730a3; }
[aria-labelledby="selected-work-title"] h2 { color: #9d174d; }
[aria-labelledby="experience-title"] h2 { color: #115e59; }
.contact-section h2 { color: #92400e; }

/* Gradient ring around the portrait */
.profile-intro .portrait-card { padding: 4px; border-radius: 50%; background: conic-gradient(var(--accent-1), var(--accent-2), var(--accent-4), var(--accent-3), var(--accent-1)); }
.profile-intro .portrait-card img { border: 3px solid var(--page); }

.tag:hover { border-color: #c9c9c9; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .site-header::before { animation: none; }
}

/* Coming-soon badge on blog posts */
@keyframes soon-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.soon-badge { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); color: var(--muted); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.soon-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: soon-pulse 1.6s ease-in-out infinite; }
@media (max-width: 560px) { .soon-badge { margin-top: 8px; } }

/* ---------- Blog ---------- */
.post-title-link { color: inherit; }
.post-title-link:hover { color: var(--link); text-decoration: none; }
.post-authors { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }
.post-page { max-width: 760px; }
.back-link { display: inline-block; margin-bottom: 26px; font-size: .92rem; }
.back-link span { display: inline-block; transition: transform .25s ease; }
.back-link:hover { text-decoration: none; }
.back-link:hover span { transform: translateX(-4px); }
.post-header { padding-bottom: 24px; margin-bottom: 30px; border-bottom: 1px solid var(--line); animation: fade-up .6s cubic-bezier(.2, .7, .2, 1) both; }
.post-header h1 { margin-bottom: 12px; color: #312e81; font-size: clamp(2rem, 4.5vw, 2.7rem); }
.post-meta { margin: 0; color: var(--muted); font-size: .95rem; }
.post-body { color: #333; font-size: 1.03rem; line-height: 1.8; animation: fade-in .6s .15s ease both; }
.post-body h2 { margin: 44px 0 14px; color: #3730a3; font-size: 1.55rem; }
.post-body h3 { margin: 32px 0 10px; color: #9d174d; font-size: 1.2rem; }
.post-body h4 { margin: 24px 0 8px; font-size: 1.05rem; }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote, .post-body pre { margin: 0 0 18px; }
.post-body ul, .post-body ol { color: inherit; }
.post-body img { display: block; max-width: 100%; height: auto; margin: 26px auto; border-radius: 6px; }
.post-body figure { margin: 26px 0; }
.post-body figure img, .post-body figure video { margin: 0 auto; }
.post-body video { display: block; width: 100%; max-width: 520px; height: auto; margin: 26px auto; border-radius: 6px; background: #f4f5f6; }
.post-body figcaption { margin-top: 10px; color: var(--muted); font-size: .9rem; text-align: center; }
.post-body p[align="center"] { text-align: center; }
.post-body blockquote { padding: 14px 20px; border-left: 3px solid var(--accent-1); border-radius: 0 6px 6px 0; background: #f5f6ff; color: #333; }
.post-body blockquote p:last-child { margin-bottom: 0; }
.post-body code { padding: 1px 6px; border-radius: 4px; background: var(--soft); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
.post-body pre { padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #fafafa; line-height: 1.55; }
.post-body pre code { padding: 0; background: none; }
.post-body table { width: 100%; margin: 0 0 18px; border-collapse: collapse; font-size: .95rem; }
.post-body th, .post-body td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.post-body hr { margin: 36px 0; border: 0; border-top: 1px solid var(--line); }
.post-body .katex-display { margin: 22px 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* Current work on the home page */
.current-work h2 { color: #92400e; }
.current-work h3 { margin: 4px 0 8px; font-size: 1.08rem; }
.current-work > p { margin-bottom: 0; }
.current-work ul { margin-top: 12px; }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.results-grid > div { display: grid; gap: 1px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); transition: transform .25s ease; }
.results-grid > div:hover { transform: translateY(-3px); }
.results-grid strong { color: var(--ink); font-size: 1.45rem; line-height: 1.2; letter-spacing: -.03em; }
.results-grid span { font-weight: 600; font-size: .93rem; }
.results-grid small { color: var(--muted); font-size: .82rem; line-height: 1.4; }
@media (max-width: 560px) { .results-grid { grid-template-columns: 1fr; } }
.current-work > p.current-credit { margin: -4px 0 10px; color: var(--muted); font-size: .9rem; }

/* Single image inside an experience card */
.card-figure { max-width: 320px; margin: 18px 0 0; }
.card-figure img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease; }
.card-figure img:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .08); }
.card-figure figcaption { margin-top: 6px; color: var(--muted); font-size: .85rem; }

/* ---------- Light academic theme (overrides everything above) ---------- */
:root { --page: #fff; --ink: #1f2328; --muted: #656d76; --line: #e4e6e9; --soft: #f6f7f9; --link: #1f6f5c; --accent: #1f6f5c; --max: 880px; }
body { background: var(--page); font: 17px/1.65 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
h1, h2, h3, .brand { font-family: "Computer Modern Serif", "Latin Modern Roman", Georgia, serif; }
a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: #134d3f; }
.site-header { background: rgba(255, 255, 255, .92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(6px); }
.site-header::before { content: none; }
.brand { font-size: 1.15rem; font-weight: 700; letter-spacing: 0; }
.nav-links a.active, .nav-links a.active:hover { color: var(--ink); border-color: var(--accent); }
.nav-links a:hover { color: var(--accent); border-color: transparent; }
.home-page, .directory-page { max-width: var(--max); }

h1, h2, h3, .intro-copy h1, .directory-intro h1, .post-header h1 { color: var(--ink); font-weight: 700; letter-spacing: -.01em; }
.portfolio-section h2, .contact-section h2, .current-work h2,
[aria-labelledby="selected-work-title"] h2, [aria-labelledby="experience-title"] h2 { color: var(--ink); font-size: 1.6rem; }
/* Short accent bar under each home section heading */
.portfolio-section h2::after { content: ""; display: block; width: 32px; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--accent); }
.contact-section h2::after { content: none; }
.page-kicker, .eyebrow { margin: 0 0 10px; color: var(--accent); font-size: .82rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.lede, .portfolio-section > p, .contact-section p, ul, .work-item p, .directory-intro > p:last-child { color: #424a53; }

/* Intro: text left, photo right */
.profile-intro { grid-template-columns: minmax(0, 1fr) 230px; gap: 40px; align-items: center; padding: 16px 0 48px; }
.profile-intro .portrait-card { width: 230px; padding: 0; border-radius: 14px; background: none; }
.profile-intro .portrait-card img { aspect-ratio: 4 / 5; border: 0; border-radius: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .1); }
.profile-intro .portrait-card img:hover { transform: rotate(-2deg) scale(1.02); }

/* Current work videos */
.current-media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.current-media figure { margin: 0; }
.current-media video { display: block; width: 100%; height: 340px; border: 1px solid var(--line); border-radius: 10px; background: #eef0f2; object-fit: contain; }
.current-media figcaption { margin-top: 8px; color: var(--muted); font-size: .88rem; text-align: center; }
.current-work > p.current-writeup { margin: 12px 0 0; }
@media (max-width: 560px) { .current-media { grid-template-columns: 1fr; } .current-media video { height: 300px; } }

/* Selected work cards with thumbnails */
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 18px; }
.work-card { display: flex; flex-direction: column; color: inherit; }
.work-card:hover { text-decoration: none; }
.work-thumb { aspect-ratio: 4 / 3; margin-bottom: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #eef0f2; }
.work-thumb img, .work-thumb video { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .4s cubic-bezier(.2, .7, .2, 1); }
.work-card:hover .work-thumb img, .work-card:hover .work-thumb video { transform: scale(1.05); }
.work-card h3 { margin-bottom: 4px; font-size: 1.08rem; transition: color .2s ease; }
.work-card:hover h3 { color: var(--accent); }
.work-card p { margin: 0 0 6px; color: #424a53; font-size: .9rem; line-height: 1.5; }
.work-card .work-year { margin-top: auto; }

.tag { border-radius: 999px; }
.results-grid > div, .project-media, .media-gallery > img, .media-gallery > video, .card-figure img { border-radius: 10px; }
.post-body h2, .post-body h3 { color: var(--ink); }
.post-body blockquote { border-left-color: var(--accent); background: #f2f8f6; }

@media (max-width: 760px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .profile-intro { grid-template-columns: 1fr; padding: 4px 0 32px; }
  .profile-intro .portrait-card { order: -1; width: 160px; }
  .work-grid { grid-template-columns: 1fr; }
}
.media-gallery.rubiknet-media > img, .media-gallery.rubiknet-media > video { height: 380px; aspect-ratio: auto; }
.media-gallery.rubiknet-media > img { background: #fff; }
@media (max-width: 560px) { .project-media.media-gallery { aspect-ratio: auto; } .media-gallery.rubiknet-media { grid-template-columns: 1fr; } .media-gallery.rubiknet-media > video { height: 420px; } .media-gallery.rubiknet-media > img { height: auto; } }
.sih-figure { max-width: 420px; }
.sih-figure img { aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 50%; }
