/* Shared academic layout. No external fonts; JavaScript is only used for the theme toggle and publication controls. */
:root { color-scheme: light; --bg: #fff; --ink: #292b30; --muted: #646871; --accent: #852f38; --accent-strong: #571b23; --on-accent: #fff; --line: #e5e4e2; --soft: #f8f6f3; --accent-line: #d9c3c5; --accent-border: #e8dfda; --accent-ring: #f1e4e5; --connector: #b9b6b2; --hairline: rgba(0,0,0,.06); --hub-bg: #292b30; --hub-ink: #fff; --hub-muted: #d4d4d6; --gui: #2f6f73; --nav: #852f38; --ctl: #3f5a8a; --gui-soft: #eef5f5; --nav-soft: #f8f0f0; --ctl-soft: #eff2f8; }
/* Dark theme: chosen with the header toggle (data-theme), otherwise follows the system setting. */
:root[data-theme="dark"] { color-scheme: dark; --bg: #16171a; --ink: #e4e2df; --muted: #a2a5ac; --accent: #e29aa2; --accent-strong: #f3c1c6; --on-accent: #16171a; --line: #2d2f35; --soft: #1e2024; --accent-line: #6a464b; --accent-border: #4a3337; --accent-ring: #3d2a2d; --connector: #4a4d55; --hairline: rgba(255,255,255,.07); --hub-bg: #2a2c32; --hub-ink: #f2f0ed; --hub-muted: #b4b6bc; --gui: #7cc1c4; --nav: #e29aa2; --ctl: #9fb6e6; --gui-soft: #182324; --nav-soft: #2a1d20; --ctl-soft: #1c2130; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; --bg: #16171a; --ink: #e4e2df; --muted: #a2a5ac; --accent: #e29aa2; --accent-strong: #f3c1c6; --on-accent: #16171a; --line: #2d2f35; --soft: #1e2024; --accent-line: #6a464b; --accent-border: #4a3337; --accent-ring: #3d2a2d; --connector: #4a4d55; --hairline: rgba(255,255,255,.07); --hub-bg: #2a2c32; --hub-ink: #f2f0ed; --hub-muted: #b4b6bc; --gui: #7cc1c4; --nav: #e29aa2; --ctl: #9fb6e6; --gui-soft: #182324; --nav-soft: #2a1d20; --ctl-soft: #1c2130; } }
.theme-toggle { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--accent); border-color: var(--accent-line); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun, :root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.header-tools { display: flex; align-items: center; gap: 22px; flex-wrap: nowrap; }
.header-tools .theme-toggle { flex: none; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-strong); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; top: -100px; left: 16px; padding: 8px 18px; background: var(--bg); z-index: 10; }
.skip-link:focus { top: 8px; }
.site-header { border-top: 4px solid var(--accent); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1160px; margin: auto; padding: 24px 32px; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.site-name { font-size: 18px; font-weight: 650; line-height: 1.45; color: var(--ink); text-decoration: none; }
.site-label { display: block; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }
nav { display: flex; flex-wrap: wrap; gap: 8px 25px; }
nav a { font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.site-layout { width: 100%; max-width: 1160px; margin: 0 auto; padding: 64px 32px 88px; display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 76px; flex: 1; }
.profile { align-self: start; }
.site-layout.is-home { padding-top: 44px; padding-bottom: 58px; }  /* room for WALL·E above the footer line */
.is-home .intro { margin-bottom: 16px; }
.is-home .section-heading { margin-top: 28px; }
.portrait { display: block; width: 180px; height: 180px; border-radius: 50%; object-fit: cover; margin-bottom: 26px; }
/* بسم الله tilted 45° in an empty spot: in the left page margin on wide windows, otherwise in the
   empty top-left corner around the round portrait. It is positioned absolutely, so the layout is
   exactly the same as without it. Hidden on phones, where there is no room. */
.profile { position: relative; }
.profile-besm { position: absolute; left: -19px; top: 2px; width: 64px; height: auto; transform: rotate(-45deg); opacity: .85; pointer-events: none; }
:root[data-theme="dark"] .profile-besm { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .profile-besm { filter: invert(1); } }
@media (max-width: 640px) { .profile-besm { display: none; } }
/* Wide windows: in the empty margin left of the header, centred on the name block. The sidebar copy
   (in the portrait corner) is used only where that margin is too narrow. */
.site-header { position: relative; }
.header-besm { display: none; }
@media (min-width: 1360px) {
  .profile-besm { display: none; }
  .header-besm { display: block; position: absolute; width: 90px; height: auto; opacity: .85; pointer-events: none;
    left: calc((100vw - 1160px) / 4 + 16px); top: 50%; transform: translate(-50%, -50%) rotate(-45deg); }
  :root[data-theme="dark"] .header-besm { filter: invert(1); }
}
@media (min-width: 1360px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .header-besm { filter: invert(1); } }
.monogram { display: grid; place-items: center; background: var(--soft); color: var(--accent); font: 46px Georgia, serif; border: 1px solid var(--accent-border); letter-spacing: -.04em; }
.profile h2 { font-size: 22px; line-height: 1.4; font-weight: 600; margin: 0 0 10px; }
.profile-role { color: var(--muted); margin: 0 0 24px; font-size: 15px; }
.profile-links { list-style: none; margin: 0; padding: 0; }
.profile-links li { display: flex; align-items: center; gap: 11px; font-size: 14px; line-height: 1.5; padding: 2px 0; color: var(--muted); }
.profile-links a { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.profile-links a:hover span { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); }
.profile-links .icon { flex: none; width: 17px; height: 17px; color: var(--muted); }
.profile-link-email .icon, .profile-link-location .icon, .profile-link-institution .icon { color: var(--accent); }
.profile-link-scholar .icon { color: #4285f4; }
.profile-link-orcid .icon { color: #a6ce39; }
.profile-link-github .icon { color: var(--ink); }
.profile-link-linkedin .icon { color: #0a66c2; }
.profile-link-youtube .icon { color: #ff0000; }
.profile-note { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 215px; }
.eyebrow { margin: 0 0 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .15em; font-weight: 600; color: var(--accent); }
h1 { font: 400 clamp(32px, 4vw, 43px)/1.22 Georgia, "Times New Roman", serif; letter-spacing: -.025em; margin: 0 0 27px; }
h2 { font-size: 22px; line-height: 1.45; font-weight: 600; margin: 40px 0 16px; }
p { margin: 0 0 13px; }   /* body text: line height 1.6 and 13px between paragraphs, site-wide */
.intro { font-size: 20px; line-height: 1.6; }
.bio { max-width: 720px; }
.bio p { margin: 0 0 13px; }
.interest-list { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; max-width: 720px; }
.interest-list li { position: relative; padding: 3px 0 3px 20px; font-size: 16px; }
.interest-list li::before { content: ""; position: absolute; left: 2px; top: 50%; width: 7px; height: 7px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
@media (max-width: 640px) { .interest-list { grid-template-columns: 1fr; } }
.section-heading { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.placeholder { color: var(--muted); font-size: 15px; }
.preview-note { border-left: 3px solid var(--accent); padding: 14px 20px; background: var(--soft); font-size: 14px; color: var(--muted); margin: 28px 0 34px; }
.preview-note strong { display: block; color: var(--ink); margin-bottom: 3px; font-weight: 600; }
.section-links { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.section-links a { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 15px; }
.site-footer { position: relative; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer > div { max-width: 1160px; padding: 22px 32px; margin: auto; display: flex; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; }
.site-footer a { color: inherit; }
@media (max-width: 900px) { .header-inner { align-items: flex-start; flex-direction: column; gap: 14px; } .site-layout { gap: 40px; grid-template-columns: 210px minmax(0,1fr); } }
@media (max-width: 640px) { body { font-size: 16px; } .header-inner { padding: 20px 24px 14px; } nav { gap: 6px 20px; } nav a { font-size: 13px; } .site-layout { display: block; padding: 32px 24px 52px; } .profile { display: grid; grid-template-columns: 86px minmax(0,1fr); gap: 0 20px; padding-bottom: 28px; margin-bottom: 34px; border-bottom: 1px solid var(--line); } .portrait { width: 86px; height: 86px; grid-row: 1 / 4; margin: 0; font-size: 26px; } .profile h2 { font-size: 18px; } .profile-role { font-size: 13px; margin: 0 0 6px; } .profile-links { display: flex; flex-wrap: wrap; gap: 4px 14px; } .profile-links li { padding: 2px 0; } .profile-links a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .profile-links a .icon { width: 20px; height: 20px; } .profile-links li { font-size: 13px; } .profile-links .profile-text { flex-basis: 100%; } .profile-note { display: none; } .intro { font-size: 18px; } .site-footer > div { padding: 20px 24px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Frame the original photograph without changing the image file. */
.portrait-photo { overflow: hidden; }
.portrait-photo img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 53%; transform: scale(1.65) translateX(-2%); }

/* Publication list: sort control, citations, resource buttons, abstracts. */
.publication-intro { font-size: 16px; color: var(--muted); max-width: 650px; }
.publication-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; }
.publication-sort[hidden], .publication-view[hidden], .publication-abstract[hidden], .publication-bibtex[hidden] { display: none; }
.publication-sort-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; color: var(--muted); margin-right: 6px; }
.publication-sort button { font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.publication-sort button:hover { color: var(--accent); border-color: var(--accent-line); }
.publication-sort button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.publication-sort button:focus-visible, .publication-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.publication-section .section-heading { font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 400; color: var(--accent); scroll-margin-top: 24px; }
.publication-list { padding-left: 25px; margin: 0; }
.publication-list-plain { list-style: none; padding-left: 0; }
.publication-list > li { padding: 7px 0 24px 8px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
/* A paper reached through a link (/publications/#id) glows briefly in the accent colour, then fades. */
.publication-list > li { scroll-margin-top: 24px; border-radius: 6px; }
.publication-list > li.flash { animation: target-glow 2.6s ease-out 1; }
@keyframes target-glow { 0%, 30% { background: var(--accent-ring); box-shadow: 0 0 0 10px var(--accent-ring); } 100% { background: transparent; box-shadow: 0 0 0 10px transparent; } }
.publication-list-plain > li { padding-left: 0; }
.publication-list > li:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.publication-list > li::marker { font-size: 14px; color: var(--accent); }
.publication-type { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; color: var(--muted); margin: 0 0 2px; }
.publication-title { font-size: 17px; font-weight: 600; line-height: 1.55; margin: 0 0 7px; overflow-wrap: break-word; }
.publication-authors, .publication-venue { font-size: 14px; line-height: 1.7; margin: 0 0 4px; }
.publication-authors { color: var(--muted); }
.publication-authors strong { font-weight: 600; color: var(--ink); }
.publication-authors a { color: inherit; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.publication-authors a:hover { color: var(--accent); text-decoration-color: currentColor; }
.publication-venue cite { font-style: italic; }
.publication-year { white-space: nowrap; }
.publication-status { display: inline-block; padding: 0 7px; margin: 4px 0 0 4px; background: var(--soft); color: var(--accent); border: 1px solid var(--accent-border); border-radius: 3px; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.publication-note { font-size: 13px; color: var(--muted); margin: 4px 0; }
.publication-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 12px 0 0; list-style: none; }
.publication-button { display: inline-block; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.2; letter-spacing: .02em; color: var(--accent); background: var(--bg); border: 1px solid var(--accent-line); border-radius: 4px; padding: 6px 11px; text-decoration: none; cursor: pointer; }
.publication-button:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.panel-toggle::after { content: "▾"; display: inline-block; margin-left: 5px; transition: transform .15s; }
.panel-toggle[aria-expanded="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.panel-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.publication-abstract { margin: 14px 0 0; padding: 14px 18px; background: var(--soft); border-left: 3px solid var(--accent); }
.publication-bibtex { position: relative; margin: 14px 0 0; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.publication-bibtex pre { margin: 0; padding: 14px 52px 14px 16px; overflow-x: auto; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--ink); }
.copy-button { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 6px; height: 30px; min-width: 30px; justify-content: center; padding: 0 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--muted); cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1; }
.copy-button:hover, .copy-button.is-copied { color: var(--accent); border-color: var(--accent-line); }
.copy-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy-status:empty { display: none; }
.publication-abstract p { margin: 0; font-size: 14px; line-height: 1.75; }
@media (max-width: 640px) { .publication-list { padding-left: 20px; } .publication-list-plain { padding-left: 0; } .publication-list > li { padding-left: 4px; } .publication-list-plain > li { padding-left: 0; } .publication-title { font-size: 16px; } .publication-section .section-heading { font-size: 23px; } }

/* Research page: GNC diagram and numbered research directions. */
.gnc { margin: 36px 0 12px; }
.gnc-root { position: relative; width: max-content; max-width: 100%; margin: 0 auto 28px; padding: 10px 22px; border: 1.5px solid var(--ink); border-radius: 999px; font-family: Georgia, "Times New Roman", serif; font-size: 18px; text-align: center; }
.gnc-root::after { content: ""; position: absolute; left: 50%; top: 100%; height: 28px; border-left: 1.5px solid var(--connector); }
.gnc-branches { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; padding-top: 24px; }
.gnc-branches::before { content: ""; position: absolute; top: 0; left: calc((100% - 36px) / 6); right: calc((100% - 36px) / 6); border-top: 1.5px solid var(--connector); }
.gnc-branch { position: relative; border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 6px; background: var(--c-soft); padding: 16px 16px 12px; }
.gnc-branch::before { content: ""; position: absolute; left: 50%; top: -27px; height: 24px; border-left: 1.5px solid var(--connector); }
.gnc-branch::after { content: ""; position: absolute; left: 50%; bottom: -29px; height: 28px; border-left: 1.5px dashed var(--c); }
.gnc-guidance { --c: var(--gui); --c-soft: var(--gui-soft); }
.gnc-navigation { --c: var(--nav); --c-soft: var(--nav-soft); }
.gnc-control { --c: var(--ctl); --c-soft: var(--ctl-soft); }
.gnc-branch-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; color: var(--c); }
.gnc-branch-head .icon { flex: none; margin-top: 3px; }
.gnc-branch h3 { margin: 0; font-size: 17px; line-height: 1.3; color: var(--c); }
.gnc-branch-head p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.gnc-branch ul { list-style: none; margin: 0; padding: 0; }
.gnc-branch li { border-top: 1px solid var(--hairline); }
.gnc-branch li a { display: block; padding: 7px 0; font-size: 14px; line-height: 1.4; color: var(--ink); text-decoration: none; }
.gnc-branch li a:hover { color: var(--c); }
.gnc-hub { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 28px; padding: 13px 18px; border-radius: 6px 6px 0 0; background: var(--hub-bg); color: var(--hub-ink); text-align: left; }
.gnc-hub strong { display: block; font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 19px; line-height: 1.3; }
.gnc-hub span { display: block; font-size: 12.5px; line-height: 1.4; color: var(--hub-muted); }
.gnc-base { display: block; padding: 8px 18px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 6px 6px; background: var(--soft); text-align: center; font-size: 13px; color: var(--muted); text-decoration: none; }
.gnc-base:hover { color: var(--accent); }
.gnc figcaption { margin-top: 12px; font-size: 13px; line-height: 1.6; color: var(--muted); text-align: center; }
.direction-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.direction-card { display: flex; gap: 14px; padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: 6px; scroll-margin-top: 24px; transition: border-color .15s, box-shadow .15s; }
.direction-card:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.direction-number { flex: none; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.2; color: var(--accent); }
.direction-card h3 { margin: 0 0 6px; font-size: 16px; line-height: 1.4; }
.direction-card h3 a { color: var(--ink); text-decoration: none; }
.direction-card h3 a:hover { color: var(--accent); text-decoration: underline; }
.direction-card p { margin: 0 0 10px; font-size: 14px; line-height: 1.65; color: var(--muted); }
.direction-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.direction-tags li { font-size: 11px; font-weight: 600; letter-spacing: .04em; padding: 1px 8px; border-radius: 999px; color: var(--c, var(--muted)); background: var(--c-soft, var(--soft)); }
.tag-guidance { --c: var(--gui); --c-soft: var(--gui-soft); }
.tag-navigation { --c: var(--nav); --c-soft: var(--nav-soft); }
.tag-control { --c: var(--ctl); --c-soft: var(--ctl-soft); }
@media (max-width: 900px) { .direction-list { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .gnc-branches { grid-template-columns: 1fr; gap: 28px; padding-top: 0; }
  .gnc-branches::before, .gnc-branch::after { display: none; }
  .gnc-branch::before { top: -30px; height: 28px; }
  .gnc-hub { position: relative; }
  .gnc-hub::before { content: ""; position: absolute; left: 50%; top: -29px; height: 28px; border-left: 1.5px solid var(--connector); }
}

/* Projects: listing (filter, sort, cards) and detail pages. */
.project-controls { display: grid; gap: 14px; margin: 0 0 28px; }
.project-controls[hidden], .project-card[hidden], .project-empty[hidden] { display: none; }
.project-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.project-filter button { font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.project-filter button:hover { color: var(--accent); border-color: var(--accent-line); }
.project-filter button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.project-filter button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.project-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 20px; }
.project-card { display: flex; flex-direction: row; text-align: left; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); transition: border-color .15s, box-shadow .15s; }
.project-card:hover { border-color: var(--accent-line); box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.project-thumb { display: block; flex: 0 0 38%; max-width: 300px; text-decoration: none; min-height: 200px; background: var(--soft); border-right: 1px solid var(--line); overflow: hidden; }
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-thumb-placeholder { display: grid; place-items: center; height: 100%; font: 48px Georgia, "Times New Roman", serif; color: var(--accent); background: linear-gradient(135deg, var(--nav-soft), var(--soft) 60%, var(--ctl-soft)); }
.project-card-body { min-width: 0; padding: 18px 22px 20px; display: flex; flex-direction: column; flex: 1; }
.project-card h2 { margin: 2px 0 8px; font-size: 18px; line-height: 1.4; }
.project-card h2 a { color: var(--ink); text-decoration: none; }
.project-card h2 a:hover { color: var(--accent); text-decoration: underline; }
.project-dates { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.project-summary { text-align: left; margin: 0 0 12px; font-size: 14px; line-height: 1.65; color: var(--muted); }
.project-categories { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 4px; }
.project-categories li, .project-categories a { font-size: 11px; font-weight: 600; letter-spacing: .03em; padding: 2px 9px; border-radius: 999px; background: var(--nav-soft); color: var(--accent); text-decoration: none; }
.project-categories li:has(a) { padding: 0; background: none; }
.project-categories a:hover { background: var(--accent); color: var(--on-accent); }
.project-card .project-links { margin-top: auto; padding-top: 10px; }
.project-empty { color: var(--muted); font-size: 15px; }
.project-meta { margin: -8px 0 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.project-body { max-width: 760px; }
.project-body h2 { font-size: 21px; margin: 34px 0 12px; }
.project-body h2:first-child { margin-top: 0; }
.project-body ul { padding-left: 22px; }
.project-figure { margin: 26px 0; }
.project-figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 6px; border: 1px solid var(--line); }
.project-figure figcaption { margin-top: 10px; font-size: 13px; line-height: 1.6; color: var(--muted); text-align: center; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.project-back { margin-top: 40px; font-size: 14px; }
@media (max-width: 640px) { .project-card { flex-direction: column; } .project-thumb { flex: none; max-width: none; min-height: 0; aspect-ratio: 16 / 9; border-right: 0; border-bottom: 1px solid var(--line); } }
.video-file { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); background: #000; }
.project-lead { font-size: 18px; line-height: 1.6; }
.project-glance { display: grid; grid-template-columns: max-content 1fr; gap: 8px 22px; margin: 26px 0; padding: 18px 22px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--soft); font-size: 14.5px; line-height: 1.6; }
.project-glance dt { font-weight: 600; color: var(--ink); }
.project-glance dd { margin: 0; color: var(--muted); }
.project-callout { margin: 22px 0; padding: 16px 20px; border-radius: 6px; background: var(--nav-soft); border: 1px solid var(--accent-border); }
.project-callout > :last-child { margin-bottom: 0; }
.project-callout strong:first-child { color: var(--accent); }
.figure-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 8px; }
.figure-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figure-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figure-grid figure { margin: 0; }
.figure-grid img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.figure-grid figcaption { margin-top: 6px; font-size: 12.5px; color: var(--muted); text-align: center; }
.figure-tabs { margin: 22px 0 30px; }
.figure-tabs-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.figure-tabs-bar[hidden], .figure-tabs [data-panel][hidden] { display: none; }
.figure-tabs-bar button { font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.figure-tabs-bar button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.figure-tabs-bar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.figure-tabs h4 { margin: 18px 0 0; font-size: 14px; font-weight: 600; color: var(--muted); }
.project-table { width: 100%; max-width: 520px; border-collapse: collapse; margin: 14px 0 22px; font-size: 14px; }
.project-table th, .project-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.project-table th:first-child, .project-table td:first-child { text-align: left; }
.project-table thead th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.project-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
@media (max-width: 640px) { .figure-grid, .figure-grid.cols-4 { grid-template-columns: 1fr; } .project-glance { grid-template-columns: 1fr; gap: 2px; } .project-glance dd { margin-bottom: 8px; } }
.zoomable { cursor: zoom-in; }
.zoomable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lightbox { max-width: min(1200px, 94vw); max-height: 94vh; padding: 14px; border: 0; border-radius: 8px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lightbox::backdrop { background: rgba(20,20,24,.75); }
.lightbox img { display: block; max-width: 100%; max-height: calc(94vh - 80px); margin: 0 auto; }
.lightbox-caption { margin: 8px 0 0; text-align: center; font-size: 14px; color: #555; }
.lightbox-caption:empty { display: none; }
.lightbox-close { position: absolute; top: 6px; right: 8px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(0,0,0,.06); font-size: 22px; line-height: 1; cursor: pointer; color: #333; }
.lightbox-close:hover { background: rgba(0,0,0,.12); }
.figure-note { margin: -2px 0 18px; font-size: 13px; color: var(--muted); text-align: center; }

/* Justified body text site-wide: paragraphs and list items in the main column get even
   right edges. Short UI text (captions, buttons, cards' meta, diagram labels) is excluded.
   On phones, text is left-aligned because justification leaves large gaps in narrow columns. */
main p, main li, main dd { text-align: justify; text-wrap: pretty; }
main figcaption, main .figure-note, main .project-dates, main .publication-type, main .publication-authors,
main .publication-venue, main .publication-note, main .publication-links li, main .project-categories li,
main .direction-tags li, main .gnc li, main .gnc-branch-head p, main .interest-list li, main .placeholder,
main .project-empty, main .lightbox-caption, main .project-back { text-align: left; }
main .figure-note, main .lightbox-caption, main figcaption { text-align: center; }
@media (max-width: 640px) { main p, main li, main dd { text-align: left; } }
.project-citation { max-width: 760px; margin-top: 44px; padding-top: 6px; border-top: 1px solid var(--line); }
.project-citation h2 { font-size: 21px; margin: 26px 0 10px; }
.citation-entry { margin: 0 0 18px; }
.citation-text { font-size: 14.5px; line-height: 1.65; margin: 0 0 4px; }
main .citation-text { text-align: left; }
/* Flowchart: <ol class="flowchart"><li>Step<small>detail</small></li>…</ol> (arrows drawn automatically). */
.flowchart { list-style: none; counter-reset: none; display: flex; align-items: stretch; flex-wrap: wrap; gap: 0; padding: 0; margin: 22px 0 8px; }
.flowchart li { position: relative; flex: 1 1 0; min-width: 120px; margin-right: 26px; padding: 12px 12px 10px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 6px; background: var(--soft); text-align: center; font-size: 14px; font-weight: 600; line-height: 1.35; }
.flowchart li:last-child { margin-right: 0; }
.flowchart li::after { content: ""; position: absolute; right: -21px; top: 50%; width: 16px; height: 2px; background: var(--connector); }
.flowchart li::before { content: ""; position: absolute; right: -22px; top: calc(50% - 4px); border: 5px solid transparent; border-left-color: var(--connector); border-right: 0; }
.flowchart li:last-child::after, .flowchart li:last-child::before { display: none; }
.flowchart small { display: block; margin-top: 4px; font-size: 12px; font-weight: 400; color: var(--muted); }
main .flowchart li { text-align: center; }
.flowchart li.is-new { border-top-color: var(--ctl); background: var(--ctl-soft); }
.flowchart-caption { margin: 6px 0 22px; font-size: 13px; color: var(--muted); text-align: center; }
main .flowchart-caption { text-align: center; }
.project-table.is-centered { margin-left: auto; margin-right: auto; }
.project-table td.best { font-weight: 700; color: var(--ink); }
@media (max-width: 640px) { .flowchart { flex-direction: column; } .flowchart li { margin: 0 0 22px; } .flowchart li::after { right: auto; left: 50%; top: auto; bottom: -18px; width: 2px; height: 14px; } .flowchart li::before { right: auto; left: calc(50% - 4px); top: auto; bottom: -23px; border: 5px solid transparent; border-top-color: var(--connector); border-bottom: 0; } }
/* A narrow figure floated beside the text (e.g. a vertical flowchart). */
.project-figure.figure-side { float: right; width: 190px; margin: 4px 0 16px 28px; }
.project-figure.figure-side img { border: 0; border-radius: 0; }
.project-body h2 { clear: both; }
@media (max-width: 640px) { .project-figure.figure-side { float: none; width: 170px; margin: 18px auto; } }

/* WALL·E footer animation: a transparent strip whose bottom edge rests on the footer divider.
   It never blocks clicks on the content underneath. */
.walle-strip { display: block; position: absolute; left: 0; right: 0; bottom: calc(100% - 10px); pointer-events: none; z-index: 3; }
.walle-strip canvas { display: block; width: 100%; height: 100%; }
/* WALL·E peeking from behind the right edge after his pass (drawn in 3D on the strip): a transparent
   click target over his head; clicking replays the animation. */
.walle-peek { display: block; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; z-index: 4; border-radius: 10px 0 0 10px; }
.walle-peek[hidden] { display: none; }
.walle-peek:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* CV page */
.cv-download { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 4px 0 30px; }
.cv-button { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--on-accent); background: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 10px 18px; text-decoration: none; }
.cv-button:hover { filter: brightness(1.08); color: var(--on-accent); }
.cv-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cv-updated { font-size: 13.5px; color: var(--muted); }
.cv h2, h2.cv-heading { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin: 34px 0 14px; }
.cv h3 { font-size: 16px; font-weight: 600; margin: 20px 0 6px; }
.cv ul { padding-left: 22px; margin: 0 0 6px; }
.cv li { text-align: left; hyphens: manual; }
.cv li { margin: 7px 0; line-height: 1.6; }
.cv li > ul { list-style: circle; margin: 4px 0 10px; }
.cv li > ul > li { margin: 3px 0; color: var(--muted); }
.cv li > ul > li a, .cv li > ul > li strong { color: inherit; }
.cv li > ul > li a { text-decoration: underline; text-underline-offset: 2px; }
.cv ul.cv-plain { list-style: none; padding-left: 0; }
.cv ul.cv-plain li { margin: 4px 0; }

/* News page */
.news-list { list-style: none; padding: 0; margin: 8px 0 0; }
.news-list li { display: grid; grid-template-columns: 92px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); line-height: 1.6; text-align: left; }
.news-list li:last-child { border-bottom: 0; }
.news-date { font-size: 14px; font-weight: 600; color: var(--accent); white-space: nowrap; padding-top: 1px; }
.news-text a { color: var(--accent); text-decoration: none; font-weight: 500; }
.news-text a:hover { text-decoration: underline; text-underline-offset: 2px; }
.news-text em { font-style: italic; }
.news-tag { white-space: nowrap; }
@media (max-width: 640px) { .news-list li { grid-template-columns: 1fr; gap: 2px; } }

/* Research page */
.research-intro { max-width: 760px; margin-bottom: 8px; }
.research-intro p { margin: 0 0 13px; }
.research-intro ol { padding-left: 22px; margin: 0 0 13px; }
.research-tag { white-space: nowrap; }
.research-intro li { margin: 6px 0; }
.research-list { list-style: none; padding: 0; margin: 26px 0 0; }
.research-item { display: flex; gap: 26px; align-items: flex-start; padding: 26px 0; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.research-figure { flex: 0 0 200px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.research-figure svg { display: block; width: 100%; height: auto; }
.research-text { flex: 1; min-width: 0; }
.research-text h2 { margin: 0 0 10px; font-size: 19px; line-height: 1.35; }
.research-text p { margin: 0 0 13px; }
.research-text a { color: var(--accent); text-decoration: none; }
.research-text a:hover { text-decoration: underline; text-underline-offset: 2px; }
.research-related { font-size: 14px; color: var(--muted); text-align: left; }
.research-related span { font-weight: 600; color: var(--ink); }
@media (max-width: 640px) { .research-item { flex-direction: column; gap: 14px; } .research-figure { flex: none; width: 100%; max-width: 280px; } }

/* Blog */
.post-list { list-style: none; padding: 0; margin: 8px 0 0; }
.post-card { display: flex; gap: 22px; align-items: flex-start; padding: 22px 0; border-top: 1px solid var(--line); }
.post-card:first-child { border-top: 0; padding-top: 4px; }
.post-thumb { flex: 0 0 180px; }
.post-thumb img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.post-card h2 { margin: 2px 0 8px; font-size: 20px; line-height: 1.35; }
.post-card h2 a { color: var(--ink); text-decoration: none; }
.post-card h2 a:hover { color: var(--accent); }
.post-card p { margin: 0; }
.post-meta { font-size: 13.5px; color: var(--muted); margin: -4px 0 18px; text-align: left; }
.post-card .post-meta { margin: 0; }
.series-toc { display: block; margin: 0 0 30px; padding: 14px 20px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--soft); }
.series-toc-title { margin: 0 0 6px; font-weight: 600; font-size: 14.5px; text-align: left; }
.series-toc ol { margin: 0; padding-left: 22px; font-size: 14.5px; }
.series-toc li { margin: 3px 0; text-align: left; }
.series-toc a { color: var(--accent); text-decoration: none; padding: 0; border: 0; font-size: inherit; font-weight: inherit; }
.series-toc a:hover { text-decoration: underline; }
.series-toc [aria-current] { font-weight: 600; }
.post-body h2 { margin-top: 38px; }
.post-body h3 { margin-top: 30px; font-size: 18px; }
.post-body h4 { margin: 24px 0 8px; font-size: 16px; font-weight: 600; }
.post-body figure { margin: 26px auto; text-align: center; }
.post-body figure img { display: inline-block; box-sizing: border-box; max-width: 100%; height: auto; background: #fff; border-radius: 6px; border: 1px solid var(--line); padding: 8px; }
.post-body figcaption { margin-top: 8px; font-size: 13.5px; line-height: 1.6; color: var(--muted); text-align: center; }
.post-body .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.post-def { margin: 20px 0; padding: 14px 18px; border-radius: 6px; background: var(--nav-soft); border: 1px solid var(--accent-border); }
.post-def > :last-child { margin-bottom: 0; }
.post-def > p:first-child strong:first-child { color: var(--accent); }
.series-nav { display: flex; justify-content: space-between; gap: 16px; margin: 44px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.series-nav a { display: flex; flex-direction: column; gap: 3px; max-width: 48%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14.5px; line-height: 1.4; }
.series-nav a span { font-size: 12.5px; font-weight: 500; color: var(--accent); }
.series-nav a:hover { border-color: var(--accent); color: var(--ink); }
.series-next { margin-left: auto; text-align: right; }
.post-back { margin-top: 28px; font-size: 14px; }
@media (max-width: 640px) { .post-card { flex-direction: column; gap: 12px; } .post-thumb { flex: none; width: 100%; } .series-nav { flex-direction: column; } .series-nav a { max-width: none; } .series-next { text-align: left; margin-left: 0; } }
