/* sebastianczarnecki.pl — pixel village · Outfit (PL) · B&W */

:root {
  --font: "Outfit", system-ui, sans-serif;
  --bg: #121212;
  --ground: #1a1a1a;
  --text: #f0f0f0;
  --muted: #9a9a9a;
  --dim: #5a5a5a;
  --accent: #ffffff;
  --panel-bg: #0e0e0e;
  --radius-orbit: min(38vw, 280px);
  --house-size: clamp(72px, 14vw, 110px);
  --char-size: clamp(96px, 18vw, 140px);
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

a {
  color: var(--accent);
}

/* ── HUD ── */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(18, 18, 18, 0.92), transparent);
}

.hud-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  pointer-events: none;
}

.hud-spacer {
  flex: 0 0 76px;
  width: 76px;
  height: 1px;
  visibility: hidden;
  pointer-events: none;
}

.hud-copy {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  pointer-events: none;
}

.hud-title {
  margin: 0;
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hud-sub {
  margin: 4px 0 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.lang-switch {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  pointer-events: auto;
  z-index: 201;
}

.lang-switch label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lang-select {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  background: #1a1a1a;
  border: 2px solid #444;
  padding: 8px 28px 8px 12px;
  cursor: pointer;
  box-shadow: 3px 3px 0 #000;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'%3E%3Cpath fill='%239a9a9a' d='M0 0l4 6 4-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lang-select:hover,
.lang-select:focus-visible {
  outline: none;
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #333;
}

/* ── Dock: social + project buttons ── */
.pixel-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
  padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(18, 18, 18, 0.96), rgba(18, 18, 18, 0.75));
  border-top: 2px solid #2a2a2a;
  pointer-events: auto;
}

.pixel-dock-social {
  display: flex;
  gap: 10px;
}

.pixel-icon {
  display: block;
  padding: 4px;
  background: #1a1a1a;
  border: 2px solid #444;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pixel-icon img {
  width: 32px;
  height: 32px;
  filter: grayscale(100%) contrast(1.1);
}

.pixel-icon:hover,
.pixel-icon:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 #333;
  outline: none;
}

.pixel-dock-projects {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pixel-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text);
  background: #1a1a1a;
  border: 2px solid #555;
  box-shadow: 4px 4px 0 #000;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
}

.pixel-btn img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  filter: grayscale(100%);
}

.pixel-btn:hover,
.pixel-btn:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #333;
  background: #252525;
  outline: none;
  color: var(--accent);
}

/* ── Village scene ── */
.world {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.village {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.village-ground {
  position: absolute;
  inset: 0;
  background-color: var(--ground);
  background-image: url("public/images/pixel/grass-tile.svg");
  background-size: 32px 32px;
  opacity: 0.9;
}

.village-ground::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 45% at 50% 52%, transparent 0%, var(--bg) 78%);
  pointer-events: none;
}

/* ── Center character ── */
.village-center {
  --walk-x: 0px;
  --walk-y: 0px;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translate(-50%, -50%) translate3d(var(--walk-x), var(--walk-y), 0);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.village-center.is-walking .character {
  animation: walk-bob 0.22s ease-in-out infinite;
}

.village-center.is-away .character {
  animation: none;
}

.village-center.is-away .village-hint {
  opacity: 0;
}

.village-center.facing-left .character img {
  transform: scaleX(-1);
}

.character {
  margin: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid #2a2a2a;
  box-shadow:
    4px 4px 0 #000,
    0 0 0 2px #333 inset;
  animation: bob 2.8s ease-in-out infinite;
}

.character img {
  width: var(--char-size);
  height: var(--char-size);
  filter: grayscale(100%) contrast(1.08);
  transition: transform 0.35s ease;
}

@keyframes walk-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.character-name {
  margin: 8px 0 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.village-hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ── Houses orbit ── */
.houses {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.house {
  --angle: calc((var(--i) * 72deg) - 90deg);
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--house-size);
  margin-left: calc(var(--house-size) / -2);
  margin-top: calc(var(--house-size) / -2);
  transform:
    rotate(var(--angle))
    translateY(calc(-1 * var(--radius-orbit)))
    rotate(calc(-1 * var(--angle)));
  pointer-events: auto;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  transition: transform 0.2s ease, filter 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.house img,
.gears-svg {
  width: 100%;
  height: auto;
  filter: grayscale(100%) contrast(1.05);
  transition: filter 0.2s, transform 0.2s;
}

/* Rotating gears — Prace */
.gears-icon {
  display: block;
  width: 100%;
}

.gear {
  transform-box: fill-box;
  transform-origin: center;
}

.gear--lg {
  animation: gear-spin 5s linear infinite;
}

.gear--md {
  animation: gear-spin-rev 3.5s linear infinite;
}

.gear--sm {
  animation: gear-spin 2.5s linear infinite;
}

@keyframes gear-spin {
  to { transform: rotate(360deg); }
}

@keyframes gear-spin-rev {
  to { transform: rotate(-360deg); }
}

.house--gears:hover .gears-svg,
.house--gears:focus-visible .gears-svg {
  filter: grayscale(100%) contrast(1.2) drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
}

.house-label {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
  text-shadow: 0 1px 2px #000;
}

.house:hover,
.house:focus-visible {
  outline: none;
  transform:
    rotate(var(--angle))
    translateY(calc(-1 * var(--radius-orbit) - 8px))
    rotate(calc(-1 * var(--angle)))
    scale(1.06);
}

.house:hover img,
.house:focus-visible img,
.house:hover .gears-svg,
.house:focus-visible .gears-svg {
  filter: grayscale(100%) contrast(1.2) drop-shadow(0 0 12px rgba(255, 255, 255, 0.25));
}

.house.is-active img,
.house.is-active .gears-svg {
  filter: grayscale(100%) contrast(1.25) brightness(1.15);
}

.house.is-active .house-label {
  color: var(--accent);
}

/* ── Panel dialog ── */
.panel {
  margin: auto;
  padding: 0;
  border: 3px solid #333;
  background: var(--panel-bg);
  color: var(--text);
  max-width: min(560px, 92vw);
  width: 100%;
  max-height: 80dvh;
  box-shadow: 8px 8px 0 #000;
  font-family: var(--font);
}

.panel::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.panel[open] {
  animation: panel-in 0.25s ease;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.panel-inner {
  display: flex;
  flex-direction: column;
  max-height: 80dvh;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 12px;
  border-bottom: 2px solid #2a2a2a;
  flex-shrink: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.panel-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 2px solid #444;
  background: #1a1a1a;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 3px 3px 0 #000;
  transition: transform 0.15s;
}

.panel-close:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 #000;
}

.panel-body {
  padding: 16px 20px 24px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.panel-body .lead {
  font-size: 17px;
  color: var(--text);
  margin-top: 0;
}

.panel-body .facts {
  margin: 16px 0;
  padding-left: 20px;
}

.panel-body .facts li {
  margin-bottom: 10px;
}

.panel-body .langs,
.panel-body .edu,
.panel-body .domain {
  font-size: 13px;
  color: var(--dim);
}

.entry {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed #2a2a2a;
}

.entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.entry h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.entry p {
  margin: 0 0 8px;
}

.timeline {
  margin: 0;
  padding: 0 0 0 20px;
}

.timeline li {
  margin-bottom: 12px;
}

.timeline time {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 2px;
}

.skill-row {
  margin-bottom: 14px;
  font-size: 14px;
}

.tag {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid #444;
  color: var(--text);
}

.contact-big {
  margin: 12px 0;
  font-size: clamp(18px, 4vw, 24px);
}

.contact-big a {
  text-decoration: none;
}

.contact-big a:hover {
  text-decoration: underline;
}

/* ── About panel content ── */
.about-content p {
  margin: 0 0 14px;
}

.about-content .lead {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 16px;
}

.about-content h3 {
  margin: 24px 0 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.about-content h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}

.about-block {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #2a2a2a;
}

.about-block:last-of-type {
  border-bottom: none;
}

.about-block p {
  margin: 0;
  font-size: 14px;
}

.about-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.pixel-btn--inline {
  cursor: pointer;
  border: 2px solid #555;
  font-family: var(--font);
}

/* ── Mobile: stack houses below character ── */
@media (max-width: 700px) {
  .pixel-dock {
    flex-direction: column;
    gap: 10px;
  }

  .village {
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 72px;
    padding-bottom: 120px;
    overflow-y: auto;
  }

  .village-center {
    position: relative;
    left: auto;
    top: auto;
    transform: translate3d(var(--walk-x), var(--walk-y), 0);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .houses {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 24px 16px 32px;
    pointer-events: auto;
    max-width: 360px;
    margin: 0 auto;
  }

  .house {
    position: static;
    transform: none !important;
    margin: 0;
    width: 100%;
  }

  .village-center {
    margin-bottom: 8px;
  }

  .village-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .character,
  .village-hint,
  .gear {
    animation: none;
  }

  .village-center {
    transition: none;
  }
}
