/*
Theme Name: Sirani Academic
Theme URI: https://sperera.com
Author: Cybernetic Networks
Author URI: https://cyberneticnetworks.com
Description: Academic portfolio theme for Dr. Sirani M. Perera. Research, publications, conferences, awards and media with a Customizer-managed home page.
Version: 2.3.1
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sirani-academic
*/

/* ---------- Tokens ---------- */
:root {
	--ink: #142033;
	--ink-2: #3d4a60;
	--muted: #5b687d;
	--paper: #fff;
	--soft: #f3f5f9;
	--line: #dfe5ee;
	--navy: #203966;
	--navy-2: #2c4c85;
	--plum: #76506f;
	--gold: #b08a45;
	--max: 1180px;
	--radius: 14px;
	--serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter", Georgia, serif;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; font-family: var(--sans); font-size: 1.0625rem; line-height: 1.65; color: var(--ink); background: var(--paper); text-rendering: optimizeLegibility; }
img, video, iframe { max-width: 100%; height: auto; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--navy-2); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, .statement, .brand, .stat dt, .pub-year { font-family: var(--serif); font-weight: 600; }
h1 { font-size: clamp(2.5rem, 5.4vw, 4.4rem); line-height: 1.04; letter-spacing: -.015em; margin: 0 0 .35em; }
h2 { font-size: clamp(1.75rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h3 { font-size: 1.22rem; line-height: 1.3; margin: 0 0 .4em; }
h3 a, h2 a { color: inherit; text-decoration: none; }
h3 a:hover, h2 a:hover { color: var(--navy); text-decoration: underline; }
p { margin: 0 0 1em; }
.wrap { width: min(var(--max), calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.admin-bar .site-header { top: 32px; }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 24px; }
.brand { font-size: 1.2rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.menu-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.menu-list a { display: block; padding: 6px 0; font-size: .95rem; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; }
.menu-list a:hover { color: var(--navy); border-bottom-color: var(--line); }
.menu-list .current-menu-item > a, .menu-list .current_page_item > a, .menu-list .current-menu-ancestor > a { color: var(--navy); border-bottom-color: var(--gold); }
.nav-toggle { display: none; align-items: center; gap: 10px; font: inherit; font-size: .95rem; color: var(--ink); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -5px; } .nav-toggle-bars::after { top: 5px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }

/* ---------- Buttons & links ---------- */
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 20px; border-radius: 999px; border: 1px solid var(--navy); font-weight: 600; font-size: .98rem; text-decoration: none; transition: background-color .15s, color .15s; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: var(--soft); }
.text-link { font-weight: 600; font-size: .95rem; }

/* ---------- Sections (inner pages) ---------- */
.section { padding: 76px 0; }
.section.alt { background: var(--soft); }

/* ---------- Home page (built from blocks on Pages > Home) ---------- */
.home-blocks > * { margin: 0; }
/* Sections run full width; padding keeps content in the 1180px column. */
.sa-hero, .sa-section, .sa-links { padding-inline: max(20px, calc((100% - var(--max)) / 2)); }
.sa-section { padding-block: 76px; }
.sa-section.is-alt { background: var(--soft); }
.wp-block-group__inner-container > :first-child { margin-top: 0; }

/* Hero. Faint banded diagonals behind the photo nod to the constant
   diagonals of Toeplitz and other structured matrices. */
.sa-hero { position: relative; overflow: hidden; padding-block: 80px 72px; background: linear-gradient(160deg, #fafbfd 0%, #eef2f8 70%, #f6f1f5 100%); }
.sa-hero::before { content: ""; position: absolute; inset: 0 0 0 45%; pointer-events: none;
	background:
		repeating-linear-gradient(135deg, transparent 0 22px, rgba(32,57,102,.055) 22px 23px),
		repeating-linear-gradient(135deg, transparent 0 68px, rgba(118,80,111,.07) 68px 92px);
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 35%);
	mask-image: linear-gradient(90deg, transparent, #000 35%);
}
.sa-hero > *, .sa-hero .wp-block-group__inner-container { position: relative; }
.sa-hero-cols { gap: 64px; margin: 0; }
.sa-hero h1 { max-width: 12ch; }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.28rem); line-height: 1.5; color: var(--ink-2); max-width: 46ch; margin-bottom: .9em; }
.hero-intro { color: var(--muted); max-width: 60ch; }
.sa-hero .wp-block-buttons { margin-top: 28px; }
.sa-portrait { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 14px 14px 0; box-shadow: 0 24px 60px -24px rgba(20,32,51,.28); }
.sa-portrait img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border-radius: 14px; background: var(--soft); }
.hero-note { margin: 0; background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 22px 22px; font-size: .88rem; color: var(--muted); padding: 12px 20px 14px; line-height: 1.45; }

/* Buttons (core Button block) */
.wp-block-button__link { background: var(--navy); color: #fff; border: 1px solid var(--navy); border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: .98rem; text-decoration: none; transition: background-color .15s, color .15s; }
.wp-block-button__link:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.wp-block-button.is-style-outline > .wp-block-button__link { background: #fff; color: var(--navy); border: 1px solid var(--navy); padding: 11px 20px; }
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--soft); color: var(--navy); }
.wp-block-buttons { gap: 12px; }

/* Profile links row */
.sa-links { padding-block: 16px; border-bottom: 1px solid var(--line); background: #fff; }
.sa-links .wp-block-buttons { gap: 10px; }
.sa-links .wp-block-button.is-style-outline > .wp-block-button__link { border-color: var(--line); color: var(--ink-2); padding: 7px 14px; font-size: .9rem; }
.sa-links .wp-block-button__link::after { content: " ↗"; }
.sa-links .wp-block-button.is-style-outline > .wp-block-button__link:hover { border-color: var(--navy); color: var(--navy); background: #fff; }

/* Section heading row */
.sa-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 24px; flex-wrap: wrap; margin-bottom: 32px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.sa-section-head > .wp-block-group__inner-container { display: contents; }
.sa-section-head h2 { margin: 0; }
.sa-more { margin: 0; font-weight: 600; font-size: .95rem; }

/* Introduction + stats */
.sa-about { gap: 64px; margin: 0; }
.statement { font-size: clamp(2.2rem, 4.2vw, 3.6rem); line-height: 1.08; letter-spacing: -.02em; margin: 0; color: var(--navy); }
.sa-about .wp-block-column > p:not([class]) { max-width: 72ch; }
.sa-stats { gap: 0; margin: 36px 0 0; border-top: 1px solid var(--line); }
.sa-stats > .wp-block-column { padding: 18px 16px 4px 0; }
.sa-stats > .wp-block-column + .wp-block-column { padding-left: 16px; border-left: 1px solid var(--line); }
.stat-num { font-family: var(--serif); font-weight: 600; font-size: 2rem; line-height: 1.1; margin: 0; }
.stat-label { margin: 4px 0 0; font-size: .86rem; line-height: 1.4; color: var(--muted); }

.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; color: var(--muted); margin: 0 0 .5em; }
.meta-year { font-weight: 700; color: var(--plum); }
.entry-content { max-width: 72ch; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content h2 { margin-top: 1.4em; }
.entry-content li { margin: .4em 0; }
.entry-content img { border-radius: var(--radius); }

/* Highlighted awards */
.card.award-card { border-top-color: var(--gold); }
.card-image { margin: -22px -24px 16px; }
.card-image img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px 4px 0 0; }
.entry-content .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Cards (research, media) */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: 4px 4px var(--radius) var(--radius); padding: 22px 24px 20px; }
.card p:last-child { margin-bottom: 0; }
.card > p:not(.meta) { color: var(--ink-2); font-size: .98rem; }

/* Publications in citation style */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.pub:first-child { padding-top: 4px; }
.pub-year { font-size: 1.3rem; color: var(--plum); line-height: 1.3; }
.pub-body h3 { font-size: 1.15rem; max-width: 70ch; }
.pub-authors p { margin: 0 0 .3em; color: var(--ink-2); font-size: .97rem; }
.pub-venue { margin: 0; font-size: .93rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.pub-venue cite { font-style: italic; }

/* Talks */
.talk-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.talk-list li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.talk-list p:not(.meta) { margin: 0; color: var(--ink-2); font-size: .97rem; }

/* ---------- Inner pages ---------- */
.page-hero { padding: 64px 0 36px; background: var(--soft); border-bottom: 1px solid var(--line); }
.page-hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.8rem); max-width: 22ch; }
.page-hero .lead { margin-bottom: 0; }
.crumb { margin: 0 0 .6em; font-size: .92rem; font-weight: 600; }
.crumb a::before { content: "← "; }
.archive-list { padding: 36px 0 84px; }
.entry { border-bottom: 1px solid var(--line); padding: 24px 0; max-width: 820px; }
.entry h2 { font-size: 1.45rem; margin: .1em 0 .3em; }
.entry-summary p { color: var(--ink-2); margin-bottom: .5em; }
.entry-figure { margin: 0 0 28px; }
.entry-figure img { border-radius: var(--radius); }
.video-embed { margin: 0 0 28px; }
.video-embed iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: var(--radius); }
.notice { font-size: .92rem; color: var(--ink-2); padding: 14px 18px; border-radius: 10px; background: #fbf6ea; border: 1px solid #ecdcb5; max-width: 820px; }
.nav-links { display: flex; gap: 10px; margin-top: 28px; }
.page-numbers { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.page-numbers.current { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Block editor alignment */
.entry-content .alignwide { max-width: min(1100px, 100vw - 40px); }
.entry-content .alignfull { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); }
.wp-block-image img { border-radius: var(--radius); }
.alignleft { float: left; margin: .3em 1.5em 1em 0; }
.alignright { float: right; margin: .3em 0 1em 1.5em; }
.aligncenter { margin-inline: auto; }

/* ---------- Footer ---------- */
.site-footer { padding: 48px 0 28px; background: #142033; color: #d5ddea; }
.site-footer a { color: #fff; }
.footer-grid { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.footer-grid p { margin: 0; }
.footer-name { font-family: var(--serif); font-size: 1.2rem; color: #fff; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.footer-small { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: .84rem; color: #9fabbf; }
.footer-small p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
	.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sa-stats { flex-wrap: wrap !important; }
	.sa-stats > .wp-block-column { flex: 1 1 40% !important; }
	.sa-stats > .wp-block-column:nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 900px) {
	.js .nav-toggle { display: inline-flex; }
	.js .menu { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 16px 30px -18px rgba(20,32,51,.3); }
	.js .menu.is-open { display: block; }
	.js .menu-list { flex-direction: column; gap: 0; width: min(var(--max), calc(100% - 40px)); margin: 0 auto; padding: 8px 0 16px; }
	.js .menu-list a { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 1.02rem; }
	.js .menu-list .current-menu-item > a { border-bottom-color: var(--line); box-shadow: inset 3px 0 0 var(--gold); padding-left: 12px; }
	.sa-hero { padding-block: 48px 56px; }
	.sa-hero::before { inset: 0; -webkit-mask-image: linear-gradient(180deg, transparent 30%, #000); mask-image: linear-gradient(180deg, transparent 30%, #000); }
	.sa-hero-cols, .sa-about { gap: 40px; }
	.talk-list { grid-template-columns: 1fr; }
}
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 620px) {
	.wrap { width: calc(100% - 32px); }
	body { font-size: 1rem; }
	.section, .sa-section { padding-block: 56px; }
	.grid, .entry-content .grid { grid-template-columns: 1fr; }
	.sa-stats > .wp-block-column, .sa-stats > .wp-block-column + .wp-block-column { flex-basis: 100% !important; border-left: 0; padding-left: 0; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
	.sa-portrait, .hero-note { max-width: 420px; }
	.pub { grid-template-columns: 1fr; gap: 4px; }
	.pub-year { font-size: 1.05rem; }
}
@media print {
	.site-header, .sa-links, .wp-block-buttons, .site-footer, .sa-hero::before { display: none; }
	.sa-hero { background: none; padding: 0; }
}
