:root {
  --bg: #fafaf9;
  --bg-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --accent: #ea580c;
  --accent-2: #0284c7;
  --status-bg: rgba(16, 185, 129, 0.12);
  --status-text: #047857;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px rgba(15, 23, 42, 0.04);
  --radius: 18px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #090d16;
  --bg-elevated: rgba(17, 24, 39, 0.78);
  --bg-subtle: rgba(30, 41, 59, 0.7);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --accent: #fb923c;
  --accent-2: #38bdf8;
  --status-bg: rgba(16, 185, 129, 0.14);
  --status-text: #34d399;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.28);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

.ambient-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(620px 460px at 18% 12%, rgba(249, 115, 22, 0.13), transparent 72%),
    radial-gradient(580px 440px at 82% 8%, rgba(56, 189, 248, 0.14), transparent 72%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 88%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 88%);
  pointer-events: none;
  z-index: -1;
}

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background-color: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
  flex-shrink: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.brand:hover .brand-badge {
  transform: translateY(-1px);
  border-color: var(--accent-2);
}

.brand-logo {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.brand-badge-lg {
  width: 48px;
  height: 48px;
  border-radius: 13px;
}

.brand-badge-lg .brand-logo {
  width: 34px;
  height: 34px;
}

.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.card-head-row h3 {
  margin: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.nav a.nav-pill {
  padding: 0.36rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.nav a.nav-pill:hover,
.nav a.nav-pill.active {
  border-color: var(--accent-2);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

/* Hero */
.hero {
  padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2.5rem, 5vw, 3.75rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.78fr);
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: center;
}

.hero-media {
  margin: 0;
  position: relative;
  border-radius: 22px;
  padding: 5px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent-2) 45%, transparent));
  box-shadow: var(--shadow);
  justify-self: end;
  width: min(100%, 270px);
}

.hero-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 350px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 17px;
  background: var(--bg-subtle);
}

.mountains-hero {
  padding: clamp(3rem, 6vw, 4.75rem) 0 clamp(1.5rem, 3vw, 2.5rem);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  background: var(--status-bg);
  color: var(--status-text);
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent);
}

.hero-title {
  margin: 0 0 1rem;
  font-size: clamp(2.25rem, 5.4vw, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 800;
}

.gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  margin: 0 0 1rem;
  font-size: clamp(1.1rem, 2.2vw, 1.38rem);
  font-weight: 600;
  color: var(--text);
  max-width: 680px;
}

.hero-bio {
  margin: 0 0 2rem;
  font-size: 1.02rem;
  color: var(--text-muted);
  max-width: 620px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.78rem 1.25rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding-inline: 0.75rem;
}

.btn-ghost:hover {
  color: var(--text);
}

/* Sections */
.section {
  padding: 2.75rem 0;
}

.section-header {
  margin-bottom: 1.4rem;
}

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

.section-title {
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 1.9rem);
  letter-spacing: -0.025em;
  font-weight: 700;
}

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  letter-spacing: -0.015em;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.card p + p {
  margin-top: 0.75rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.card-wide {
  grid-column: span 2;
}

.card-full {
  grid-column: 1 / -1;
}

.facts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.facts-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.facts-list li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.fact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fact-value {
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline-list,
.course-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.timeline-list li,
.course-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.timeline-list li:last-child,
.course-list li:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.timeline-sub,
.course-list li span {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.course-list li a {
  font-weight: 600;
  font-size: 0.94rem;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.course-list li a:hover {
  color: var(--accent-2);
}

.publication-card h3 {
  font-size: 1.15rem;
  line-height: 1.35;
}

.publication-actions {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tag {
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  font-weight: 500;
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.project-card,
.interest-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.project-card:hover,
.interest-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.project-year {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.project-arrow {
  color: var(--text-muted);
  transition: transform 0.18s ease, color 0.18s ease;
}

.project-card:hover .project-arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 1.1rem;
}

.project-meta span {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.24rem 0.55rem;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

/* Contact */
.contact-card {
  display: grid;
  gap: 1.5rem;
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1.05rem;
  border-radius: 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.social-link:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.social-link svg {
  width: 20px;
  height: 20px;
  color: var(--accent-2);
  flex-shrink: 0;
}

.social-link div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.social-name {
  font-weight: 600;
  font-size: 0.94rem;
}

.social-handle {
  font-size: 0.84rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Footer */
.site-footer {
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.5rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-inner p {
  margin: 0;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.footer-link:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Berge / Góry Subpage */
.region-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.region-bar .status-pill {
  margin-bottom: 0;
}

.region-switcher {
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  gap: 4px;
}

.region-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.95rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.region-btn:hover {
  color: var(--text);
}

.region-btn.is-active {
  background: var(--text);
  color: var(--bg);
}

.region-panel[hidden] {
  display: none;
}

.peaks-grid-single {
  grid-template-columns: minmax(0, 440px);
}

.btn-sm {
  padding: 0.48rem 0.85rem;
  font-size: 0.84rem;
  border-radius: 10px;
}

.map-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.peaks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.peak-card {
  display: flex;
  flex-direction: column;
  padding: 1.15rem 1.25rem;
}

.peak-card h3 {
  margin-bottom: 0.45rem;
  font-size: 1.02rem;
}

.peak-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--accent-2);
}

.peak-coords {
  margin-top: auto !important;
  padding-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8rem !important;
  color: var(--text) !important;
}

.peak-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.map-footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.map-footer-bar .map-caption {
  margin: 0 !important;
}

.map-card {
  display: flex;
  flex-direction: column;
  padding: 0.85rem;
}

.peaks-map {
  width: 100%;
  min-height: 410px;
  flex: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  z-index: 1;
}

.map-caption {
  margin-top: 0.65rem !important;
  font-size: 0.82rem !important;
}

.map-fallback {
  padding: 1.5rem;
  margin: 0;
  color: var(--text-muted);
}

.peak-marker-wrap {
  background: transparent;
  border: none;
}

.peak-marker-pin {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: #0f172a;
  color: #f8fafc;
  border: 2px solid #fb923c;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
}

.peak-marker-pin::before {
  content: "▲";
  color: #fb923c;
  font-size: 0.7rem;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  font-family: var(--font-sans);
}

.peak-popup h4 {
  margin: 0 0 0.25rem;
  font-size: 0.96rem;
}

.peak-popup p {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: #475569;
}

.peak-popup a {
  font-size: 0.8rem;
  font-weight: 600;
  color: #0284c7;
  text-decoration: none;
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.gallery-item {
  margin: 0;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.gallery-wide {
  grid-column: 1 / -1;
}

.gallery-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-subtle);
  cursor: zoom-in;
}

.gallery-trigger img {
  display: block;
  width: 100%;
  height: 310px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-wide .gallery-trigger img {
  height: clamp(240px, 34vw, 390px);
}

.gallery-trigger:hover img {
  transform: scale(1.03);
}

.gallery-item figcaption {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding-inline: 0.2rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(9, 13, 22, 0.9);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-content {
  margin: 0;
  max-width: min(1040px, 90vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 76vh;
  border-radius: 14px;
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.lightbox-content figcaption {
  color: #e2e8f0;
  font-size: 0.94rem;
  text-align: center;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.75);
  color: #f8fafc;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close {
  top: 1.2rem;
  right: 1.2rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev {
  left: 1.2rem;
}

.lightbox-next {
  right: 1.2rem;
}

@media (max-width: 820px) {
  .hero-grid,
  .bento-grid,
  .projects-grid,
  .peaks-grid,
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .hero-media {
    justify-self: start;
    width: min(100%, 230px);
  }

  .card-wide {
    grid-column: span 1;
  }

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

  .peaks-map {
    min-height: 330px;
  }
}

@media (max-width: 580px) {
  .nav a:not(.nav-pill) {
    display: none;
  }
}
