:root {
  --ink: #1c2233;
  --ink-soft: #4a5268;
  --ink-faint: #5f6679;
  --line: rgba(28, 34, 51, 0.12);

  --bg: #105b9f;

  --link: #2a5aa0;
  --accent: #2a5aa0;

  --card-bg: #eceff6;
  --max: 940px;

  --water-mid: #115ca1;
  --blog-accent: #cd0e0e;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

html[data-lang="pl"] [data-lang="en"] { display: none; }
html[data-lang="en"] [data-lang="pl"] { display: none; }

/* ---------- animated backdrop ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  /* Navy of the Grain sky, so there's no blue flash before the first frame. */
  background: #0a2240;
}

.backdrop canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- lang toggle ---------- */

.lang-toggle {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 20;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.16);
  color: #fff8ee;
  font-family: 'Crimson Pro', serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.15s ease, transform 0.15s ease;
}
.lang-toggle:hover { background: rgba(0,0,0,0.3); }
.lang-toggle:active { transform: scale(0.96); }


.lang-flag { margin-right: 0.35em; }

/* ---------- page / card ---------- */

.page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 24px;
}

.card {
  width: 100%;
  max-width: var(--max);
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 8px;
  box-shadow: 0 18px 50px -12px rgba(5, 25, 55, 0.45), 0 2px 6px rgba(5,25,55,0.12);
  padding: 44px 44px 36px;
  transition: opacity 1.1s ease-out,
              transform 1.1s ease-out;
}

/* The card fades and rises into place on load. Only hidden when JS runs,
   since script.js is what reveals it. */
.js .card:not(.is-visible) {
  opacity: 0;
  transform: translateY(18px);
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
}

/* ---------- header ---------- */

.card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  margin-bottom: 30px;
}

.avatar {
  flex: none;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: linear-gradient(160deg, #2f7cc4, var(--bg) 70%);
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px rgba(28,34,51,0.1), 0 8px 24px rgba(5, 25, 55, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Crimson Pro', serif;
  font-weight: 600;
  font-size: 3rem;
  color: #fff;
  overflow: hidden;
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.identity h1 {
  margin: 0;
  font-size: 3rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0;
  color: var(--ink);
}

.tagline {
  margin: 3px 0 0;
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--ink-faint);
}

/* GitHub, LinkedIn and e-mail links under the job title: link colour,
   underlined only on hover. */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 24px;
  margin: 10px 0 0;
  font-size: 1rem;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--water-mid);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.2s ease;
}
.contact-link:hover, .contact-link:focus-visible { color: var(--blog-accent); outline: none; }
.contact-link:focus-visible { box-shadow: 0 0 0 2px rgba(205, 14, 14, 0.35); }

.contact-link svg { flex: none; width: 1em; height: 1em; fill: currentColor; }

.contact-text {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.2s ease;
}
.contact-link:hover .contact-text { text-decoration-color: rgba(205, 14, 14, 0.6); }

/* Crimson Pro has no ✻, so it comes from a fallback font with uneven side
   bearings; explicit margins keep the gaps on both sides equal. */
.tagline-sep {
  display: inline-block;
  margin: 0 0.4em;
}

/* ---------- links in the card ---------- */

/* The back link has its own, quieter look, so it's left out. */
.card a:not(.back-link):not(.contact-link) {
  color: var(--water-mid);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(17, 92, 161, 0.4);
  transition: color 0.2s ease, background 0.2s ease, text-shadow 0.2s ease,
              text-decoration-color 0.2s ease;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: 4px;
}

.card a:not(.back-link):not(.contact-link):hover,
.card a:not(.back-link):not(.contact-link):focus-visible {
  color: var(--blog-accent);
  text-decoration-color: rgba(205, 14, 14, 0.6);
  background: rgba(205, 14, 14, 0.08);
  text-shadow: 0 0 10px rgba(205, 14, 14, 0.22);
  outline: none;
}

.card a:not(.back-link):not(.contact-link):focus-visible {
  box-shadow: 0 0 0 2px rgba(205, 14, 14, 0.35);
}

/* ---------- lead paragraphs ---------- */

.lead {
  font-size: clamp(1rem, 0.78rem + 0.72vw, 1.3rem);
  line-height: 1.5;
  margin: 0 0 16px;
  color: var(--ink);
}


/* ---------- views: intro, details and open source ---------- */

/* Without JS all views stay visible, one after the other, and the back links
   are hidden. The views have no ids, so a #wiecej or #open-source link doesn't
   make the browser scroll past the card header. */
.back { display: none; }
.js .back { display: block; }
.js .view-details, .js .view-oss { display: none; }
.js[data-view="details"] .view-intro, .js[data-view="oss"] .view-intro { display: none; }
.js[data-view="details"] .view-details { display: block; }
.js[data-view="oss"] .view-oss { display: block; }

.view { animation: view-in 0.5s ease-out; }
.view:focus { outline: none; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

.back { margin: 0 0 4px; font-size: 0.9rem; }
.back-link { color: var(--ink-faint); text-decoration: none; border-radius: 4px; }
.back-link:hover, .back-link:focus-visible { color: var(--link); outline: none; }
.back-link:focus-visible { box-shadow: 0 0 0 2px rgba(205, 14, 14, 0.35); }

.view-details .facts { margin-top: 12px; }

/* The closing call to action is set apart by a rule, with the contact link
   in bold. */
.lead-cta {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.cta-link { font-weight: 600; }

/* ---------- highlights (two-column bullet list) ---------- */

/* The sentence that introduces the list sits closer to it. */
.lead-into-list { margin-bottom: 6px; }

.highlights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 32px;
  margin: 0 0 16px;
  padding-left: 1.2em;
  font-size: clamp(1rem, 0.78rem + 0.72vw, 1.3rem);
  line-height: 1.5;
  color: var(--ink);
}

/* ---------- open source projects ---------- */

.oss {
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.oss-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  padding: 20px 24px 18px;
}

.oss-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 24px;
  font-size: clamp(1rem, 0.78rem + 0.72vw, 1.3rem);
  line-height: 1.5;
}

.oss-more {
  margin: 14px 0 0;
  color: var(--ink-faint);
  font-style: italic;
}

/* ---------- quick facts (two-column list) ---------- */

.facts {
  list-style: none;
  margin: 24px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  font-size: 0.92rem;
}

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

.facts-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.facts a { align-self: flex-start; }

/* ---------- section labels ---------- */

.section-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}

#projects, #stack, #experience {
  margin-top: 38px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

/* ---------- stack ---------- */

.stack-row { margin-bottom: 16px; }
.stack-row:last-child { margin-bottom: 0; }

.stack-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 7px;
  font-family: -apple-system, sans-serif;
}

.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tags li {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--ink);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  padding: 4px 11px;
  border-radius: 999px;
}

.tags.small li {
  font-size: 0.76rem;
  padding: 3px 9px;
}

/* ---------- experience ---------- */

.entry { margin-bottom: 30px; }
.entry:last-child { margin-bottom: 0; }

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.entry-role { font-weight: 700; font-size: 1rem; color: var(--ink); }
.entry-org { font-weight: 400; font-style: italic; color: var(--ink-soft); }

.entry-date {
  font-size: 0.8rem;
  color: var(--ink-faint);
  white-space: nowrap;
  font-family: -apple-system, sans-serif;
}

.sub-entry {
  margin: 0 0 20px 0;
  padding-left: 16px;
  border-left: 2px solid var(--line);
}
.sub-entry:last-child { margin-bottom: 0; }

.sub-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 6px;
}

.sub-entry-date {
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--ink-faint);
  white-space: nowrap;
  font-family: -apple-system, sans-serif;
}

.entry p, .entry-list, .sub-entry p {
  margin: 0 0 10px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.entry-list { padding-left: 18px; }
.entry-list li { margin-bottom: 4px; }

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .page { padding: 68px 14px 32px; }
  .card { padding: 32px 20px 28px; }
  .card-header { flex-direction: column; text-align: center; gap: 14px; }
  .contact-links { justify-content: center; }
  .avatar { width: 96px; height: 96px; font-size: 2.4rem; }
  .facts, .highlights { grid-template-columns: 1fr; }
  .oss-list { grid-template-columns: 1fr 1fr; }
  .entry-head, .sub-entry-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .identity h1 { font-size: 2.3rem; }
}

/* ---------- print ---------- */

@media print {
  .backdrop, .lang-toggle { display: none; }
  .back { display: none; }
  .js .view-intro, .js .view-details, .js .view-oss { display: block; }
}
