/* ===========================================================
   Marek Kuligowski - personal site
   Design read: executive personal portfolio for banking /
   recruiter audience. Editorial-tech language. Paper-and-ink
   palette, single cobalt accent, restrained motion.
   Dials: VARIANCE 6 · MOTION 5 · DENSITY 3
   =========================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #F6F7F9;
  --bg-raised: #FFFFFF;
  --ink: #12151C;
  --ink-soft: #4A5160;
  --ink-faint: #7A8190;
  --line: #E2E5EA;
  --accent: #2F5BFF;
  --accent-ink: #15245C;
  --accent-contrast: #F6F7F9;

  --font-display: 'Space Grotesk', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;

  --radius-card: 16px;
  --radius-pill: 999px;

  --nav-h: 72px;
  --max-w: 1180px;
  --gutter: 24px;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-2xl: 7rem;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
  --bg: #0B0D12;
  --bg-raised: #141821;
  --ink: #E8EAEF;
  --ink-soft: #AEB4C2;
  --ink-faint: #767D8C;
  --line: #262B36;
  --accent: #6287FF;
  --accent-ink: #DCE4FF;
  --accent-contrast: #0B0D12;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0D12;
    --bg-raised: #141821;
    --ink: #E8EAEF;
    --ink-soft: #AEB4C2;
    --ink-faint: #767D8C;
    --line: #262B36;
    --accent: #6287FF;
    --accent-ink: #DCE4FF;
    --accent-contrast: #0B0D12;
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; } /* Lenis handles smooth scroll */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; color: var(--ink); }
p { margin: 0; color: var(--ink-soft); }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }

.icon { flex-shrink: 0; fill: currentColor; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: -48px;
  left: 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  z-index: 200;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 16px; }

/* ---------- Layout helpers ---------- */
.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 var(--line);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}
.brand-name { color: var(--ink); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--ink-soft);
  position: relative;
  padding: 0.3rem 0;
  transition: color 0.2s var(--ease);
}
.nav-links a:hover,
.nav-links a:focus-visible { color: var(--ink); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  transition: right 0.25s var(--ease);
}
.nav-links a:hover::after,
.nav-links a:focus-visible::after { right: 0; }

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

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-pill);
  color: var(--ink-soft);
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover,
.icon-btn:focus-visible { background: var(--line); color: var(--ink); }

.nav-toggle { display: none; }
.icon-close-glyph { display: none; }
.site-header.menu-open .icon-open-glyph { display: none; }
.site-header.menu-open .icon-close-glyph { display: block; }

.btn-text { display: inline; }

.mobile-menu {
  display: none;
  flex-direction: column;
  padding: var(--space-sm) var(--gutter) var(--space-md);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.mobile-menu a {
  padding: 0.85rem 0;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.mobile-menu a:last-child { border-bottom: none; }
.site-header.menu-open .mobile-menu { display: flex; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-large { padding: 0.9rem 1.6rem; font-size: 1rem; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease);
}
.text-link:hover,
.text-link:focus-visible { border-color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  padding-top: calc(var(--nav-h) + var(--space-lg));
  padding-bottom: var(--space-2xl);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}
.hero-title {
  font-size: clamp(2.25rem, 4.2vw, 3.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.hero-sub {
  margin-top: var(--space-md);
  max-width: 46ch;
  font-size: 1.1rem;
  line-height: 1.55;
}
.hero-actions { margin-top: var(--space-lg); }
.hero-meta {
  margin-top: var(--space-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.hero-visual { display: flex; justify-content: center; }
.portrait-frame {
  margin: 0;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-raised);
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; }
.portrait-frame--small { max-width: 280px; aspect-ratio: 4 / 5; }

/* ---------- About ---------- */
.about { padding: var(--space-2xl) 0; border-top: 1px solid var(--line); }
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}
.about-text h2 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); }
.about-text p {
  margin-top: var(--space-md);
  max-width: 62ch;
  font-size: 1.02rem;
}
.about-text p + p { margin-top: var(--space-sm); }
.about-visual { display: flex; justify-content: center; }

/* ---------- Competencies ---------- */
.competencies { padding: var(--space-2xl) 0; border-top: 1px solid var(--line); }
.competencies h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  max-width: 22ch;
  margin-bottom: var(--space-xl);
}
.competencies-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}
.competency-card {
  padding: var(--space-lg);
  border-radius: var(--radius-card);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.competency-card h3 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.competency-card p { font-size: 0.98rem; }

/* ---------- Projects ---------- */
.projects { padding: var(--space-2xl) 0; border-top: 1px solid var(--line); }
.projects h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: var(--space-xl); }
.project-list { display: flex; flex-direction: column; }
.project-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-lg);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--line);
}
.project-list .project-row:last-child { border-bottom: 1px solid var(--line); }
.project-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--ink-faint);
  max-width: 16ch;
}
.project-body h3 { font-size: 1.2rem; margin-bottom: 0.65rem; max-width: 44ch; }
.project-body p { font-size: 0.98rem; max-width: 62ch; }

/* ---------- Experience ---------- */
.experience { padding: var(--space-2xl) 0; border-top: 1px solid var(--line); }
.experience h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin-bottom: var(--space-xl); }
.timeline { display: flex; flex-direction: column; gap: var(--space-lg); }
.timeline-item {
  padding-left: var(--space-lg);
  border-left: 2px solid var(--line);
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -7px; top: 0.4rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.timeline-period { color: var(--ink-faint); font-weight: 500; }
.timeline-tag {
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.78rem;
}
.timeline-item h3 { font-size: 1.1rem; margin-bottom: 0.5rem; max-width: 50ch; }
.timeline-item p { font-size: 0.98rem; max-width: 62ch; }
.timeline-older {
  padding-left: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line);
}
.timeline-older p { font-size: 0.95rem; max-width: 62ch; }
.timeline-older strong { color: var(--ink); }
.timeline-older .text-link { margin-top: 0.75rem; }

/* ---------- Contact ---------- */
.contact { padding: var(--space-2xl) 0; border-top: 1px solid var(--line); }
.contact-inner { max-width: 640px; text-align: left; }
.contact h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.contact p { margin-top: var(--space-sm); font-size: 1.05rem; max-width: 56ch; }
.contact .btn { margin-top: var(--space-lg); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: var(--space-lg) 0; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.footer-name { color: var(--ink-soft); font-weight: 500; }
.footer-sep { margin: 0 0.4rem; }

/* ---------- Scroll reveal (progressive enhancement) ---------- */
.gsap-ready [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-links { display: none; }
  .nav-toggle { display: grid; }
  .hero-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }
  .hero-visual { order: -1; }
  .portrait-frame { max-width: 320px; }
  .about-visual { order: -1; }
  .portrait-frame--small { max-width: 240px; }
  .competencies-grid { grid-template-columns: 1fr; }
  .project-row { grid-template-columns: 1fr; gap: var(--space-sm); }
  .stat-value { font-size: 2rem; }
}

@media (max-width: 560px) {
  :root { --gutter: 18px; --space-2xl: 4.5rem; --space-xl: 3rem; }
  .hero { padding-top: calc(var(--nav-h) + var(--space-md)); }
  .hero-title { font-size: clamp(2rem, 8vw, 2.6rem); }
}

@media (max-width: 420px) {
  /* Icon-only LinkedIn pill: keeps the nav on one line on narrow phones.
     Full "Napisz na LinkedIn" label stays everywhere else (hero, contact). */
  .nav-actions .btn-primary.btn-small { padding: 0.55rem; }
  .nav-actions .btn-primary.btn-small .btn-text { display: none; }
  .brand-name { display: none; }
}

/* ---------- Theme toggle glyph swap ----------
   Default (no explicit theme, light system pref): sun shown, moon hidden.
   The button always shows the icon for the theme you'd SWITCH TO. */
.icon-sun-glyph { display: none; }
.icon-moon-glyph { display: block; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .icon-sun-glyph { display: block; }
  html:not([data-theme]) .icon-moon-glyph { display: none; }
}
:root[data-theme="dark"] .icon-sun-glyph { display: block; }
:root[data-theme="dark"] .icon-moon-glyph { display: none; }
:root[data-theme="light"] .icon-sun-glyph { display: none; }
:root[data-theme="light"] .icon-moon-glyph { display: block; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  .gsap-ready [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ---------- Focus visibility ---------- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
