/* ==========================================================================
   Ibrahim Enes Atac — Academic Website Stylesheet
   Inspired by clean minimalist academic layouts (Martin Lukk)
   Built for WCAG AA/AAA contrast, keyboard navigation, and mobile clarity
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;          /* 18.8:1 on #ffffff (AAA) */
  --text-muted: #475569;    /* 7.58:1 on #ffffff (AAA) */
  --accent: #1d4ed8;        /* 6.70:1 on #ffffff (AA+) */
  --accent-hover: #1e3a8a;  /* 10.4:1 on #ffffff (AAA) */
  --accent-soft: #eff6ff;
  --award-bg: #fefce8;
  --award-border: #fde047;
  --award-text: #713f12;
  --focus-ring: #1d4ed8;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1060px;
  --sidebar-width: 248px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #273549;
  --border: #334155;
  --border-strong: #475569;
  --text: #f8fafc;          /* 17.8:1 on #0f172a (AAA) */
  --text-muted: #cbd5e1;    /* 11.4:1 on #0f172a (AAA) */
  --accent: #93c5fd;        /* 9.6:1 on #0f172a (AAA) */
  --accent-hover: #bfdbfe;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --award-bg: rgba(250, 204, 21, 0.12);
  --award-border: rgba(250, 204, 21, 0.38);
  --award-text: #fef08a;
  --focus-ring: #93c5fd;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.03125rem; /* 16.5px */
  line-height: 1.68;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Accessible keyboard focus indicator */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 3px;
}

main:focus {
  outline: none;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 1000;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
}

.skip-link:focus {
  left: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Typography & Links */
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

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

h1, h2, h3, h4 {
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin-top: 0;
}

/* ==========================================================================
   TOP NAVIGATION BAR
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  font-size: 1.08rem;
  font-weight: 650;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-brand:hover {
  color: var(--accent);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding: 0.35rem 0.72rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.nav-link[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background-color: var(--surface);
  color: var(--text);
}

.menu-toggle {
  display: none;
}

/* ==========================================================================
   MAIN TWO-COLUMN LAYOUT (Martin Lukk Style)
   ========================================================================== */
.layout-container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2.75rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 3.5rem;
  flex: 1;
  align-items: start;
}

/* ==========================================================================
   PERSISTENT LEFT SIDEBAR
   ========================================================================== */
.profile-sidebar {
  position: sticky;
  top: 5.5rem;
}

.avatar-wrap {
  margin-bottom: 1.15rem;
}

.profile-avatar {
  width: 164px;
  height: 164px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background-color: var(--surface);
  display: block;
}

.profile-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.profile-role {
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 0.2rem;
}

.profile-affiliation {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.profile-affiliation a {
  color: var(--text-muted);
  text-decoration: none;
}

.profile-affiliation a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.profile-links {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.profile-link-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.28rem 0.2rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  text-decoration: none;
  min-height: 2rem;
}

.profile-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.profile-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.profile-link:hover svg {
  color: var(--accent);
}

.copy-email-btn {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}

.copy-email-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.main-content {
  min-width: 0;
  max-width: 72ch;
}

.main-content.wide {
  max-width: none;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.section-heading {
  font-size: 1.25rem;
  font-weight: 650;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.bio-prose p {
  margin: 0 0 1.1rem;
}

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

/* ==========================================================================
   NEWS / HIGHLIGHTS FEED
   ========================================================================== */
.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-item {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1.15rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.news-item:first-child {
  padding-top: 0.35rem;
}

.news-date {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.news-body {
  font-size: 0.97rem;
  line-height: 1.58;
}

.news-more-link {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
}

.see-all-wrap {
  margin-top: 1.15rem;
}

.see-all-link {
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
}

.see-all-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   PUBLICATIONS & MULTI-ROW FACET FILTERS (Alexander Kustov Style)
   ========================================================================== */
.pub-filter-panel {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0 0 1.65rem;
}

.filter-group-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.38rem;
}

.filter-group-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-right: 0.15rem;
}

.filter-chip {
  font-family: inherit;
  font-size: 0.81rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.32rem 0.68rem;
  min-height: 1.88rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-chip:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .filter-chip[aria-pressed="true"] {
  color: #0f172a;
}

.filter-status-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.35rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.filter-status-bar[hidden] {
  display: none;
}

.clear-filters-btn {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 550;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.clear-filters-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.pub-group {
  margin-bottom: 2.25rem;
}

.pub-group-heading {
  font-size: 1.12rem;
  font-weight: 650;
  color: var(--text);
  margin: 0 0 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.pub-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pub-item {
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-title {
  font-size: 1.04rem;
  font-weight: 650;
  line-height: 1.42;
  margin: 0 0 0.3rem;
  color: var(--text);
}

.pub-title a {
  color: inherit;
  text-decoration: none;
}

.pub-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.pub-authors {
  font-size: 0.94rem;
  color: var(--text-muted);
  margin: 0 0 0.22rem;
}

.pub-self {
  color: var(--text);
  font-weight: 600;
}

.pub-venue {
  font-size: 0.93rem;
  color: var(--text-muted);
  margin: 0;
}

.pub-awards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.48rem;
}

.award-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 550;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  background: var(--award-bg);
  border: 1px solid var(--award-border);
  color: var(--award-text);
}

.pub-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.pub-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 550;
  line-height: 1.2;
  padding: 0.3rem 0.65rem;
  min-height: 1.9rem;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pub-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.pub-btn[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.pub-abstract {
  margin-top: 0.75rem;
  padding: 0.9rem 1.05rem;
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
  line-height: 1.62;
  color: var(--text);
}

.pub-abstract p {
  margin: 0 0 0.65rem;
}

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

/* ==========================================================================
   TEACHING & STUDENT EVALUATIONS
   ========================================================================== */
.course-card {
  margin-bottom: 2rem;
}

.course-header {
  margin-bottom: 1.15rem;
}

.course-role {
  font-size: 0.84rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.course-title {
  font-size: 1.18rem;
  font-weight: 650;
  margin: 0 0 0.2rem;
}

.course-meta {
  font-size: 0.93rem;
  color: var(--text-muted);
  margin: 0;
}

.eval-heading {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.35rem 0 0.75rem;
  color: var(--text);
}

.eval-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.eval-quote {
  margin: 0;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border-left: 3px solid var(--border-strong);
  border-radius: 0 6px 6px 0;
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--text);
}

/* ==========================================================================
   PUBLIC SOCIOLOGY & VIDEO EMBED
   ========================================================================== */
.media-card {
  margin-bottom: 2rem;
}

.media-title {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 0 0 0.3rem;
}

.media-desc {
  font-size: 0.96rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.video-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.video-responsive iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ==========================================================================
   CV VIEWER
   ========================================================================== */
.cv-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  min-height: 2.4rem;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
}

.primary-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #ffffff;
}

[data-theme="dark"] .primary-btn {
  color: #0f172a;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  min-height: 2.4rem;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 550;
  text-decoration: none;
  border: 1px solid var(--border-strong);
}

.secondary-btn:hover {
  background: var(--surface-hover);
  color: var(--accent);
}

.cv-frame-wrap {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 78vh;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.cv-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablet & Mobile)
   ========================================================================== */
@media (max-width: 840px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 0.5rem 1.15rem;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    width: 100%;
    order: 3;
    padding: 0.5rem 0 0.75rem;
    border-top: 1px solid var(--border);
  }

  .site-nav.is-open {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }

  .nav-link {
    padding: 0.55rem 0.5rem;
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  .nav-link[aria-current="page"] {
    border-bottom-color: transparent;
    border-left-color: var(--accent);
    background: var(--surface);
  }

  .layout-container {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1.75rem 1.15rem 3rem;
  }

  .profile-sidebar {
    position: static;
  }

  /* On inner pages on mobile, show main content first so visitors immediately
     see Publications/Teaching/CV without scrolling past the full sidebar */
  body:not([data-page="home"]) .profile-sidebar {
    order: 2;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
  }

  .profile-card-inner {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 1.1rem;
    align-items: center;
  }

  .avatar-wrap {
    margin-bottom: 0;
  }

  .profile-avatar {
    width: 96px;
    height: 96px;
  }

  .profile-affiliation {
    margin-bottom: 0;
  }

  .profile-links {
    margin-top: 1rem;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

@media print {
  .site-header,
  .pub-filter-panel,
  .cv-toolbar,
  .copy-email-btn {
    display: none !important;
  }
  .layout-container {
    grid-template-columns: 1fr;
    padding: 0;
  }
  .pub-abstract[hidden] {
    display: block !important;
  }
}
