/*
  Global Styles for the Portfolio
  - Dark theme with blue accents
  - Responsive layout, accessible focus states
  - Sticky navigation with backdrop blur

  TODOs:
  - Replace placeholder images in /assets/ with your own
  - Adjust spacing and sizes to taste
*/

:root {
  --bg: #0b0c10;
  --panel: #111317;
  --text: #f2f5f9;
  --muted: #b7c0cc;
  --blue: #2f81f7;
  --blue-600: #2168cf;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --ring: 0 0 0 3px rgba(47, 129, 247, 0.45);
  --nav-h: 88px;
}

/* Box sizing and base resets */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: var(--blue);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 1000;
  transition: top .2s ease;
}
.skip-link:focus { top: 12px; outline: none; box-shadow: var(--ring); }

/* Containers */
.container {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding: 0 20px;
}

/* Sticky Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-row {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  padding: 6px;
  border-radius: 10px;
  background: transparent;
}
.brand:focus { outline: none; box-shadow: var(--ring); }

.brand-logo {
  width: 80px;
  height: 80px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 2px rgba(47, 129, 247, 0.18);
}

.site-nav { display: flex; gap: 8px; align-items: center; }
.nav-link {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: 9999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background .2s ease, color .2s ease, transform .2s ease, border-color .2s ease;
}
.nav-link:hover { background: rgba(47, 129, 247, 0.15); border-color: rgba(47, 129, 247, 0.35); }
.nav-link:focus { outline: none; box-shadow: var(--ring); }
.nav-link.active { background: var(--blue); color: #fff; border-color: transparent; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
}
.nav-toggle:focus { outline: none; box-shadow: var(--ring); }
.nav-toggle-bar { width: 20px; height: 2px; background: var(--text); margin: 4px auto; border-radius: 2px; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .site-nav { position: absolute; right: 20px; top: calc(var(--nav-h) + 8px); background: rgba(10,10,12,0.98); padding: 8px; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.06); display: none; flex-direction: column; min-width: 180px; }
  .site-nav.open { display: flex; }
  .nav-link { width: 100%; justify-content: flex-start; }
}

/* Sections offset for sticky header */
section { scroll-margin-top: calc(var(--nav-h) + 16px); }

/* Hero */
.hero { padding: 48px 0 20px; }
.hero-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.hero-text h1 { font-size: clamp(2rem, 1.4rem + 2.2vw, 3rem); margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0; }

.hero-avatar { width: 200px; height: 200px; margin-left: auto; margin-right: 0; border-radius: 9999px; background: linear-gradient(180deg, #15171d, #0d0f14); border: 2px solid rgba(255,255,255,0.08); outline: 4px solid rgba(47,129,247,0.25); box-shadow: var(--shadow); overflow: hidden; }
@media (max-width: 900px) { .hero-avatar { margin: 0; } }
.avatar-img { width: 100%; height: 100%; object-fit: cover; }

/* Work */
.work { padding: 28px 0 60px; }
.work h2 { font-size: 1.6rem; margin: 0 0 16px; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 980px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .card-grid { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid rgba(255,255,255,0.06); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: grid; grid-template-rows: auto 1fr; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,0.42); border-color: rgba(47,129,247,0.35); }
.card:focus-within { box-shadow: 0 0 0 0 rgba(0,0,0,0), var(--ring); }

.thumb {
  aspect-ratio: 16 / 9;
  background: #1b1d23;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.thumb-button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  position: relative;
}

.thumb-button:focus-visible {
  border-radius: 0;
}

.thumb-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.45) 100%);
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}

.thumb-button:hover::after,
.thumb-button:focus-visible::after {
  opacity: 1;
}

.thumb-media {
  width: 100%;
  height: 100%;
  display: block;
}

img.thumb-media,
video.thumb-media {
  object-fit: cover;
}

.thumb-embed {
  position: relative;
}

.thumb-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 24px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(4, 6, 10, 0.88);
  backdrop-filter: blur(8px);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 1200px);
  max-height: 90vh;
  margin: 0;
  padding: 18px;
  display: grid;
  gap: 12px;
  border-radius: calc(var(--radius) + 6px);
  background: rgba(17, 19, 23, 0.96);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(90vh - 110px);
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.lightbox-video {
  width: 100%;
  max-height: calc(90vh - 110px);
  background: #000;
  border-radius: 10px;
}

.lightbox-caption {
  margin: 0;
  text-align: center;
  color: var(--muted);
}

.lightbox-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 640px) {
  .lightbox {
    padding: 12px;
  }

  .lightbox-dialog {
    width: 100%;
    padding: 14px;
  }

  .lightbox-image {
    max-height: calc(90vh - 96px);
  }
}

.card-body { padding: 14px; display: grid; gap: 10px; }
.card-body h3 { margin: 2px 0 0; font-size: 1.1rem; }
.card-body p { margin: 0; color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border-radius: 12px; background: var(--blue); color: #fff; border: 1px solid rgba(255,255,255,0.06); font-weight: 600; letter-spacing: 0.2px; transition: background .2s ease, transform .2s ease; }
.btn:hover { background: var(--blue-600); }
.btn:focus { outline: none; box-shadow: var(--ring); }

/* Footer */
.site-footer { border-top: 1px solid rgba(255,255,255,0.06); background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.35) 100%); padding: 28px 0 40px; }
.contact-list { display: grid; gap: 10px; margin: 0; padding: 0; }
.contact-item { list-style: none; display: flex; align-items: center; gap: 10px; }
.contact-link { color: var(--text); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(255,255,255,0.35); }
.contact-link:hover { text-decoration-color: var(--blue); }
.icon { width: 28px; height: 28px; display: inline-grid; place-items: center; color: var(--muted); }
.footnote { margin-top: 12px; color: var(--muted); font-size: 0.95rem; }

/* Footer title */
.footer-title { font-size: 1.25rem; margin: 0 0 12px; color: var(--text); }

/* Focus styles */
:focus-visible { outline: 2px solid transparent; box-shadow: var(--ring); border-radius: 10px; }

/* Makrofoto Carousel */
.macro {
  padding: 40px 0 60px;
  display: grid;
  gap: 20px;
}
.macro h2 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}
.macro-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.1), rgba(0,0,0,0.6));
  box-shadow: 0 35px 60px rgba(0, 0, 0, 0.45);
}
.macro-carousel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.12) 100%);
  mix-blend-mode: screen;
  pointer-events: none;
}
.macro-track {
  position: relative;
  width: 100%;
  height: 100%;
}
.macro-track img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.05) translateX(40px);
  transition: opacity 1.2s ease-in-out, transform 1.2s ease-in-out;
  will-change: opacity, transform;
}
.macro-track img:first-child,
.macro-track img.is-active {
  opacity: 1;
  transform: scale(1) translateX(0);
  z-index: 1;
}

@media (max-width: 720px) {
  .macro {
    padding: 32px 0 48px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
