/* =========================================================
   Shared site styles (loaded by every page)
   + styles for the About page (index.html)
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root {
  --bg: #f4f6f7;
  --surface: #ffffff;
  --border: #e3e7ea;
  --text: #1a1a1a;
  --text-muted: #6c757d;
  --accent: #157a6e;        /* theme color: active tab, hover, headings */
  --accent-contrast: #ffffff;
  --link: #11906f;          /* inline links */
  --pill-bg: #f7f9fa;
  --pill-hover: #eef4f2;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 8px rgba(16, 24, 40, 0.04);
  --radius: 16px;
  --nav-height: 64px;
  --max-width: 1240px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121417;
  --surface: #1b1e22;
  --border: #2c3137;
  --text: #e6e8eb;
  --text-muted: #9aa3ad;
  --accent: #2aa692;
  --accent-contrast: #0d1412;
  --link: #3cc49f;
  --pill-bg: #202429;
  --pill-hover: #252c2b;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

body {
  margin: 0;
  font-family: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  width: 100%;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.5em;
}

/* ---------- Navigation (rendered by script.js) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--nav-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text);
  white-space: nowrap;
}

.nav-brand strong {
  font-weight: 500;
}

/* No brand on the About page (the name is on the profile card), like the template */
.nav-brand[hidden] {
  display: none;
}

.nav-actions {
  margin-left: auto;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 6px 11px;
  color: var(--text);
  font-family: "Roboto", system-ui, sans-serif;
  font-size: 1.08rem;
  font-weight: 300;
  text-transform: lowercase;
  white-space: nowrap;
  transition: color 0.15s ease;
}

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

.nav-links a[aria-current="page"] {
  color: var(--accent);
  font-weight: 400;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--accent);
}

.nav-toggle {
  display: none;
}

@media (max-width: 1180px) {
  .nav-toggle {
    display: inline-grid;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px 16px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .site-header.is-open .nav-links {
    display: flex;
  }

  .nav-links a {
    padding: 10px 12px;
  }
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
}

.card + .card {
  margin-top: 32px;
}

.section-title {
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 500;
  margin-bottom: 12px;
}

/* Page heading used by the inner pages */
.page-header {
  margin: 24px 0 24px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
}

/* ---------- Footer (rendered by script.js) ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px 16px;
}

/* =========================================================
   About page
   ========================================================= */
.about-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

/* Left profile card: stays fixed below the tab bar while the page scrolls */
.profile-card {
  position: sticky;
  top: calc(var(--nav-height) + 16px);
  max-height: calc(100vh - var(--nav-height) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  text-align: center;
  padding: 24px 22px;
  font-size: 0.9rem;
}

.profile-photo,
.profile-photo-fallback {
  width: 100%;
  margin: 0 auto;
  border-radius: 14px;
}

/* Photo keeps its own shape (no cropping) */
.profile-photo {
  max-width: 210px;
  height: auto;
  background: var(--pill-bg);
}

.profile-photo-fallback {
  max-width: 170px;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: var(--pill-hover);
  color: var(--accent);
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.profile-name {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 16px 0 8px;
}

.profile-info {
  margin: 0;
  line-height: 1.55;
}

.profile-info p {
  margin: 0;
}

.profile-email {
  margin-top: 6px !important;
  overflow-wrap: anywhere;
}

.profile-links {
  list-style: none;
  margin: 16px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 7px;
  text-align: left;
}

.profile-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--text);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.profile-links a:hover {
  text-decoration: none;
  background: var(--pill-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.profile-links i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
}

/* Right column */
.about-main {
  min-width: 0;
}

.bio {
  font-size: 1rem;
  line-height: 1.6;
}

.bio p {
  margin: 0 0 0.9em;
}

.bio p:last-child {
  margin-bottom: 0;
}

/* News list */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-list li {
  font-size: 1rem;
  line-height: 1.6;
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  padding: 8px 0;
}

.news-date {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding-top: 2px;
}

.news-tag {
  display: inline-block;
  padding: 0 8px;
  margin-left: 2px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: 1px;
  white-space: nowrap;
}

.news-tag:hover {
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-contrast);
}

.news-older {
  margin-top: 12px;
}

.news-older summary {
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--link);
  list-style: none;
}

.news-older summary::-webkit-details-marker {
  display: none;
}

.news-older summary::before {
  content: "\25B6";
  display: inline-block;
  font-size: 0.75em;
  margin-right: 8px;
  transition: transform 0.15s ease;
}

.news-older[open] summary::before {
  transform: rotate(90deg);
}

.news-older[open] summary {
  margin-bottom: 4px;
}

/* ---------- Education: five cards in a single row ---------- */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.edu-row {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.edu-card {
  min-width: 0; /* let long names wrap instead of widening the column */
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow-wrap: anywhere;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.edu-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.06);
}

.edu-card p {
  margin: 0;
}

/* Logo with the medal pinned to its top-right corner */
.edu-logo {
  position: relative;
  flex: none;
  width: 60px;
  height: 60px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}

.edu-logo img {
  width: 50px;
  height: 50px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.edu-logo > .fa-school {
  font-size: 1.35rem;
  color: var(--accent);
}

.edu-medal {
  position: absolute;
  top: -15px;
  right: -9px;
  width: 22px;
  height: 29px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

.edu-body {
  width: 100%;
  font-size: 0.75rem;
  line-height: 1.35;
}

.edu-inst {
  font-size: 0.78rem;
  font-weight: 500;
}

.edu-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px 6px;
  margin-top: 6px !important;
}

.edu-exam {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.66rem;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
}

.edu-dates {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.edu-result {
  font-size: 0.72rem;
  margin: 6px 0 16px !important; /* room for the medal on the award chip's corner */
}

/* Award chip, pushed to the bottom so every card lines up */
.edu-award {
  margin-top: auto;
  position: relative;
  width: 100%;
  padding: 8px 6px 6px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: center;
  line-height: 1.25;
}

.edu-award span {
  font-size: 0.68rem;
  font-weight: 600;
}

.edu-award small {
  font-size: 0.62rem;
  opacity: 0.85;
}

.edu-award--gold {
  background: #fdf4d6;
  color: #7a5c00;
}

.edu-award--silver {
  background: #eef0f3;
  color: #535a63;
}

:root[data-theme="dark"] .edu-award--gold {
  background: #3a3115;
  color: #f2d27a;
}

:root[data-theme="dark"] .edu-award--silver {
  background: #2a2e34;
  color: #c3c9d1;
}

/* Phones only: 5 columns would be unreadable, so wrap to 2 */
@media (max-width: 560px) {
  .edu-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Hobbies: four cards in a single row ---------- */
.hobby-row {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hobby-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hobby-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.06);
}

.hobby-media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  overflow: hidden;
  background: var(--pill-bg);
}

.hobby-media video,
.hobby-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Two videos stacked, each taking half the frame */
.hobby-media--split {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  background: var(--border);
}

.hobby-media--split video {
  min-height: 0;
}

/* Slideshow: images stacked, the active one fades in */
.hobby-slideshow img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.hobby-slideshow img.is-active {
  opacity: 1;
}

.hobby-media--icon {
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--pill-hover), var(--pill-bg));
  color: var(--accent);
}

.hobby-media--icon i {
  font-size: 3.6rem;
  animation: hobby-pulse 2.4s ease-in-out infinite;
}

@keyframes hobby-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.08); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hobby-media--icon i {
    animation: none;
  }
}

.hobby-title {
  margin: 0;
  padding: 10px 4px 4px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
}

.hobby-title i {
  color: var(--accent);
  margin-right: 3px;
}

/* Phones only: wrap to 2 per row */
@media (max-width: 560px) {
  .hobby-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .about-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .profile-card {
    position: static;
    max-height: none;
    overflow: visible;
    max-width: 340px;
    width: 100%;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .card {
    padding: 22px 20px;
  }

  .news-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}
