/* ============================================================
   Memristor Research — Stylesheet
   Modern scientific aesthetic: clean, refined, quietly confident
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;0,8..60,700;1,8..60,300;1,8..60,400&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@300;400;500;600&display=swap');

/* --- Design tokens — AGH University brand --- */
/* Zieleń #00693C · Czerń #1E1E1E · Czerwień #A71930 · Biel #FFFFFF */
:root {
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* AGH core palette */
  --agh-green: #00693C;
  --agh-green-dark: #004d2b;
  --agh-green-light: #e0f2ea;
  --agh-green-subtle: #f0f8f4;
  --agh-black: #1E1E1E;
  --agh-red: #A71930;
  --agh-red-light: #fcedef;
  --agh-white: #FFFFFF;
  --agh-red-dark: #7a1525;

  /* Semantic mapping */
  --clr-bg: #f7f9f8;
  --clr-surface: var(--agh-white);
  --clr-surface-alt: var(--agh-green-subtle);
  --clr-border: #d6ddd9;
  --clr-border-accent: rgba(0, 105, 60, 0.25);

  --clr-text: var(--agh-black);
  --clr-text-secondary: #3a3a3a;
  --clr-text-muted: #6b6b6b;

  --clr-accent: var(--agh-green);
  --clr-accent-light: var(--agh-green-light);
  --clr-accent-hover: var(--agh-green-dark);
  --clr-highlight: var(--agh-red);
  --clr-highlight-light: var(--agh-red-light);
  --clr-link: var(--agh-red);
  --clr-link-visited: var(--agh-red-dark);

  --max-width: 60rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 6px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .06);
}


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

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--clr-text);
  background: var(--clr-bg);
  line-height: 1.72;
  padding: 0;
  margin: 0;
}


/* --- Site header --- */
.site-header {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 0;
  position: sticky;
  top: 0;
  background: var(--clr-bg);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-logo {
  flex-shrink: 0;
  text-decoration: none;
  border: none;
}

.header-logo img {
  height: 100px;
  width: auto;
  display: block;
  border-radius: 0;
  box-shadow: none;
}

.header-text {
  min-width: 0;
}

.header-dept {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--clr-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
  display: block;
}

.header-project {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  letter-spacing: -0.01em;
  color: var(--clr-text);
  margin: 0.2em 0 0;
  line-height: 1.35;
}

.header-rule {
  border: none;
  height: 2px;
  background: var(--agh-green);
  margin: 1.25rem 0 0;
}

.header-nav {
  margin-top: 1rem;
  margin-bottom: 2rem;
}

.header-nav a {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--clr-accent);
  padding: 0.3em 0.7em;
  border: 1px solid var(--clr-border-accent);
  border-radius: 100px;
  transition: all 0.2s ease;
  display: inline-block;
}

.header-nav a:hover {
  background: var(--clr-accent);
  color: #fff;
  border-color: var(--clr-accent);
}

/* --- Page content wrapper --- */
.page-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.page-content>h1:first-child,
.page-content>h2:first-child {
  margin-top: 1em;
}


/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  color: var(--clr-text);
  line-height: 1.3;
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}

h1 {
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--agh-red);
}

h2 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1.15rem;
  font-weight: 500;
}

h4 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--clr-text-secondary);
}

h2 {
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--clr-border);
}

p {
  margin-bottom: 1.15em;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}


/* --- Links --- */
a {
  color: var(--clr-link);
  text-decoration-color: rgba(167, 25, 48, 0.3);
  text-underline-offset: 2px;
  transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
  color: var(--agh-green);
  text-decoration-color: currentColor;
}

a:visited {
  color: var(--clr-link-visited);
}

a:visited:hover {
  color: var(--agh-green-dark);
}

/* --- Lists --- */
ul,
ol {
  padding-left: 1.5em;
  margin-bottom: 1.15em;
}

li {
  margin-bottom: 0.35em;
}

li::marker {
  color: var(--clr-accent);
}


/* --- Code blocks (highlight.js) --- */
pre {
  background: var(--clr-surface) !important;
  border-radius: var(--radius);
  padding: 1.25em 1.5em;
  margin-bottom: 1.5em;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
  border-left: 3px solid var(--agh-green);
}

pre code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.65;
  background: transparent !important;
  padding: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--clr-surface-alt);
  color: var(--clr-accent-hover);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--clr-border);
}

pre code {
  border: none;
  color: inherit;
}


/* --- Blockquotes --- */
blockquote {
  border-left: 3px solid var(--clr-highlight);
  background: var(--clr-highlight-light);
  padding: 1em 1.25em;
  margin: 1.5em 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--clr-text-secondary);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}


/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75em 0;
  font-size: 0.92rem;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius);
  overflow: hidden;
}

thead {
  background: var(--clr-accent);
  color: #fff;
}

th {
  font-family: var(--font-heading);
  font-weight: 500;
  text-align: left;
  padding: 0.75em 1em;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

td {
  padding: 0.7em 1em;
  border-bottom: 1px solid var(--clr-border);
}

tbody tr:last-child td {
  border-bottom: none;
}

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

tbody tr:hover {
  background: var(--clr-accent-light);
  transition: background 0.15s ease;
}


/* --- Images --- */
.page-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 1em 0;
  display: block;
  margin-left: auto;
  margin-right: auto;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.page-content img.lightbox-open {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw !important;
  height: 90vh !important;
  max-width: 90vw !important;
  max-height: 90vh !important;
  object-fit: contain;
  z-index: 1001;
  cursor: zoom-out;
  border-radius: 0;
  box-shadow: none;
}


.page-content img.lightbox-open::before {
  content: '';
}

/* Gradient overlay behind image */
body::after {
  content: '';
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: linear-gradient(to right,
      rgba(0, 105, 60, 0.85) 0%,
      rgba(30, 30, 30, 0.92) 50%,
      rgba(167, 25, 48, 0.85) 100%);
  pointer-events: none;
}



body.lightbox-active {
  overflow: hidden;
}


body.lightbox-active::after {
  display: block;
}


figure {
  margin: 2em 0;
  text-align: center;

}

figcaption {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  margin-top: 0.5em;
  font-style: italic;
}


/* --- KaTeX math --- */
.katex-display {
  margin: 1.5em 0;
  padding: 1em;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow-x: auto;
  position: relative;
  padding-right: 1em;
  /* make room for tag */
}

.katex-display>.katex>.katex-html>.tag {
  position: sticky;
  right: 0;
  background: var(--clr-surface);
  padding-left: 0em;
}

.katex-display>.katex>.katex-html {
  width: 100%;
}



.katex {
  font-size: 1.05em;
}


/* --- Horizontal rules --- */
hr {
  border: none;
  height: 1px;
  background: var(--clr-border);
  margin: 2.5em 0;
}


/* --- Details/summary --- */
details {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 0.75em 1em;
  margin-bottom: 1em;
  background: var(--clr-surface);
}

summary {
  font-family: var(--font-heading);
  font-weight: 500;
  cursor: pointer;
  color: var(--clr-accent);
}

summary:hover {
  color: var(--clr-accent-hover);
}


/* --- Error/info messages (from PHP) --- */
div[style*="border: 1px solid red"],
p[style*="color:red"] {
  font-family: var(--font-mono) !important;
  font-size: 0.85rem !important;
  border-radius: var(--radius) !important;
}


/* --- Footer spacing --- */
body {
  padding-bottom: 4rem;
}


/* --- Print styles --- */
@media print {
  body {
    background: #fff;
    font-size: 11pt;
  }

  pre {
    box-shadow: none;
    border: 1px solid #ccc;
    padding: 0.6em 0.9em;
    /* top/bottom  left/right */
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}


/* --- Responsive --- */
@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  .site-header {
    padding-top: 1.5rem;
  }

  .header-inner {
    gap: 1rem;
  }

  .header-logo img {
    height: 44px;
  }

  .header-dept {
    font-size: 0.7rem;
  }

  table {
    font-size: 0.82rem;
  }

  th,
  td {
    padding: 0.5em 0.6em;
  }

  .katex-display {
    position: relative;
    overflow-x: auto;
  }

  .katex-display>.katex>.katex-html>.tag {
    display: none;
  }

}


.page-content iframe,
.page-content object {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  margin: 1.5em 0;
}

.page-content img+em,
.page-content p:has(img)+p em {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  margin-top: -0.5em;
  margin-bottom: 1.5em;
}

.page-content img+p {
  text-align: center;
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  margin-top: -0.5em;
  margin-bottom: 1.5em;
  font-style: italic;
}


blockquote strong:first-child {
  color: var(--agh-red);
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.04em;
}

.flex-center-wrapper {
  display: flex;
  justify-content: center;
}


/* --- Project cards --- */
.project-card {
  display: inline-block;
  text-decoration: none;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  border-color: var(--clr-border-accent);
  box-shadow: var(--shadow-md);
}

.project-card img {
  width: 500px;
  max-width: 100%;
  display: block;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.project-card-label {
  display: block;
  padding: 0.6rem 1rem;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--clr-accent);
  border-top: 1px solid var(--clr-border);
}

.project-card:hover .project-card-label {
  color: var(--clr-accent-hover);
}


/* --- Project tiles --- */
.project-tile {
  display: inline-block;
  position: relative;
  width: 500px;
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: box-shadow 0.2s, transform 0.2s;
  background-color: var(--agh-green);
}

.project-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-tile img {
  width: 80%;
  display: block;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  transition: filter 0.3s;
}

.project-tile:hover img {
  filter: brightness(0.7);
}

.project-tile-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1rem 0.8rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -0.01em;
}

/* --- Beamer-style blocks --- */
.beamer-block {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 80%;
  max-width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
  text-decoration: none;
  background: var(--clr-surface);
  transition: box-shadow 0.3s, transform 0.3s;
}

.beamer-block:hover {
  box-shadow: var(--shadow-md);
  transform: scale(1.2);
}

.beamer-block-title {
  background: var(--agh-green);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.2rem;
  padding: 0.35rem 0.75rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.beamer-block img {
  width: 100%;
  display: block;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem;
  border-radius: 0;
  box-shadow: none;
  background: var(--clr-surface);
  transition: transform 0.3s ease;
}


.beamer-block:hover img {
  transform: scale(1.1);
}



/* --- Block grid --- */
.block-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 1.5em 0;
}

.block-grid .beamer-block {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.block-grid .beamer-block img {
  width: 100%;
  height: 250px;
  object-fit: contain;
  padding: 0.75rem;
  flex: 1;
}

@media (max-width: 900px) {
  .block-grid {
    grid-template-columns: 1fr;
  }
}



footer {
  /* Very light gray background */
  background: var(--clr-bg);
  padding: 20px 10px;
  text-align: center;
  border-top: 1px solid var(--clr-border);

  /* Optional line to separate from content */
}

.footer-content p {
  color: var(--clr-text-muted);
  /* Muted gray text */
  font-family: var(--font-body);
  font-size: 0.65rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
  /* Makes the text slightly smaller */
}

/* Styles the links so they blend in nicely */
.attribution a {
  color: var(--agh-green);
  text-decoration: underline;
}

.attribution a:hover {
  color: var(--agh-red);
  /* Turns black when hovered */
}


.project-hero {
  border-bottom: none;
  padding-bottom: 0;
}

.project-hero-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--clr-text-muted);
  margin-bottom: 0.3em;
}






/* --- Footnotes (Parsedown Extra) --- */
sup .footnote-ref {
  font-family: var(--font-heading);
  font-size: 0.75em;
  font-weight: 600;
  text-decoration: none;
  color: var(--clr-link);
  padding: 0 0.1em;
  border-bottom: none;
}

sup .footnote-ref:hover {
  color: var(--clr-accent);
  text-decoration: underline;
}

.footnotes {
  margin-top: 3rem;
  padding-top: 1.25rem;
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  line-height: 1.65;
}

.footnotes hr {
  border: none;
  height: 1px;
  background: var(--clr-border);
  margin-bottom: 1rem;
}

.footnotes ol {
  padding-left: 1.5em;
  margin: 0;
}

.footnotes ol li {
  margin-bottom: 0.6em;
}

.footnotes ol li::marker {
  color: var(--clr-accent);
  font-family: var(--font-heading);
  font-weight: 500;
}

.footnotes ol li p {
  margin: 0;
  display: inline;
}

.footnotes ol li a {
  color: var(--clr-link);
}

.footnotes ol li a:hover {
  color: var(--clr-accent);
}

.footnote-backref {
  text-decoration: none;
  font-size: 0.85em;
  margin-left: 0.3em;
  color: var(--clr-text-muted);
}

.footnote-backref:hover {
  color: var(--clr-accent);
}

.footnotes ol li:target {
  background: var(--clr-accent-light);
  border-radius: var(--radius);
  padding: 0.25em 0.5em;
  margin-left: -0.5em;
}