/* ==========================================================
   Filip Gieraga — Portfolio
   ========================================================== */

:root {
  --bg: #fafaf9;
  --bg-2: #f2f2f0;
  --surface: #ffffff;
  --text: #0e0e10;
  --muted: #5c5c66;
  --faint: #8e8e98;
  --line: #e6e6e3;
  --accent: #dd0031; /* Angular red */
  --accent-soft: rgba(221, 0, 49, 0.08);
  --shadow:
    0 1px 2px rgba(16, 16, 20, 0.04), 0 12px 32px -12px rgba(16, 16, 20, 0.12);
  --code-bg: #111114;
  --radius: 18px;
  --container: 1120px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0c;
    --bg-2: #111113;
    --surface: #141417;
    --text: #f2f2f3;
    --muted: #a0a0aa;
    --faint: #6e6e78;
    --line: #232328;
    --accent: #ff4d6d;
    --accent-soft: rgba(255, 77, 109, 0.1);
    --shadow:
      0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
    --code-bg: #0f0f12;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --bg-2: #111113;
  --surface: #141417;
  --text: #f2f2f3;
  --muted: #a0a0aa;
  --faint: #6e6e78;
  --line: #232328;
  --accent: #ff4d6d;
  --accent-soft: rgba(255, 77, 109, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  --code-bg: #0f0f12;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
p,
figure,
dl,
dd {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg .fill,
svg.fill {
  fill: currentColor;
  stroke: none;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--text);
  color: var(--bg);
  padding: 8px 14px;
  border-radius: 8px;
}

.skip:focus {
  top: 16px;
}

.link {
  color: var(--text);
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px
    no-repeat;
  transition:
    color 0.2s,
    background-size 0.2s;
}

.link:hover {
  color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  transition:
    transform 0.2s ease,
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
}

.btn svg {
  width: 18px;
  height: 18px;
}

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

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

.btn--primary:hover {
  background: var(--accent);
  color: #fff;
}

.btn--ghost {
  border-color: var(--line);
  background: var(--surface);
}

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

.btn--sm {
  height: 36px;
  padding: 0 16px;
  font-size: 14px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  transition:
    border-color 0.2s,
    transform 0.2s;
}

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

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.i-moon {
  display: none;
}

:root[data-theme="dark"] .i-sun {
  display: none;
}

:root[data-theme="dark"] .i-moon {
  display: block;
}

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

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.nav.is-scrolled {
  border-bottom-color: var(--line);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 24px;
}

.nav__logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.nav__logo span {
  color: var(--accent);
}

.nav__links {
  display: flex;
  gap: 6px;
}

.nav__links a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition:
    color 0.2s,
    background-color 0.2s;
}

.nav__links a:hover,
.nav__links a.is-active {
  color: var(--text);
  background: var(--bg-2);
}

.nav__actions {
  display: flex;
  gap: 8px;
}

.nav__burger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav__burger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.25s;
}

.nav__burger[aria-expanded="true"] span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}

.nav__burger[aria-expanded="true"] span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

/* ---------- Hero ---------- */
.hero {
  padding: 72px 0 40px;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(
    ellipse 70% 60% at 50% 30%,
    #000 20%,
    transparent 75%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 70% 60% at 50% 30%,
    #000 20%,
    transparent 75%
  );
  opacity: 0.55;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
  }
}

.hero__title {
  font-size: clamp(44px, 7vw, 84px);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 700;
  margin-top: 24px;
}

.hero__role {
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 14px;
  color: var(--muted);
}

.hero__role::before {
  content: "/ ";
  color: var(--accent);
}

.hero__lead {
  max-width: 560px;
  margin-top: 22px;
  font-size: 17px;
  color: var(--muted);
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 32px;
}

.socials a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

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

.socials svg {
  width: 18px;
  height: 18px;
}

.hero__visual {
  position: relative;
  padding-bottom: 48px;
}

.portrait {
  aspect-ratio: 1;
  width: 100%;
  max-width: 380px;
  margin-left: auto;
  border-radius: 28px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  transition:
    filter 0.5s ease,
    transform 0.6s ease;
}

.portrait:hover img {
  filter: grayscale(0);
  transform: scale(1.03);
}

.code-card {
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(330px, 92%);
  background: var(--code-bg);
  color: #d4d4d8;
  border-radius: 14px;
  box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}

.code-card__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.code-card__bar i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3f3f46;
}

.code-card__bar i:first-child {
  background: #ff5f57;
}

.code-card__bar i:nth-child(2) {
  background: #febc2e;
}

.code-card__bar i:nth-child(3) {
  background: #28c840;
}

.code-card__bar span {
  margin-left: 8px;
  font: 12px var(--mono);
  color: #8b8b94;
}

.code-card pre {
  margin: 0;
  padding: 14px 16px 16px;
  font: 12px/1.7 var(--mono);
  overflow-x: auto;
}

.code-card .k {
  color: #c792ea;
}

.code-card .v {
  color: #82aaff;
}

.code-card .f {
  color: #ffcb6b;
}

.code-card .p {
  color: #f07178;
}

.code-card .s {
  color: #c3e88d;
}

.code-card .n {
  color: #f78c6c;
}

.code-card .c {
  color: #676e95;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.stat {
  padding: 24px 26px;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
}

.stat:first-child {
  border-left: 0;
}

.stat dt {
  font-size: 13px;
  color: var(--muted);
}

.stat dd {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat sup {
  color: var(--accent);
  font-size: 0.55em;
  top: -0.7em;
  margin-left: 2px;
}

/* ---------- Sections ---------- */
.section {
  padding: 112px 0 0;
  scroll-margin-top: 60px;
}

.section__head {
  max-width: 680px;
  margin-bottom: 48px;
}

.section__num {
  font: 500 13px var(--mono);
  color: var(--accent);
  margin-bottom: 12px;
}

.section__head h2,
.contact h2 {
  font-size: clamp(32px, 4.2vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 700;
}

.section__lead {
  color: var(--muted);
  font-size: 17px;
  margin-top: 14px;
}

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.card {
  position: relative;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition:
    transform 0.3s ease,
    border-color 0.3s,
    box-shadow 0.3s;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(
    400px circle at var(--mx, 50%) var(--my, 0%),
    var(--accent-soft),
    transparent 60%
  );
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: var(--shadow);
}

.card:hover::after {
  opacity: 1;
}

.card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 22px;
}

.card h3 {
  font-size: 20px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.card p {
  color: var(--muted);
  margin-top: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
}

.tags li {
  font: 500 12px var(--mono);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.tags--muted li {
  color: var(--muted);
  background: transparent;
}

/* Timeline */
.timeline {
  border-top: 1px solid var(--line);
}

.job {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}

.job__date {
  font: 500 14px var(--mono);
}

.job__place {
  color: var(--faint);
  font-size: 14px;
  margin-top: 4px;
}

.job__body h3 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.job__body h3 span {
  color: var(--muted);
  font-weight: 500;
}

.job__list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.job__list li {
  position: relative;
  padding-left: 22px;
  color: var(--muted);
}

.job__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 10px;
  height: 1.5px;
  background: var(--accent);
}

.job__note {
  color: var(--muted);
  margin-top: 10px;
}

/* Stack */
.stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stack__group {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stack__group h3 {
  font: 500 12px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips li {
  font-size: 14px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 10px;
  background: var(--bg-2);
  transition:
    background-color 0.2s,
    color 0.2s;
}

.chips li:hover {
  background: var(--accent);
  color: #fff;
}

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

.project {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

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

.project__thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.project__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform 0.6s ease;
}

.project:hover .project__thumb img {
  transform: scale(1.04);
}

.project__body {
  padding: 24px 26px 26px;
}

.project__body h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project__body p {
  color: var(--muted);
  margin-top: 6px;
  font-size: 15px;
}

.project__body .tags {
  margin-top: 14px;
}

.mini-projects {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.mini-projects li + li {
  border-top: 1px solid var(--line);
}

.mini-projects a {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px 26px;
  transition: background-color 0.2s;
}

.mini-projects a:hover {
  background: var(--bg-2);
}

.mini-projects span {
  font-weight: 600;
}

.mini-projects em {
  font-style: normal;
  color: var(--muted);
  font-size: 15px;
}

.mini-projects b {
  color: var(--faint);
  transition:
    transform 0.2s,
    color 0.2s;
}

.mini-projects a:hover b {
  transform: translateX(4px);
  color: var(--accent);
}

/* About */
.about__grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
}

.about__grid p {
  color: var(--muted);
  font-size: 17px;
}

.about__grid p + p {
  margin-top: 16px;
}

.facts {
  border-top: 1px solid var(--line);
}

.facts li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.facts span {
  color: var(--faint);
}

.facts b {
  font-weight: 500;
  text-align: right;
}

/* Contact */
.contact {
  padding-bottom: 112px;
}

.contact__box {
  text-align: center;
  padding: 72px 32px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}

.contact__box::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  left: 50%;
  top: -340px;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--accent-soft), transparent 65%);
  pointer-events: none;
}

.contact__box .section__lead {
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.contact__row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.contact__mail {
  font-size: clamp(18px, 2.6vw, 28px);
  font-weight: 600;
  letter-spacing: -0.02em;
  word-break: break-all;
  transition: color 0.2s;
}

.contact__mail:hover {
  color: var(--accent);
}

.contact .hero__cta {
  justify-content: center;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-size: 14px;
  color: var(--muted);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition:
    opacity 0.25s,
    transform 0.25s;
  z-index: 80;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Reveal */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0s);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .hero__visual {
    max-width: 440px;
  }

  .portrait {
    margin-left: 0;
    margin-right: auto;
    max-width: 340px;
  }

  .code-card {
    left: auto;
    right: 0;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat:nth-child(3) {
    border-left: 0;
  }

  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .stack {
    grid-template-columns: repeat(2, 1fr);
  }

  .about__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .job {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 760px) {
  .nav__burger {
    display: flex;
  }

  .nav__links {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.2s,
      transform 0.2s,
      visibility 0.2s;
  }

  .nav__links.is-open {
    opacity: 1;
    transform: none;
    visibility: visible;
  }

  .nav__links a {
    padding: 14px 12px;
    font-size: 16px;
    border-radius: 10px;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .hero {
    padding-top: 40px;
  }

  .section {
    padding-top: 80px;
  }

  .section__head {
    margin-bottom: 32px;
  }

  .cards,
  .projects,
  .stack {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 26px;
  }

  .stat {
    padding: 20px;
  }

  .stat dd {
    font-size: 26px;
  }

  .mini-projects a {
    grid-template-columns: 1fr auto;
    padding: 16px 20px;
  }

  .mini-projects em {
    grid-column: 1;
    grid-row: 2;
    font-size: 14px;
    margin-top: -10px;
  }

  .mini-projects b {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

  .facts li {
    flex-direction: column;
    gap: 2px;
  }

  .facts b {
    text-align: left;
  }

  .contact {
    padding-bottom: 80px;
  }

  .contact__box {
    padding: 56px 20px;
  }

  .btn {
    height: 46px;
  }

  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
