/* ---------- tokens ---------- */
:root {
  --bg: #f3eee6;
  --ink: #211c17;
  --muted: #7b7166;
  --line: rgba(33, 28, 23, .1);
  --paper: #fffaf3;
  --serif: "Fraunces", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --ease: cubic-bezier(.65, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 24px 48px -30px rgba(70, 45, 20, .45);
  --top: 68px;
  --gap: 14px;
  color-scheme: light;
  view-transition-name: none;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 400 15px/1.6 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #fff8ec 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #f1e2cf 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent, var(--ink)); outline-offset: 3px; border-radius: 10px; }
::selection { background: #f3c7a8; }

/* ---------- top bar ---------- */
.top {
  height: var(--top);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
}
.logo { font: 600 22px var(--serif); letter-spacing: -.01em; margin-right: auto; padding: 10px 6px; margin-left: -6px; }
.back {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 16px 0 12px; border-radius: 99px;
  background: var(--paper); box-shadow: var(--shadow);
  font-weight: 500; font-size: 14px;
  max-width: 0; padding: 0; margin-right: -14px; overflow: hidden; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: max-width .6s var(--ease), padding .6s var(--ease), margin .6s var(--ease), opacity .3s;
}
.back span { transition: transform .4s var(--ease-out); }
.back:hover span { transform: translateX(-3px); }
[data-view="home"] .back { visibility: hidden; }
[data-view="open"] .back { max-width: 140px; padding: 0 16px 0 12px; margin-right: 0; opacity: 1; pointer-events: auto; }
.hint {
  position: fixed; top: 0; left: 50%; height: var(--top);
  display: flex; align-items: center; transform: translateX(-50%);
  font-size: 13px; color: var(--muted);
  transition: opacity .3s;
}
[data-view="open"] .hint { opacity: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 99px;
  font-weight: 500; font-size: 14px;
  background: var(--paper); border: 1px solid var(--line);
  transition: transform .35s var(--ease-out), box-shadow .35s, background .3s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(70, 45, 20, .5); }
.btn:active { transform: none; }
.btn-dark { background: var(--ink); color: var(--paper); border-color: var(--ink); height: 38px; }
.btn-accent { background: var(--accent); color: #fff; border-color: transparent; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

/* ---------- the board ---------- */
.board {
  display: grid;
  gap: var(--gap);
  padding: 0 22px 22px;
  height: calc(100dvh - var(--top));
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
[data-view="home"] .board {
  grid-template-rows: 1fr 1fr .8fr;
  grid-template-areas:
    "me me me proj proj proj"
    "me me me proj proj proj"
    "tasks tasks tasks cv talk talk";
}
[data-view="home"] #o-meni { grid-area: me; }
[data-view="home"] #projekti { grid-area: proj; }
[data-view="home"] #naloge { grid-area: tasks; }
[data-view="home"] #cv { grid-area: cv; }
[data-view="home"] #kontakt { grid-area: talk; }

[data-view="open"] .board { grid-template-rows: minmax(0, 1fr) 76px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
[data-view="open"] .tile.open { grid-column: 1 / -1; grid-row: 1; }

/* each tile morphs on its own; its name moves with it */
#o-meni { view-transition-name: t-me; } #o-meni .name { view-transition-name: n-me; }
#projekti { view-transition-name: t-proj; } #projekti .name { view-transition-name: n-proj; }
#omrezja { view-transition-name: t-net; } #omrezja .name { view-transition-name: n-net; }
#naloge { view-transition-name: t-tasks; } #naloge .name { view-transition-name: n-tasks; }
#cv { view-transition-name: t-cv; } #cv .name { view-transition-name: n-cv; }
#kontakt { view-transition-name: t-talk; } #kontakt .name { view-transition-name: n-talk; }
::view-transition-group(*) { animation-duration: .7s; animation-timing-function: var(--ease); }
::view-transition-old(*), ::view-transition-new(*) { height: 100%; }
/* a name only grows or shrinks: no crossfade of two sizes of the same words */
::view-transition-old(n-me), ::view-transition-old(n-tasks), ::view-transition-old(n-net),
::view-transition-old(n-proj), ::view-transition-old(n-cv), ::view-transition-old(n-talk) { animation: none; opacity: 0; }
::view-transition-new(n-me), ::view-transition-new(n-tasks), ::view-transition-new(n-net),
::view-transition-new(n-proj), ::view-transition-new(n-cv), ::view-transition-new(n-talk) { animation: none; }

/* ---------- a tile ---------- */
.tile {
  position: relative;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  padding: 26px 28px;
  border-radius: 30px;
  background: var(--tint);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform .45s var(--ease-out), box-shadow .45s;
}
.tile:not(.open):hover { transform: translateY(-4px); box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 30px 50px -28px rgba(70, 45, 20, .55); }
.tile.open { cursor: default; padding: 34px 44px 0; outline: none; }
.tile.dark { color: var(--paper); --muted: #b8ab9c; --line: rgba(255, 250, 243, .14); }

.head { display: flex; flex-direction: column; gap: 4px; position: relative; }
.kicker { font-size: 12px; font-weight: 500; letter-spacing: .04em; color: var(--accent); }
.dark .kicker { color: var(--accent); }
.name {
  width: fit-content; white-space: nowrap;
  font: 600 clamp(26px, 2.6vw, 40px)/1.02 var(--serif);
  letter-spacing: -.02em;
}
[data-view="home"] #o-meni .name { font-size: clamp(54px, 6.6vw, 104px); letter-spacing: -.035em; }
.open .name { font-size: clamp(44px, 5vw, 76px); }
.close {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--paper); box-shadow: var(--shadow);
  font-size: 15px; display: none;
  transition: transform .4s var(--ease-out);
}
.dark .close { color: var(--ink); }
.close:hover { transform: rotate(90deg); }
.open .close { display: grid; place-items: center; }

.go {
  position: absolute; right: 18px; bottom: 18px;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .5s var(--ease-out), background .3s, color .3s;
}
.tile:hover .go { transform: rotate(45deg); background: var(--accent); color: #fff; }
.open .go { display: none; }

/* what shows in which state */
.teaser { margin-top: 12px; transition: opacity .3s; }
.full { display: none; }
.open .teaser { display: none; }
.open .full { display: block; overflow-y: auto; margin: 22px -44px 0; padding: 0 44px 44px; flex: 1; min-height: 0; scrollbar-width: thin; }
[data-view="open"] .tile:not(.open) { padding: 0 20px; justify-content: center; border-radius: 22px; }
[data-view="open"] .tile:not(.open) .kicker,
[data-view="open"] .tile:not(.open) .teaser { display: none; }
[data-view="open"] .tile:not(.open) .name { font-size: 19px; }
[data-view="open"] .tile:not(.open) .go { width: 30px; height: 30px; right: 14px; bottom: auto; top: 50%; margin-top: -15px; font-size: 13px; }

/* while tiles move, their words wait */
.morphing .teaser, .morphing .full, .morphing .kicker, .morphing .go, .morphing .close { opacity: 0 !important; transition: none !important; }
.revealed .open .full > *, .revealed .teaser > * { animation: rise .7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- teasers ---------- */
.line { font-size: 15px; color: var(--muted); max-width: 40ch; }
.dark .line { color: var(--accent); font-weight: 500; }
.role { font: 500 italic 20px var(--serif); color: var(--accent); margin-bottom: 4px; }
.about-teaser { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.about-teaser .about-photo {
  position: absolute; right: 26px; bottom: 26px;
  width: 38%; max-width: 260px; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 25%;
  border-radius: 22px; transform: rotate(3deg);
  box-shadow: 0 24px 40px -24px rgba(70, 45, 20, .6);
  transition: transform .6s var(--ease-out);
}
#o-meni:hover .about-teaser .about-photo { transform: rotate(0) scale(1.02); }
[data-view="home"] #o-meni .go { left: 28px; right: auto; }
.mini-stats { display: flex; gap: 26px; margin-top: 20px; }
.mini-stats div { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; }
.mini-stats b { font: 600 30px/1.1 var(--serif); color: var(--accent); }
.cv-peek {
  position: absolute; left: 50%; bottom: -40%; width: 70%;
  transform: translateX(-50%) rotate(-4deg);
  border-radius: 6px; box-shadow: 0 18px 30px -18px rgba(70, 45, 20, .6);
  transition: transform .6s var(--ease-out);
}
#cv:hover .cv-peek { transform: translateX(-50%) translateY(-12px) rotate(-1deg); }

/* ---------- pills ---------- */
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.pills li { font-size: 13px; padding: 5px 12px; border-radius: 99px; background: color-mix(in oklab, var(--paper) 70%, transparent); border: 1px solid var(--line); }

/* ---------- full content ---------- */
.lead { font-size: clamp(16px, 1.3vw, 19px); line-height: 1.65; max-width: 62ch; margin-bottom: 12px; }
strong { font-weight: 600; }
.full h3 { font: 600 24px var(--serif); margin: 40px 0 14px; display: flex; align-items: baseline; gap: 12px; }
.full h3 small { font: 13px var(--sans); color: var(--muted); }
.note { margin-top: 26px; font-size: 13px; color: var(--muted); max-width: 70ch; padding-left: 14px; border-left: 3px solid var(--accent); }
.caption { font-size: 13px; color: var(--muted); margin-top: 8px; text-align: center; }

.about-full { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, .6fr); gap: 48px; align-items: start; }
.about-photo.big { position: sticky; top: 0; }
.lead.strong { font-size: clamp(17px, 1.45vw, 21px); color: var(--ink); }
.badge {
  position: absolute; right: 40px; bottom: 34px; z-index: 1;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 13px; border-radius: 99px;
  background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 500;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5);
}
.badge i { width: 8px; height: 8px; border-radius: 50%; background: #5bd08a; box-shadow: 0 0 0 0 #5bd08a; animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.traits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.traits section { padding: 16px 18px; border-radius: 18px; background: color-mix(in oklab, var(--accent) 8%, #fff); }
.traits b { display: block; font: 600 18px var(--serif); color: var(--accent); }
.traits span { font-size: 14px; color: var(--muted); }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.skills section { padding: 16px 18px; border-radius: 18px; background: #fff; border: 1px solid var(--line); }
.skills h4 { font: 600 17px var(--serif); margin-bottom: 6px; }
.skills ul { list-style: none; font-size: 14px; color: var(--muted); }
.skills li { padding: 2px 0 2px 14px; position: relative; }
.skills li::before { content: ""; position: absolute; left: 0; top: .72em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.about-photo.big { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 25%; border-radius: 26px; box-shadow: var(--shadow); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; margin-top: 26px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { font: 600 18px var(--serif); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 28px; }
.stats div { padding: 18px 20px; border-radius: 20px; background: var(--paper); }
.stats b { display: block; font: 600 clamp(30px, 3vw, 44px)/1 var(--serif); color: var(--accent); font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.features section, .cards section {
  padding: 20px 22px; border-radius: 20px; background: var(--paper);
  transition: transform .45s var(--ease-out), box-shadow .45s;
}
.features section:hover, .cards section:hover { transform: translateY(-4px); box-shadow: 0 20px 34px -24px rgba(70, 45, 20, .5); }
.ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--tint); color: var(--accent); font-size: 17px; margin-bottom: 12px; }
.features h4, .cards h4 { font: 600 19px var(--serif); margin-bottom: 4px; }
.features p, .cards p { font-size: 14px; color: var(--muted); }

.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.shots.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shot {
  aspect-ratio: 16 / 10; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--paper);
  border: 1.5px dashed color-mix(in oklab, var(--accent) 35%, transparent);
  font-size: 13px; color: var(--muted);
}

.two { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.3fr); gap: 32px; margin-top: 26px; align-items: start; }
.steps { list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; padding: 14px 0; border-top: 1px solid var(--line); }
.steps li::before { content: counter(s); grid-row: span 2; font: 600 20px var(--serif); color: var(--accent); }
.steps b { font: 600 18px var(--serif); }
.steps span { font-size: 14px; color: var(--muted); }

.topo { margin-top: 26px; padding: 18px; border-radius: 22px; background: var(--paper); }
.topo svg { width: 100%; height: auto; max-height: 330px; }
.links path { fill: none; stroke: color-mix(in oklab, var(--accent) 30%, transparent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 2 9; }
.packets circle { fill: var(--accent); }
.nodes rect { fill: var(--tint); stroke: color-mix(in oklab, var(--accent) 40%, transparent); stroke-width: 1.5; }
.nodes text { fill: var(--ink); font: 500 12px var(--sans); text-anchor: middle; dominant-baseline: central; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tag { font-size: 12px; font-weight: 500; color: var(--accent); }
.cards h4 { margin-top: 8px; }
.cards .empty { background: transparent; border: 1.5px dashed color-mix(in oklab, var(--accent) 35%, transparent); }

.cv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 320px); gap: 48px; align-items: start; }
.timeline { list-style: none; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 2px; background: color-mix(in oklab, var(--accent) 25%, transparent); }
.timeline li { display: grid; grid-template-columns: 28px 120px 1fr; padding: 11px 0; }
.timeline li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; margin-top: 5px; background: var(--tint); border: 3px solid var(--accent); grid-row: span 2; }
.timeline time { font-size: 13px; color: var(--muted); padding-top: 3px; grid-row: span 2; }
.timeline b { font: 600 18px var(--serif); }
.timeline span { grid-column: 3; font-size: 14px; color: var(--muted); }
.cv-paper { display: block; border-radius: 8px; overflow: hidden; box-shadow: 0 30px 50px -28px rgba(70, 45, 20, .6); transform: rotate(2deg); transition: transform .6s var(--ease-out); }
.cv-paper:hover { transform: rotate(0) scale(1.02); }

.mail { display: block; text-align: left; margin-top: 10px; font: 600 clamp(28px, 4vw, 56px)/1.1 var(--serif); letter-spacing: -.02em; color: var(--accent); }
.tel { display: block; margin-top: 18px; font: 600 clamp(22px, 2.6vw, 36px)/1.1 var(--serif); color: var(--paper); }
.tel small { display: block; font: 13px var(--sans); color: var(--muted); margin-top: 4px; }
.tel:hover { color: var(--accent); }
.mail small { display: block; font: 13px var(--sans); color: var(--muted); margin-top: 6px; letter-spacing: 0; }
.dark .btn:not(.btn-accent) { background: transparent; color: var(--paper); }
.dark .btn-accent { color: var(--ink); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 10;
  padding: 10px 18px; border-radius: 99px;
  background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 500;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  transition: transform .5s var(--ease-out), opacity .3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .cv, .about-full { grid-template-columns: 1fr; }
  .about-photo.big { position: static; }
  .traits { grid-template-columns: 1fr; }
  .about-photo.big { max-width: 280px; order: -1; }
  .cv-paper { max-width: 300px; }
  .hint { display: none; }
}

/* phones: tiles stack, the open one comes first */
@media (max-width: 760px) {
  body { overflow: auto; }
  :root { --top: 60px; }
  .top { padding: 0 14px; }
  .logo { font-size: 19px; }
  .board { height: auto; padding: 0 14px 18px; grid-template-columns: 1fr; gap: 10px; }
  [data-view="home"] .board { grid-template-rows: none; grid-template-areas: none; }
  [data-view="home"] .tile { grid-area: auto !important; min-height: 170px; }
  [data-view="home"] #o-meni { min-height: 420px; }
  [data-view="open"] .board { grid-template-rows: none; grid-template-columns: 1fr; }
  [data-view="open"] .tile.open { grid-column: auto; grid-row: auto; order: -1; padding: 26px 20px 0; }
  [data-view="open"] .tile:not(.open) { min-height: 60px; }
  .open .full { overflow: visible; margin: 18px -20px 0; padding: 0 20px 28px; }
  .shots, .shots.two-up, .features { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 26px 1fr; }
  .timeline time { grid-row: auto; grid-column: 2; }
  .timeline b, .timeline span { grid-column: 2; }
  .about-teaser .about-photo { width: 44%; }
  .back { height: 34px; }
  .btn-dark { height: 34px; padding: 0 14px; }

  /* the bar stays on top while the page scrolls, so "Pregled" is always one tap away */
  .top { position: sticky; top: 0; z-index: 5; background: color-mix(in oklab, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .hint { display: none; }

  /* overview: two big tiles, then Naloge, then CV and Kontakt side by side */
  [data-view="home"] .board { grid-template-columns: 1fr 1fr; }
  [data-view="home"] #o-meni, [data-view="home"] #projekti, [data-view="home"] #naloge { grid-column: 1 / -1 !important; }
  [data-view="home"] #cv, [data-view="home"] #kontakt { min-height: 210px; padding: 20px; }
  [data-view="home"] #kontakt .em { display: none; }
  .about-photo.big { max-width: 220px; }
  [data-view="home"] #cv .name, [data-view="home"] #kontakt .name { font-size: 28px; }
  .cv-peek { left: auto; right: -14%; bottom: -26%; width: 78%; transform: rotate(-5deg); }
  #cv:hover .cv-peek { transform: rotate(-2deg) translateY(-8px); }
  .tile { padding: 22px 20px; border-radius: 26px; }
  .go { right: 14px; bottom: 14px; width: 38px; height: 38px; }
  [data-view="home"] #o-meni .name { font-size: clamp(52px, 15vw, 72px); }
  .about-teaser .about-photo { right: 18px; bottom: 18px; width: 46%; }
  .badge { right: 22px; bottom: 26px; font-size: 11px; padding: 6px 11px; }

  /* an open tile: the others wait below as a tidy two-column list */
  [data-view="open"] .board { grid-template-columns: 1fr 1fr; }
  [data-view="open"] .tile.open { grid-column: 1 / -1; }
  [data-view="open"] .tile:not(.open) { min-height: 56px; padding: 0 14px; border-radius: 18px; }
  [data-view="open"] .tile:not(.open) .name { font-size: 17px; }
  [data-view="open"] .tile:not(.open) .go { width: 26px; height: 26px; margin-top: -13px; right: 10px; }
  .open .name, [data-view="open"] #o-meni.open .name { font-size: 44px; }
  .close { width: 40px; height: 40px; }
  .lead { font-size: 16px; }
  .lead.strong { font-size: 17px; }
  .stats div { padding: 14px 16px; }
  .facts { grid-template-columns: 1fr; gap: 12px; }
  .skills { grid-template-columns: 1fr; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 18px -20px; padding: 0 20px 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; }
  .tasks { grid-template-columns: 1fr; }
  .net, .net-shots { grid-template-columns: 1fr; }
  .mail { font-size: 26px; word-break: break-all; }
  .cv-paper { max-width: 240px; margin: 8px auto 0; }
}


/* ---------- projects tile ---------- */
.proj-teaser { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.duo { position: relative; flex: 1; margin-top: 18px; }
.peek {
  position: absolute; width: 62%; border-radius: 14px; overflow: hidden;
  background: var(--paper); box-shadow: 0 26px 44px -26px rgba(40, 50, 120, .55);
  transition: transform .7s var(--ease-out);
}
.peek img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }
.peek figcaption { position: absolute; left: 12px; bottom: 12px; padding: 4px 11px; border-radius: 99px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 500; }
.peek-erp { left: 0; top: 0; transform: rotate(-3deg); z-index: 1; }
.peek-shop { right: 0; bottom: 6%; transform: rotate(3deg); }
#projekti:hover .peek-erp { transform: rotate(-1deg) translate(-6px, -6px); }
#projekti:hover .peek-shop { transform: rotate(1deg) translate(6px, -2px); }

.projects-full.full { display: none; }
.open .projects-full.full { display: flex; overflow: hidden; padding-bottom: 28px; }
.projects { display: flex; gap: 12px; flex: 1; min-height: 0; }
.project {
  position: relative; display: flex; flex: 1 1 0; min-width: 0;
  border-radius: 24px; overflow: hidden;
  background: var(--paper);
  transition: flex .8s var(--ease), background-color .4s, box-shadow .4s;
}
.has-open .project:not(.open) { flex: 0 0 86px; background: var(--tint); cursor: pointer; }
.has-open .project:not(.open):hover { background: color-mix(in oklab, var(--tint) 70%, var(--accent) 12%); }
.projects:not(.has-open) .project { cursor: pointer; }
.projects:not(.has-open) .project:hover { box-shadow: 0 24px 44px -28px rgba(40, 40, 90, .5); }

/* three faces: a card (none open), a strip (the other is open), the whole project (open) */
.p-card, .p-tab, .p-body { transition: opacity .35s; }
.p-card { position: absolute; inset: 0; min-width: 420px; padding: 30px 32px; display: flex; flex-direction: column; }
.has-open .p-card { opacity: 0; visibility: hidden; }
.p-tab { position: absolute; inset: 0 auto 0 0; width: 86px; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 0; opacity: 0; visibility: hidden; }
.has-open .project:not(.open) .p-tab { opacity: 1; visibility: visible; transition-delay: .35s; }
.p-body { flex: 1; min-width: 560px; overflow-y: auto; padding: 26px 34px 34px; scrollbar-width: thin; opacity: 0; visibility: hidden; }
.project.open .p-body { opacity: 1; visibility: visible; transition: opacity .5s .35s; }

.full .p-card-name { display: block; font: 600 clamp(36px, 3.6vw, 56px)/1 var(--serif); letter-spacing: -.02em; margin: 6px 0 10px; }
.p-card-line { color: var(--muted); max-width: 44ch; }
.hl { list-style: none; display: grid; gap: 6px; margin: 18px 0; font-weight: 500; }
.hl li { padding-left: 26px; position: relative; }
.hl li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--accent); color: #fff; }
.p-thumb {
  flex: 1; min-height: 0; width: 100%; object-fit: cover; object-position: top left;
  border-radius: 14px; border: 1px solid var(--line);
  box-shadow: 0 20px 36px -26px rgba(40, 30, 20, .6);
  transition: transform .7s var(--ease-out);
}
.project:hover .p-thumb { transform: translateY(-4px); }
.p-open { align-self: flex-start; margin-top: 18px; pointer-events: none; }
.p-back { font-size: 13px; font-weight: 500; color: var(--accent); margin-bottom: 14px; }
.p-back:hover { text-decoration: underline; }
.p-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; font: 600 15px var(--serif); }
.p-title { writing-mode: vertical-rl; transform: rotate(180deg); font: 600 22px var(--serif); white-space: nowrap; }
.full .p-name { display: block; font: 600 clamp(34px, 3.4vw, 52px)/1 var(--serif); letter-spacing: -.02em; margin: 6px 0 14px; }
.sub { font: 600 22px var(--serif); margin: 34px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.sub small { font: 13px var(--sans); color: var(--muted); }
.features h5 { font: 600 19px var(--serif); margin-bottom: 4px; }
.p-body .stats div, .p-body .features section { background: var(--tint); }

/* ---------- gallery + lightbox ---------- */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gallery .shot {
  position: relative; display: block; border-radius: 14px; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line);
  aspect-ratio: auto; cursor: zoom-in;
  box-shadow: 0 16px 30px -24px rgba(40, 30, 20, .6);
  transition: transform .5s var(--ease-out), box-shadow .5s;
}
.gallery .shot:hover { transform: translateY(-4px); box-shadow: 0 26px 40px -26px rgba(40, 30, 20, .7); }
.gallery .shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; transition: transform .8s var(--ease-out); }
.gallery .shot:hover img { transform: scale(1.03); }
.gallery .shot span {
  position: absolute; left: 10px; bottom: 10px; padding: 4px 11px; border-radius: 99px;
  background: color-mix(in oklab, var(--ink) 88%, transparent); color: var(--paper); font-size: 12px; font-weight: 500;
}
.gallery .wide { grid-column: span 2; }
.gallery .wide img { aspect-ratio: 16 / 8; }
.shop-gallery { grid-template-columns: 2fr 1fr; grid-template-areas: "a p" "b p" "c c"; }
.shop-gallery .wide { grid-area: a; grid-column: auto; }
.shop-gallery .phone { grid-area: p; }
.shop-gallery .phone img { aspect-ratio: auto; height: 100%; }
.shop-gallery .shot:nth-child(3) { grid-area: b; }
.shop-gallery .shot:nth-child(4) { grid-area: c; }
.shop-gallery .shot:nth-child(4) img { aspect-ratio: 16 / 7; }
.p-body .steps { margin-top: 28px; }

.lightbox {
  margin: auto; max-width: min(1400px, 94vw); max-height: 94vh; width: fit-content;
  border: 0; border-radius: 18px; padding: 0; background: transparent; overflow: visible;
}
.lightbox::backdrop { background: rgba(33, 28, 23, .78); backdrop-filter: blur(6px); }
.lightbox[open] { animation: pop .45s var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.lightbox figure { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox img { max-width: 94vw; max-height: 82vh; border-radius: 14px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .7); background: #fff; }
.lightbox figcaption { color: #fbf4ea; font-size: 15px; text-align: center; max-width: 70ch; }
.lightbox button {
  position: fixed; width: 48px; height: 48px; border-radius: 50%;
  background: var(--paper); color: var(--ink); font-size: 18px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
  transition: transform .3s var(--ease-out);
}
.lightbox button:hover { transform: scale(1.08); }
.lb-prev { left: 22px; top: 50%; margin-top: -24px; }
.lb-next { right: 22px; top: 50%; margin-top: -24px; }
.lb-close { right: 22px; top: 22px; }

/* ---------- tasks ---------- */
.big-count { margin-top: 18px; font-size: 15px; color: var(--muted); }
.big-count b { font: 600 56px/1 var(--serif); color: var(--accent); margin-right: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 18px; }
.filters button {
  height: 36px; padding: 0 16px; border-radius: 99px; font-size: 14px; font-weight: 500;
  background: var(--paper); border: 1px solid var(--line);
  transition: background .3s, color .3s, transform .3s var(--ease-out);
}
.filters button:hover { transform: translateY(-2px); }
.filters button.on { background: var(--accent); color: #fff; border-color: transparent; }
.tasks { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; grid-auto-flow: dense; }
.tasks li {
  display: flex; flex-direction: column; gap: 3px;
  padding: 18px 20px; border-radius: 18px; background: var(--paper);
  transition: transform .45s var(--ease-out), box-shadow .45s;
}
.tasks li:hover { transform: translateY(-3px); box-shadow: 0 18px 30px -22px rgba(70, 45, 20, .5); }
.tasks li[hidden] { display: none; }
.tasks b { font: 600 18px var(--serif); margin-top: 4px; }
.tasks li > span:not(.tag) { font-size: 14px; color: var(--muted); }
.tasks .tag { align-self: flex-start; }
.tasks .task-wide { grid-column: 1 / -1; }
.net { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; margin-top: 16px; align-items: stretch; }
.task-wide .topo { margin-top: 0; background: var(--tint); display: flex; flex-direction: column; justify-content: center; }
.nodes text.ip { font: 500 11px var(--sans); fill: var(--muted); }
.net-shots { grid-template-columns: 1fr 1fr; }
.net-shots .shot img { aspect-ratio: 5 / 4; object-position: left top; }
.task-wide .topo svg { max-height: 220px; }
.task-wide .nodes rect { fill: #fff; }

@media (max-width: 1100px) {
  .p-body { min-width: 0; }
  .gallery, .shop-gallery { grid-template-columns: 1fr; grid-template-areas: none; }
  .gallery .wide, .shop-gallery .wide, .shop-gallery .phone, .shop-gallery .shot:nth-child(3), .shop-gallery .shot:nth-child(4) { grid-column: auto; grid-area: auto; grid-row: auto; }
  .shop-gallery .phone img { height: auto; max-height: 520px; object-fit: contain; }
}
@media (max-width: 760px) {
  .open .projects-full.full { display: block; overflow: visible; }
  .projects { flex-direction: column; }
  .project, .has-open .project:not(.open) { flex: none; flex-direction: column; border-radius: 20px; }
  .p-card { position: static; min-width: 0; padding: 22px 18px; }
  .has-open .p-card { display: none; }
  .p-thumb { flex: none; aspect-ratio: 16 / 10; }
  .p-tab { position: static; width: auto; flex-direction: row; padding: 14px 16px; display: none; }
  .has-open .project:not(.open) .p-tab { display: flex; }
  .p-title { writing-mode: horizontal-tb; transform: none; font-size: 20px; }
  .project:not(.open) .p-body { display: none; }
  .p-body { min-width: 0; padding: 22px 18px; overflow: visible; }
  .peek { width: 70%; }
  [data-view="home"] #projekti { min-height: 420px; }
  .lb-prev, .lb-next { top: auto; bottom: 18px; margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*) { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
