/* ==========================================================================
   Amadej Krepek Portfolio — Storm & Lightning Theme
   ========================================================================== */

:root {
  --bg-deep: #060a14;
  --bg-surface: #0b1120;
  --bg-card: rgba(15, 23, 42, 0.72);
  --bg-card-hover: rgba(20, 32, 58, 0.85);
  --border: rgba(96, 165, 250, 0.12);
  --border-bright: rgba(147, 197, 253, 0.28);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #60a5fa;
  --accent-bright: #93c5fd;
  --lightning: #f0f9ff;
  --lightning-glow: rgba(147, 197, 253, 0.6);
  --electric: #818cf8;
  --storm-purple: #312e81;
  --success: #34d399;
  --font-sans: "Outfit", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --header-h: 72px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color var(--transition);
}

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

ul { list-style: none; }

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--bg-deep);
  border-radius: var(--radius);
  font-weight: 600;
}

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

/* ---- Atmospheric effects ---- */

#rain-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

.lightning-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(147, 197, 253, 0.15), transparent 70%);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.05s ease-out;
}

.lightning-flash.active {
  opacity: 1;
  animation: flash 0.15s ease-out;
}

@keyframes flash {
  0% { opacity: 0; }
  20% { opacity: 0.9; background: radial-gradient(ellipse at var(--flash-x, 50%) var(--flash-y, 20%), rgba(224, 242, 254, 0.35), transparent 60%); }
  100% { opacity: 0; }
}

/* ---- Layout ---- */

.container {
  width: min(1140px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.section {
  position: relative;
  z-index: 2;
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.section-header {
  margin-bottom: clamp(2rem, 4vw, 3rem);
  max-width: 640px;
}

.section-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-header h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-desc {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* ---- Header ---- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(6, 10, 20, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), box-shadow var(--transition);
}

.site-header.scrolled {
  background: rgba(6, 10, 20, 0.92);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  width: min(1140px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.logo-bolt {
  font-size: 1.25rem;
  filter: drop-shadow(0 0 8px var(--lightning-glow));
  animation: bolt-pulse 4s ease-in-out infinite;
}

@keyframes bolt-pulse {
  0%, 90%, 100% { opacity: 1; transform: scale(1); }
  93% { opacity: 0.4; transform: scale(0.95); }
  95% { opacity: 1; transform: scale(1.1); filter: drop-shadow(0 0 16px var(--lightning)); }
}

.nav-menu {
  display: flex;
  gap: 0.25rem;
}

.nav-menu a {
  display: block;
  padding: 0.5rem 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}

.nav-menu a:hover {
  color: var(--text);
  background: rgba(96, 165, 250, 0.08);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* ---- Hero ---- */

.hero {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(6, 10, 20, 0.55) 0%, rgba(6, 10, 20, 0.75) 50%, var(--bg-deep) 100%),
    radial-gradient(ellipse at 50% 20%, rgba(49, 46, 129, 0.25), transparent 60%);
}

.hero-content {
  position: relative;
  text-align: center;
  padding: calc(var(--header-h) + 2rem) 1.5rem 4rem;
  max-width: 780px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 2vw, 0.8rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 1.25rem;
  text-shadow: 0 0 20px var(--lightning-glow);
}

.hero h1 {
  font-size: clamp(2.75rem, 8vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1.25rem;
  text-shadow: 0 2px 40px rgba(0, 0, 0, 0.6);
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  max-width: 580px;
  margin-inline: auto;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--electric));
  color: var(--bg-deep);
  box-shadow: 0 4px 20px rgba(96, 165, 250, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(96, 165, 250, 0.5);
  color: var(--bg-deep);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--border-bright);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent);
  color: var(--text);
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: bounce 2.5s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(6px); }
}

/* ---- About ---- */

.about {
  background: linear-gradient(180deg, var(--bg-deep), var(--bg-surface));
}

.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

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

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.about-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  color: var(--accent-bright);
}

.about-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.about-card dt {
  color: var(--text-dim);
  font-weight: 500;
}

.about-card dd {
  text-align: right;
  color: var(--text);
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.skill-tags span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.35rem 0.65rem;
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent-bright);
}

/* ---- Timeline ---- */

.experience {
  background: var(--bg-surface);
}

.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--storm-purple), transparent);
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
  padding-left: 1.5rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -2rem;
  top: 0.45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--lightning-glow);
  transform: translateX(-4px);
}

.timeline-item time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.timeline-item h3 {
  font-size: 1.15rem;
  margin: 0.35rem 0 0.5rem;
  font-weight: 600;
}

.timeline-item p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 640px;
}

.timeline-item a {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* ---- Projects ---- */

.projects {
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-deep));
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.project-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  backdrop-filter: blur(10px);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-bright);
  box-shadow: var(--shadow), 0 0 30px rgba(96, 165, 250, 0.08);
}

.project-card.featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(49, 46, 129, 0.3), var(--bg-card));
  border-color: rgba(129, 140, 248, 0.25);
}

.project-badge {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  background: rgba(129, 140, 248, 0.2);
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 6px;
  color: var(--accent-bright);
}

.project-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  padding-right: 4rem;
}

.project-card.featured h3 { padding-right: 5rem; }

.project-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.project-tech li {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  color: var(--text-dim);
}

.project-links,
.project-links-inline {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-card > a,
.project-links a {
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-mono);
}

/* ---- Gallery ---- */

.gallery {
  background: var(--bg-deep);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-item:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(96, 165, 250, 0.1);
  z-index: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.gallery-item::after {
  content: attr(data-caption);
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 1rem 1rem;
  background: linear-gradient(transparent, rgba(6, 10, 20, 0.9));
  font-size: 0.8rem;
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition);
}

.gallery-item:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Media ---- */

.media {
  background: var(--bg-surface);
}

.media-list {
  display: grid;
  gap: 0.75rem;
}

.media-list a {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: all var(--transition);
}

.media-list a:hover {
  border-color: var(--border-bright);
  color: var(--text);
  padding-left: 1.5rem;
}

.media-list a::before {
  content: "→ ";
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ---- Contact ---- */

.contact {
  background: linear-gradient(180deg, var(--bg-surface), var(--bg-deep));
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  color: var(--text);
}

.contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(96, 165, 250, 0.15);
  color: var(--text);
}

.contact-icon {
  font-size: 1.25rem;
  font-family: var(--font-mono);
  color: var(--accent);
}

.contact-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.contact-value {
  font-weight: 500;
  font-size: 0.95rem;
}

/* ---- Footer ---- */

.site-footer {
  position: relative;
  z-index: 2;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

.footer-domain {
  font-family: var(--font-mono);
  color: var(--accent);
}

/* ---- Lightbox ---- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 10, 20, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.lightbox[hidden] { display: none; }

.lightbox figure {
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
}

.lightbox img {
  max-height: 80vh;
  max-width: 90vw;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 0 60px rgba(96, 165, 250, 0.15);
}

.lightbox figcaption {
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  line-height: 1;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(96, 165, 250, 0.2);
  border-color: var(--accent);
}

.lightbox-close { top: 1.5rem; right: 1.5rem; }
.lightbox-prev { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.5rem; top: 50%; transform: translateY(-50%); }

/* ---- Responsive ---- */

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(6, 10, 20, 0.97);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--transition), opacity var(--transition);
  }

  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-menu a {
    padding: 0.85rem 1rem;
    font-size: 1rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .project-card.featured {
    grid-column: auto;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}

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

  html { scroll-behavior: auto; }

  #rain-canvas { display: none; }
}
