/* Wiktoria Przykucka — Portfolio | v1.15.3
   Force-directed canvas. Elliptical gravity well (aspect = VW/VH) fills a wide
   landscape oval. Boot is solved synchronously then faded in. Boxes expand in
   place with detail panels; the canvas focuses and dims siblings. */

:root {
  --bg: #FAF7FB;
  --box: #FFFFFF;
  --border: #EBD8F0;
  --text: #1A1020;
  --muted: #9A87A3;
  --accent: #E040A0;
  --accent-soft: #F3B8DF;
  --accent-fill: #FBE6F4;
  --grid: rgba(120, 70, 110, 0.10);
  --shadow: 0 6px 18px rgba(90, 30, 70, 0.08);
  --shadow-hover: 0 12px 30px rgba(224, 64, 160, 0.20);
  --radius: 16px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-theme="dark"] {
  --bg: #16101A;
  --box: #211828;
  --border: #3A2645;
  --text: #F3EAF7;
  --muted: #A892B2;
  --accent: #E865B0;
  --accent-soft: #5A2748;
  --accent-fill: #2E1A35;
  --grid: rgba(240, 200, 230, 0.07);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 12px 32px rgba(232, 101, 176, 0.26);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }

body {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.5s ease, color 0.5s ease;
  -webkit-user-select: none;
  user-select: none;
}
/* ----- Glass nav ----- */
.glass-nav {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 230px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(150deg,
      color-mix(in srgb, var(--box) 84%, transparent) 50%,
      color-mix(in srgb, var(--accent-fill) 58%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent-soft) 42%, transparent);
  box-shadow: 0 16px 42px rgba(224, 64, 160, 0.16);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}
.glass-nav button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  padding: 9px 11px;
  border-radius: 14px;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s var(--ease-spring);
}
.glass-nav .nav-brand {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 2.08rem;
  line-height: 0.98;
  letter-spacing: -0.015em;
  padding: 1px 2px 9px 6px;
  text-align: left;
  white-space: normal;
}
.nav-links {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  width: 100%;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
}
.nav-link i {
  width: 22px;
  margin-right: 8px;
  color: var(--accent);
  font-size: 0.92em;
  text-align: center;
}
.glass-nav button:hover {
  background: color-mix(in srgb, var(--accent-fill) 62%, transparent);
  transform: translateY(-1px);
}
.glass-nav button.is-active {
  background: color-mix(in srgb, var(--accent-fill) 82%, transparent);
  color: var(--text);
}
.glass-nav .nav-brand.is-active {
  background: transparent;
}
.nav-controls {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--accent-soft) 34%, transparent);
}
@media (max-width: 820px) {
  .glass-nav {
    position: static;
    margin: 12px 12px 0;
    width: auto;
    max-width: none;
    gap: 12px;
  }
  .glass-nav .nav-brand { font-size: 1.7rem; padding-bottom: 4px; }
  .nav-links { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .nav-link {
    width: auto;
    font-size: 0.85rem;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--accent-soft) 40%, transparent);
    border-radius: 999px;
  }
  .nav-controls { padding-top: 0; border-top: 0; justify-content: flex-end; }
  /* Pan/zoom/fit are meaningless without the canvas — keep only the theme toggle. */
  #zoom-in, #zoom-out, #recenter { display: none; }
  /* The drag/scroll/right-drag hint only applies to the desktop canvas. */
  .hint { display: none !important; }
}
/* soft gradient wash (kept) */
body::before {
  content: "";
  position: fixed; inset: -25%;
  z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 38% at 24% 20%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
    radial-gradient(42% 42% at 78% 82%, color-mix(in srgb, var(--accent-soft) 18%, transparent), transparent 72%);
}

a { color: inherit; text-decoration: none; }
.icon {
  display: inline-block;
  margin-right: 0.42em;
  color: var(--accent);
  font-size: 0.95em;
}
.ext-icon {
  margin-left: 0.35em;
  color: var(--accent);
  font-size: 0.72em;
}

/* ----- Viewport + grid background ----- */
.viewport {
  position: fixed; inset: 0; z-index: 1; overflow: hidden;
  cursor: grab; touch-action: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: 0 0;
}
.viewport.is-grabbing { cursor: grabbing; }
.viewport.is-box-dragging { cursor: grabbing; }
.viewport.has-detail { cursor: default; }
.viewport.has-detail::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--bg) 35%, transparent);
  pointer-events: auto;
  cursor: default;
  transition: opacity 0.35s ease;
}
/* Keep the canvas (and every box on it) above the scrim so the expanded card
   stays crisp; non-focused boxes are faded via .is-dimmed instead. */
.viewport.has-detail .canvas { z-index: 5; }
.box.is-dragging {
  z-index: 12;
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: scale(1.02);
}
.canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }

/* ----- Box base ----- */
.box {
  position: absolute;
  top: 0; left: 0;
  background: var(--box);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.35;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.3s var(--ease-spring),
              opacity 0.3s ease;
}
/* entrance: boxes stay hidden while the layout solves, then pop in together */
.canvas:not(.ready) .box { opacity: 0; transform: scale(0.86); }
.viewport:not(.is-grabbing) .box:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: scale(1.04);
  z-index: 6;
}
.box.hidden { display: none !important; }

/* tag label */
.lbl {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  color: var(--accent);
  text-transform: lowercase;
  margin-bottom: 5px;
  opacity: 0.92;
}
.val { display: block; font-size: 0.97rem; font-weight: 600; }
.sub { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 3px; font-weight: 500; }

/* fact boxes */
.fact { width: max-content; max-width: 248px; }
.fact .val { white-space: normal; font-weight: 600; }
.fact.status { border-color: color-mix(in srgb, #34D27B 45%, var(--border)); }
.fact.star { background: var(--accent-fill); }
.fact.star .val { color: var(--accent); }

/* link boxes */
.link { width: max-content; background: var(--accent-fill); border-color: var(--accent-soft); }
.link .val { color: var(--accent); }
.link:hover { background: var(--accent); }
.link:hover .val, .link:hover .lbl { color: #fff; }

/* education / experience */
.edu { width: max-content; max-width: 268px; }
.edu .val { font-weight: 700; }

/* skill boxes */
.skill { width: max-content; max-width: 248px; padding: 9px 14px; }
.skill .lbl { margin-bottom: 3px; color: var(--muted); }
.skill .val { font-family: "JetBrains Mono", monospace; font-size: 0.86rem; font-weight: 500; white-space: nowrap; }

/* projects */
.proj { width: 248px; padding: 10px 10px 14px; }
.proj .lbl { padding: 2px 6px 0; }
.proj .pmedia { border-radius: 11px; overflow: hidden; border: 1px solid var(--border);
  background: #efe7f2; aspect-ratio: 16 / 9; width: 100%; margin: 6px 0 8px; }
.proj .pmedia--contain { background: #e7e9ec; }
.proj .pmedia--contain img { object-fit: contain; }
.proj .pmedia img { width: 100%; height: 100%; object-fit: cover; display: block; }
.proj .val { padding: 0 6px; font-size: 1.02rem; font-weight: 700; }
.proj .sub { padding: 0 6px; }

/* ----- Detail boxes (expand in place) ----- */
.detail-box {
  cursor: pointer;
  padding-bottom: 20px;
  -webkit-user-select: text;
  user-select: text;
}
.detail-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.detail-box.is-dimmed {
  opacity: 0.38;
  pointer-events: none;
  transform: none !important;
}
.detail-box.is-expanded {
  z-index: 20 !important;
  opacity: 1;
  cursor: default;
  border-color: var(--accent);
  box-shadow: 0 20px 50px rgba(224, 64, 160, 0.28);
  transform: none !important;
  padding: 20px 24px 24px;
  max-width: min(440px, 92vw);
}
.detail-box.is-expanded.fact,
.detail-box.is-expanded.skill { max-width: min(380px, 92vw); }
.detail-box.is-expanded.proj {
  width: min(480px, 92vw);
  max-width: min(480px, 92vw);
  padding: 22px 26px 26px;
}
.detail-box.is-expanded.edu { max-width: min(420px, 92vw); }
/* Drop collapsed-type tight insets inside the open panel */
.detail-box.is-expanded .box-detail .lbl { padding: 0; margin-bottom: 8px; }
.detail-box.is-expanded.proj .box-detail .val,
.detail-box.is-expanded.proj .box-detail .sub { padding: 0; }

.detail-close {
  position: absolute;
  display: grid;
  place-items: center;
  border: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease-spring), background 0.2s ease, color 0.2s ease;
}
/* plain accent glyph tucked in the bottom-right corner — no chip, no colour swap */
.info-btn {
  position: absolute;
  bottom: 6px;
  right: 9px;
  padding: 2px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
  z-index: 2;
  transition: opacity 0.2s ease;
}
.info-btn:hover { opacity: 1; }
.detail-box.is-expanded .info-btn { display: none; }

.detail-close {
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--box);
  color: var(--muted);
  font-size: 1rem;
  border: 1px solid var(--border);
  z-index: 3;
}
.detail-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.box-detail {
  -webkit-user-select: text;
  user-select: text;
}
.box-detail[hidden] { display: none !important; }
.detail-box.is-expanded .box-summary { display: none; }

.detail-title {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 2px 0 14px;
  padding-right: 32px;
}
.detail-body {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 12px;
}
.detail-body:last-of-type { margin-bottom: 10px; }
.detail-list {
  margin: 6px 0 2px;
  padding-left: 1.25rem;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.55;
  color: var(--muted);
}
.detail-list li + li { margin-top: 6px; }
.detail-box.is-expanded .box-detail .pmedia { margin: 4px 0 16px; border-radius: 12px; }

/* ----- Centre box: name + search (lives on the canvas) ----- */
.hero {
  width: 400px;
  padding: 18px 20px;
  background: linear-gradient(150deg, var(--box) 52%, var(--accent-fill));
  border-color: var(--accent-soft);
  box-shadow: 0 18px 50px rgba(224, 64, 160, 0.24);
  z-index: 8;
}
.hero-row { display: flex; align-items: center; gap: 14px; }
.hero-photo {
  width: 100px; height: 126px;
  border-radius: 13px; object-fit: cover; flex-shrink: 0;
  border: 2px solid var(--accent-soft);
}
.hero-name {
  font-family: "Playfair Display", Georgia, "Times New Roman", serif; font-weight: 700;
  font-size: 2.2rem; line-height: 0.98; letter-spacing: -0.015em;
}
.hero-tag { color: var(--muted); font-size: 0.84rem; margin-top: 6px; }

.search {
  position: relative;
  display: flex; align-items: center;
  width: 100%;
  margin-top: 12px;
}
.search-ico { position: absolute; left: 14px; font-size: 0.9rem; opacity: 0.7; pointer-events: none; }
#search {
  width: 100%;
  font: inherit; font-size: 0.97rem;
  padding: 13px 40px 13px 40px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--box);
  color: var(--text);
  box-shadow: var(--shadow);
  outline: none;
  -webkit-user-select: text; user-select: text;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
/* Hide the browser’s native search clear (blue ×); we use .search-clear instead */
#search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
#search::-ms-clear { display: none; }
.search-clear {
  position: absolute; right: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: var(--accent-fill); color: var(--accent);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.search-clear:hover { background: var(--accent); color: #fff; }

/* ----- Nav controls ----- */
.tool-btn {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--box); color: var(--text);
  box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center;
  padding: 0;
  font-size: 1.25rem; font-weight: 600;
  transition: transform 0.25s var(--ease-spring), border-color 0.25s ease;
}
.tool-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.tool-btn svg { width: 19px; height: 19px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }

/* ----- Hint ----- */
.hint {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 40; background: var(--box); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 18px; font-size: 0.82rem; color: var(--muted);
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px;
  transition: opacity 0.5s ease, transform 0.5s ease; pointer-events: none;
}
.hint.is-hidden { opacity: 0; transform: translateX(-50%) translateY(12px); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ----- Mobile / tablet: name on top, search, then wrapped boxes ----- */
@media (max-width: 820px) {
  html, body { overflow: auto; height: auto; overscroll-behavior: auto;
    -webkit-text-size-adjust: 100%; }
  .viewport { position: static; overflow: visible; cursor: default; height: auto;
    touch-action: auto; background-position: 0 0 !important; }
  .canvas { position: static; transform: none !important;
    display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start;
    gap: 10px; padding: 16px 14px 56px; }
  .box { position: static !important; transform: none !important; }
  /* Safety net: with no physics the canvas may stay un-"ready"; never hide boxes. */
  .canvas:not(.ready) .box { opacity: 1; transform: none; }
  .hero { width: 100%; max-width: 480px; order: -1; margin: 4px auto 6px; }
  .proj { width: clamp(150px, 46%, 230px); }
  .detail-box { padding-right: 16px; }
  .info-btn { display: grid; }
  .detail-box.is-expanded {
    width: 100% !important;
    max-width: 480px !important;
    padding: 20px 22px 24px !important;
    order: -1;
  }
  .viewport.has-detail::after { display: none; }
  .detail-box.is-dimmed { opacity: 1; pointer-events: auto; }
}

/* ----- Phones: tighter spacing, full-width projects, wrapping skills ----- */
@media (max-width: 480px) {
  .canvas { gap: 8px; padding: 12px 10px 48px; }
  .hero { padding: 16px; }
  .hero-name { font-size: 1.9rem; }
  .hero-photo { width: 84px; height: 106px; }
  .proj { width: 100%; max-width: 340px; }
  .edu { max-width: 100%; }
  .skill .val { white-space: normal; }
  .detail-box.is-expanded { padding: 18px 18px 22px !important; }
  .detail-title { font-size: 1.2rem; }
}
