/* ============================================================
   PCIC Academic Portfolio — v3.1
   Modern academic: Inter + JetBrains Mono, Phosphor Icons
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=JetBrains+Mono:wght@400;500;600&family=Playfair+Display:wght@600;700;800&display=swap');

/* --- Custom Properties (Light/Dark) --- */
:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --bg-card: #f6f8fa;
  --text: #24292f;
  --text-dim: #57606a;
  --text-bright: #1b1f24;
  --accent: #0550ae;
  --accent-gold: #9a6700;
  --border: #d1d9e0;
  --border-subtle: #e8ecf0;
  --nav-bg: color-mix(in srgb, #ffffff 85%, transparent);
  --nav-border: #e8ecf0;
  --code-bg: #eff1f3;
  --link-hover: #002244;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-display: "Playfair Display", "Georgia", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", Consolas, monospace;
  --transition: 150ms ease;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --bg-alt: #161b22;
    --bg-card: #161b22;
    --text: #d1d5db;
    --text-dim: #9ca3af;
    --text-bright: #f0f6fc;
    --accent: #79b8ff;
    --accent-gold: #e3b341;
    --border: #30363d;
    --border-subtle: #21262d;
    --nav-bg: color-mix(in srgb, #0d1117 80%, transparent);
    --nav-border: #21262d;
    --code-bg: #1c2128;
    --link-hover: #a5d6ff;
  }
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --bg-card: #161b22;
  --text: #d1d5db;
  --text-dim: #9ca3af;
  --text-bright: #f0f6fc;
  --accent: #79b8ff;
  --accent-gold: #e3b341;
  --border: #30363d;
  --border-subtle: #21262d;
  --nav-bg: color-mix(in srgb, #0d1117 80%, transparent);
  --nav-border: #21262d;
  --code-bg: #1c2128;
  --link-hover: #a5d6ff;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* --- Fade-in animation --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

main {
  animation: fadeIn 0.4s ease-out;
}

/* --- Links --- */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Layout --- */
.wrap {
  max-width: 72ch;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Navigation --- */
nav.top {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nav-border);
  padding: 0.75rem 0;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
}

nav.top .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  align-items: baseline;
}

nav.top .site {
  color: var(--text-bright);
  font-weight: 650;
  margin-right: auto;
  letter-spacing: -0.02em;
}

nav.top a {
  color: var(--text-dim);
  padding: 0.2rem 0;
  transition: color var(--transition);
  position: relative;
}

nav.top a:hover {
  color: var(--text-bright);
  text-decoration: none;
}

nav.top a.active {
  color: var(--text-bright);
  font-weight: 550;
}

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  font-size: 1rem;
  line-height: 1;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  color: var(--text-bright);
  border-color: var(--border);
  background: var(--bg-alt);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

nav.top a.active::after {
  content: '';
  position: absolute;
  bottom: -0.75rem;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* --- Header --- */
h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.8vw, 2rem);
  font-weight: 700;
  color: var(--text-bright);
  margin: 2.5rem 0 0.3rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-dim);
  font-size: clamp(0.9rem, 1.5vw, 1rem);
  margin-bottom: 0.2rem;
  font-weight: 400;
}

.meta {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* --- Headings --- */
h2 {
  font-size: clamp(1.1rem, 1.8vw, 1.25rem);
  font-weight: 650;
  color: var(--text-bright);
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 0.15rem;
  letter-spacing: -0.01em;
}

/* --- Prose --- */
p { margin: 0.5rem 0; }
ul, ol { padding-left: 1.5rem; margin: 0.5rem 0; }
li { margin: 0.3rem 0; }

/* --- Semester Grid (index page) --- */
.semester-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.semester-card {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  display: block;
  color: inherit;
}

.semester-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--bg-card) 90%, var(--accent) 10%);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 12%, transparent);
}

.semester-card .sem-id {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.semester-card .sem-period {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.semester-card .sem-count {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* --- Course Blocks --- */
.course {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-subtle);
  transition: border-color var(--transition);
}

.course:hover {
  border-left-color: var(--accent);
}

.course .prof {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin: 0.1rem 0 0.25rem;
}

.course .prof a {
  color: var(--text-dim);
}

.course .prof a:hover {
  color: var(--accent);
}

.course .desc {
  font-size: 0.925rem;
  margin-top: 0.2rem;
  line-height: 1.65;
}

/* Demo link */
.demo-link {
  font-size: 0.825rem;
  font-family: var(--font-mono);
  color: var(--accent);
  white-space: nowrap;
}

.demo-link:hover {
  color: var(--link-hover);
}

/* --- Sinodal Blocks (EGC) --- */
.sinodal {
  margin-bottom: 2rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-subtle);
  transition: border-color var(--transition);
}

.sinodal:hover {
  border-left-color: var(--accent-gold);
}

.sinodal h3 {
  margin-bottom: 0.1rem;
}

.sinodal .inst {
  color: var(--text-dim);
  font-size: 0.825rem;
  margin-bottom: 0.3rem;
}

.sinodal .project {
  font-weight: 600;
  color: var(--accent-gold);
  font-size: 0.95rem;
  margin: 0.35rem 0 0.25rem;
}

.sinodal .desc {
  font-size: 0.925rem;
  line-height: 1.65;
}

.sinodal .repo {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  margin-top: 0.4rem;
}

.sinodal .repo a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-dim);
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: all var(--transition);
}

.sinodal .repo a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

/* --- EGC Summary (on index) --- */
.egc-intro {
  font-size: 0.925rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.sinodal-list {
  list-style: none;
  padding-left: 0;
  margin: 0.5rem 0;
}

.sinodal-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.sinodal-list li:last-child {
  border-bottom: none;
}

.sinodal-list .proj-label {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-left: auto;
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* --- Footer --- */
footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-dim);
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.footer-logos {
  width: 100%;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-logo-wide {
  height: 32px;
}

.footer-logo {
  height: 52px;
  width: auto;
  opacity: 0.85;
  transition: opacity var(--transition);
  filter: var(--logo-filter, none);
}

.footer-logo:hover {
  opacity: 1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --logo-filter: invert(1) hue-rotate(180deg);
  }
}

[data-theme="dark"] {
  --logo-filter: invert(1) hue-rotate(180deg);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

footer a {
  color: var(--text-dim);
  transition: color var(--transition);
}

footer a:hover {
  color: var(--accent);
}

footer span {
  color: color-mix(in srgb, var(--text-dim) 70%, transparent);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .wrap { padding: 0 1rem; }
  .semester-grid { grid-template-columns: 1fr; }
  nav.top .wrap { gap: 0.3rem 0.75rem; }
  .sinodal-list li { flex-direction: column; gap: 0.1rem; }
  .sinodal-list .proj-label { margin-left: 0; }
}

/* --- Icon styling --- */
.ph { font-size: 1em; vertical-align: -0.1em; margin-right: 0.2em; opacity: 0.7; }
h1 .ph, h2 .ph { opacity: 0.5; }
h3 .ph { opacity: 0.6; color: var(--accent); }
.meta .ph { opacity: 0.5; font-size: 0.9em; }
nav.top .site .ph { font-size: 1.1em; vertical-align: -0.15em; opacity: 0.8; }
.sinodal-list .ph { color: var(--accent); opacity: 0.6; font-size: 1em; }

.ferris-icon,
.brand-icon {
  height: 1.15em;
  width: auto;
  vertical-align: -0.2em;
  display: inline-block;
  margin-right: 0.15em;
}

.brand-icon-sm {
  height: 0.9em;
  opacity: 0.7;
}

/* --- Semester card icon enhancements --- */
.semester-card .sem-count .ph { opacity: 0.5; font-size: 0.9em; }

/* --- Better sinodal list spacing with icons --- */
.sinodal-list li { gap: 0.4rem; }

/* --- Profile header (index) --- */
.profile-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin: 2.5rem 0 1.5rem;
}

.profile-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-subtle);
  flex-shrink: 0;
}

.profile-info h1 {
  margin-top: 0;
}

.profile-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.825rem;
  color: var(--text-dim);
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: all var(--transition);
  font-family: var(--font-mono);
}

.profile-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.research-statement {
  font-size: 0.925rem;
  color: var(--text);
  line-height: 1.7;
  margin: 0.75rem 0 2rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--accent);
}

@media (max-width: 640px) {
  .profile-header { flex-direction: column; align-items: center; text-align: center; }
  .profile-links { justify-content: center; }
  .profile-photo { width: 80px; height: 80px; }
}

/* --- Course code tag --- (available for use) */

/* --- Professor card style --- */
.prof .ph { font-size: 0.85em; opacity: 0.5; }

/* --- Demo link arrow animation --- */
.demo-link .ph { transition: transform var(--transition); }
.demo-link:hover .ph { transform: translateX(2px); }
