/* ==========================================================
   OKBA ABDELAOUI
   Academic Research & Publications
   Academic Design System — V1.0
   ========================================================== */

/* 01. DESIGN TOKENS */

:root {
  color-scheme: light;

  --navy: #142d40;
  --navy-deep: #0c2130;
  --teal: #176b6b;
  --teal-dark: #105454;
  --teal-soft: #e8f4f3;
  --gold: #b49a60;

  --background: #f4f7f8;
  --surface: #ffffff;
  --text: #182e40;
  --text-secondary: #475569;
  --border: #dce5e7;

  --positive: #166534;
  --negative: #b91c1c;
  --neutral: #64748b;

  --font-sans: system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --font-serif: Georgia, "Times New Roman", serif;

  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 2px 8px rgba(20, 45, 64, 0.05);
  --shadow-md: 0 8px 28px rgba(20, 45, 64, 0.08);

  --content-width: 1120px;
  --reading-width: 820px;

  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
  --space-7: 4rem;

  --transition: 180ms ease;
}

/* 02. BASE & RESET */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

::selection {
  background: var(--teal-soft);
  color: var(--navy);
}

/* 03. TYPOGRAPHY */

h1,
h2,
h3,
h4 {
  color: var(--navy);
  line-height: 1.3;
  font-weight: 700;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
  letter-spacing: -0.035em;
  margin-block: 0.5rem 1rem;
}

h2 {
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 2rem);
  margin-block: 0 1rem;
}

h3 {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem);
}

p {
  margin-block: 0 1rem;
}

small,
.text-small {
  font-size: var(--text-sm);
}

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

.lead {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 75ch;
}

a {
  color: var(--teal-dark);
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
  transition: color var(--transition);
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 4px;
}

hr {
  border: 0;
  border-block-start: 1px solid var(--border);
  margin-block: var(--space-5);
}

/* 04. LAYOUT */

main,
nav,
footer,
.container {
  width: min(100% - 2rem, var(--content-width));
  margin-inline: auto;
}

main {
  padding-block: var(--space-6);
  min-height: 65vh;
}

.reading-width {
  max-width: var(--reading-width);
  margin-inline: auto;
}

section {
  background: var(--surface);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-block: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.section-heading {
  margin-block-end: var(--space-4);
}

.section-heading p {
  color: var(--text-secondary);
}

/* 05. HEADER & NAVIGATION */

header,
.academic-header {
  background: var(--navy);
  color: #ffffff;
  border-block-end: 3px solid var(--teal);
}

header h1,
header h2,
header h3,
header p {
  color: inherit;
}

nav,
.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding-block: 1.1rem;
}

header nav a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
}

header nav a:hover {
  color: #bce9e6;
}

header a:focus-visible {
  outline-color: #bce9e6;
}

.site-brand {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-inline-start: auto;
}

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* 06. ACADEMIC HERO */

.hero {
  position: relative;
  padding: clamp(2rem, 5vw, 4rem);
  background: linear-gradient(
    135deg,
    var(--surface),
    var(--teal-soft)
  );
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-block-end: var(--space-5);
}

.hero h1 {
  margin-block-start: 0.75rem;
}

.hero-subtitle {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 500;
  color: var(--teal-dark);
}

.hero-affiliation {
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.eyebrow,
.tag {
  color: var(--teal-dark);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.profile-links,
.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-block: var(--space-4);
}

/* 07. BUTTONS */

.button,
.btn,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.65rem 1.15rem;
  background: var(--teal-dark);
  color: #ffffff;
  border: 1px solid var(--teal-dark);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.button:hover,
.btn:hover,
.download-button:hover {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.button-secondary,
.btn-outline {
  background: var(--surface);
  color: var(--teal-dark);
  border-color: var(--border);
}

.button-secondary:hover,
.btn-outline:hover {
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-color: var(--teal);
}

/* 08. RESEARCH GRID & CARDS */

.research-grid,
.publication-grid,
.resource-grid,
.metrics-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-4);
}

.research-card,
.publication-card,
.resource-card,
.metric-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}

.research-card h3,
.publication-card h3,
.resource-card h3 {
  margin-block-start: 0;
}

.publication-card {
  border-inline-start: 4px solid var(--teal);
}

.publication-title {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem);
  font-weight: 700;
  line-height: 1.45;
}

.publication-title a {
  color: var(--navy);
  text-decoration: none;
}

.publication-title a:hover {
  text-decoration: underline;
}

.publication-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.research-tag,
.badge {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* 09. SCIENTIFIC CONTENT */

.research-evidence,
.methodology-box,
.research-limitation,
.citation-box,
.knowledge-qa {
  padding: var(--space-4);
  margin-block: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.methodology-box {
  border-inline-start: 4px solid var(--teal);
}

.research-limitation {
  border-inline-start: 4px solid var(--gold);
}

.citation-box {
  background: var(--background);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

blockquote {
  margin-inline: 0;
  padding: 1rem 1.5rem;
  border-inline-start: 4px solid var(--teal);
  background: var(--teal-soft);
}

figure {
  margin: var(--space-4) 0;
}

figcaption {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-block-start: 0.75rem;
}

.graphical-abstract img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.chart-container {
  min-width: 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* 10. SCIENTIFIC TABLES */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-block: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

caption {
  text-align: start;
  padding: 0.85rem;
  font-weight: 600;
}

th,
td {
  padding: 0.85rem 1rem;
  text-align: start;
  border-block-end: 1px solid var(--border);
}

thead th {
  background: var(--navy);
  color: #ffffff;
  font-weight: 600;
}

tbody tr:nth-child(even) {
  background: var(--background);
}

.numeric {
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--positive);
  font-weight: 700;
}

.negative {
  color: var(--negative);
  font-weight: 700;
}

.not-significant {
  color: var(--neutral);
}

/* 11. METRICS & ANALYTICS COMPONENTS */

.metric-card {
  border-block-start: 3px solid var(--teal);
}

.metric-value {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.metric-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* 12. SEARCH & FILTERS */

.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: end;
  margin-block: var(--space-4);
}

input,
select,
textarea {
  max-width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

label {
  display: block;
  font-weight: 600;
  margin-block-end: 0.35rem;
}

/* 13. CODE & INTERACTIVE LAB */

pre {
  overflow-x: auto;
  padding: var(--space-4);
  background: var(--navy-deep);
  color: #f1f5f9;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

code {
  font-family: ui-monospace, SFMono-Regular,
    Consolas, monospace;
}

.interactive-lab {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--surface);
}

details {
  border-block-end: 1px solid var(--border);
  padding-block: var(--space-3);
}

summary {
  cursor: pointer;
  font-weight: 600;
}

/* 14. FOOTER */

footer,
.site-footer {
  padding-block: var(--space-5);
  margin-block-start: var(--space-5);
  border-block-start: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: var(--space-4);
}

/* 15. ACCESSIBILITY */

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -100px;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--navy);
  color: #ffffff;
  border-radius: var(--radius-sm);
}

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

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

/* 16. ARABIC & RTL */

html[lang="ar"],
html[dir="rtl"] {
  --font-sans: "Noto Sans Arabic", Tahoma,
    Arial, system-ui, sans-serif;
}

html[dir="rtl"] body {
  line-height: 1.9;
}

html[dir="rtl"] h1,
html[dir="rtl"] .tag,
html[dir="rtl"] .eyebrow {
  letter-spacing: normal;
}

/* 17. OPTIONAL DARK THEME */

html[data-theme="dark"] {
  color-scheme: dark;

  --navy: #e2e8f0;
  --navy-deep: #08131d;
  --teal: #62c4bc;
  --teal-dark: #8bd9d2;
  --teal-soft: #173a40;

  --background: #0e1c28;
  --surface: #162836;
  --text: #e2e8f0;
  --text-secondary: #b7c5d3;
  --border: #354b5c;

  --positive: #86efac;
  --negative: #fca5a5;
  --neutral: #cbd5e1;
}

html[data-theme="dark"] header,
html[data-theme="dark"] thead th {
  background: var(--navy-deep);
}

html[data-theme="dark"] .button,
html[data-theme="dark"] .btn,
html[data-theme="dark"] .download-button {
  color: #08131d;
}

html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .btn-outline {
  color: var(--teal-dark);
}

/* 18. RESPONSIVE DESIGN */

@media (max-width: 768px) {
  main {
    padding-block: var(--space-4);
  }

  nav,
  .site-nav {
    gap: 0.65rem 1rem;
  }

  .nav-links {
    margin-inline-start: 0;
  }

  .hero {
    padding: var(--space-4);
  }

  section {
    padding: var(--space-4);
  }

  th,
  td {
    padding: 0.65rem 0.75rem;
  }
}

@media (max-width: 480px) {
  main,
  nav,
  footer,
  .container {
    width: calc(100% - 1.5rem);
  }

  .action-group,
  .profile-links {
    gap: 0.5rem;
  }

  .filter-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

/* 19. REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 20. ACADEMIC PRINT STYLES */

@media print {
  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  main {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  header,
  nav,
  .site-nav,
  .filter-panel,
  .skip-link,
  .no-print,
  button {
    display: none !important;
  }

  section,
  .publication-card,
  .research-card,
  .citation-box {
    box-shadow: none;
    border: 1px solid #cccccc;
    background: #ffffff;
  }

  h1,
  h2,
  h3 {
    color: #000000;
    break-after: avoid;
  }

  figure,
  tr,
  .citation-box {
    break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  thead th {
    background: #eeeeee;
    color: #000000;
  }

  a {
    color: #000000;
  }
}

/* END — ACADEMIC DESIGN SYSTEM V1.0 */
