html,body{height:100%;margin:0;font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;overflow:hidden;background:#050a08;color:#e8e8e8}
body{position:relative}

/* Controls — centered column at top */
#controls{
  position:absolute;
  top:0;
  left:50%;
  transform:translateX(-50%);
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:14px 20px 10px;
  z-index:2;
  pointer-events:none;
}
#controls > *{ pointer-events:auto; }

/* Wrapper fixes the width so the track below can span it cleanly */
#years-and-track{
  width:max-content;
  display:flex;
  flex-direction:column;
}

#years{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:6px;
}

/* Time track — thin bar below year buttons */
#time-track{
  width:100%;
  height:2px;
  background:rgba(58,125,82,0.10);
  border-radius:1px;
  position:relative;
  margin-top:8px;
  pointer-events:none;
  overflow:visible;
}
/* The always-moving shimmer — sweeps left to right forever */
#time-track::after{
  content:'';
  position:absolute;
  top:-1px;
  left:0;right:0;
  height:4px;
  border-radius:2px;
  background:linear-gradient(90deg,transparent 0%,rgba(122,200,140,0.38) 50%,transparent 100%);
  background-size:35% 100%;
  background-repeat:no-repeat;
  animation:time-sweep 3.5s linear infinite;
}
@keyframes time-sweep{
  0%  {background-position:-35% center}
  100%{background-position:135% center}
}
/* Current year cursor — glowing dot that transitions smoothly between years */
#time-cursor{
  position:absolute;
  top:50%;
  width:8px;
  height:8px;
  border-radius:50%;
  background:radial-gradient(circle,#9ae8b8 0%,#4a9e70 65%);
  transform:translate(-50%,-50%);
  /* left is driven entirely by JS — no CSS transition */
  animation:cursor-glow 2.4s ease-in-out infinite;
}
@keyframes cursor-glow{
  0%,100%{box-shadow:0 0 8px 2px rgba(92,168,122,0.65),0 0 16px rgba(92,168,122,0.25)}
  50%    {box-shadow:0 0 13px 3px rgba(122,200,140,0.9), 0 0 26px rgba(92,168,122,0.45)}
}

#years button{
  padding:6px 10px;
  border:none;
  background:transparent;
  color:#9ac8a8;
  cursor:pointer;
  font-weight:500;
  font-size:14px;
  letter-spacing:0.4px;
  opacity:0.18;
  transition:opacity 0.9s ease, color 0.9s ease, text-shadow 0.9s ease, font-weight 0.3s ease;
}
#years button.past{
  opacity:0.45;
  color:#8aab90;
}
#years button.active{
  opacity:1;
  color:#d4f0df;
  font-weight:600;
  text-shadow:0 0 14px rgba(92,168,122,0.5);
}

#playbar{
  margin-top:8px;
  display:flex;
  gap:8px;
  justify-content:center;
}
#playbar button{
  padding:7px 18px;
  background:#0c120e;
  color:#8aab90;
  border:1px solid #1e2e24;
  border-radius:6px;
  cursor:pointer;
  font-weight:600;
}

/* Visualization canvas */
#viz{width:100%;height:100vh;position:relative}
#vine-canvas{position:absolute;inset:0;pointer-events:none;z-index:0}
#viz svg{cursor:grab;position:relative;z-index:1}
/* Zoom group: a CSS transform during the gesture is GPU-composited (smooth pan) and,
   with view-box box+origin, numerically matches the SVG attribute transform. */
#viz svg g.zoom-root{transform-box:view-box;transform-origin:0 0}
#viz svg g.zoom-root.zooming{will-change:transform}
svg{width:100%;height:100%}

/* Botanical visualization elements */
.city-group{cursor:pointer}
.person-bud{cursor:pointer}
.city-petal{opacity:0.85}
.city-center{fill:#ffe8c8;opacity:0.9}
.seed-shape{opacity:0.9}
.visit-vine{fill:none;stroke-width:1;opacity:0.22;pointer-events:none}
.city-hit{fill:transparent;pointer-events:all}

/* Hover tooltip for flowers (cities) — matches the info-panel palette */
.city-tooltip{
  position:fixed; top:0; left:0;
  pointer-events:none;
  z-index:60;
  max-width:230px;
  padding:9px 12px;
  background:rgba(4,14,8,0.97);
  border:1px solid #1a3a28;
  border-radius:8px;
  box-shadow:0 8px 26px rgba(0,0,0,0.55);
  font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
  color:#d8eddf;
  opacity:0;
  transform:translateY(2px);
  transition:opacity 0.14s ease, transform 0.14s ease;
}
.city-tooltip.show{opacity:1;transform:translateY(0)}
.city-tooltip .tt-city{display:block;font-size:14px;font-weight:700;color:#fff;line-height:1.3}
.city-tooltip .tt-country{display:block;font-size:12px;color:#7ecf9e;margin-top:1px}
.city-tooltip .tt-counts{display:block;font-size:12px;color:#9fc7ab;margin-top:4px}
.city-tooltip .tt-hint{
  display:block;margin-top:6px;padding-top:5px;
  border-top:1px solid #14271a;
  font-size:10px;color:#3d6448;text-transform:uppercase;letter-spacing:0.6px;
}

/* Info dot — top-left, opens sidebar */
#info-dot{
  position:fixed;
  top:50%;
  left:16px;
  transform:translateY(-50%);
  width:48px;
  height:48px;
  border-radius:50%;
  background:rgba(5,18,10,0.9);
  border:1px solid #2a4a38;
  color:#7ecf9e;
  font-size:20px;
  font-family:'Segoe UI',sans-serif;
  cursor:pointer;
  z-index:20;
  display:flex;
  align-items:center;
  justify-content:center;
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  box-shadow:0 0 18px rgba(46,125,82,0.18);
  transition:border-color 0.3s,box-shadow 0.3s,background 0.3s;
  line-height:1;
}
#info-dot:not(.open){
  animation:dot-pulse 3.5s ease-in-out infinite;
}
@keyframes dot-pulse{
  0%,100%{box-shadow:0 0 18px rgba(46,125,82,0.18)}
  50%{box-shadow:0 0 28px rgba(58,125,82,0.55),0 0 0 5px rgba(58,125,82,0.12)}
}
#info-dot.open{
  background:rgba(30,60,42,0.92);
  border-color:#3a7d52;
  box-shadow:0 0 26px rgba(58,125,82,0.38);
  font-size:22px;
  animation:none;
}

/* Home link — top-left, on top of the sidebar: when the menu opens it stacks
   above the title (with a divider); when closed it stays put at the same spot. */
.home-link{
  position:fixed;
  top:15px; left:16px;                     /* same spot whether the menu is open or closed (never moves) */
  z-index:30;                              /* above sidebar (10) so it shows over the open header; below intro overlay (200) */
  display:inline-flex; align-items:center;
  font-family:'Segoe UI',sans-serif;
  font-size:11px; font-weight:600; letter-spacing:0.02em;
  color:rgba(158,168,162,0.72);            /* muted neutral gray — marks this as a "leave the viz" link, distinct from the green data elements; faint green hint keeps it in-theme */
  text-decoration:none;
  text-shadow:0 1px 6px rgba(0,0,0,0.6);   /* legible over both the dark header and the viz */
  white-space:nowrap;
  transition:color .15s ease;
  pointer-events:auto;
}
.home-link:hover{ color:rgba(205,214,209,0.95); }

/* Info panel — right side panel */
.info-panel{
  position:fixed;
  top:0;right:0;bottom:0;
  width:300px;
  background:rgba(4,14,8,0.97);
  border-left:1px solid #1a3a28;
  backdrop-filter:blur(20px);
  -webkit-backdrop-filter:blur(20px);
  z-index:50;
  transform:translateX(100%);
  transition:transform 0.35s cubic-bezier(0.16,1,0.3,1);
  box-shadow:-4px 0 30px rgba(0,0,0,0.5);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.info-panel.visible{transform:translateX(0)}

.panel-nav-btn{
  background:none;
  border:1px solid #1e3524;
  color:#6a9a74;
  border-radius:6px;
  padding:5px 12px;
  font-size:13px;
  cursor:pointer;
  transition:border-color 0.2s,color 0.2s;
  line-height:1;
  font-family:'Segoe UI',sans-serif;
}
.panel-nav-btn:hover{border-color:#2e5a3e;color:#9acea4}
.panel-nav-btn.hidden{visibility:hidden;pointer-events:none}

#panel-close{
  position:absolute;
  top:14px; right:14px;             /* × pinned to the panel's top-right corner */
  z-index:2;
}
/* Veliki NAZAD — samo mobilno (otkriva ga @media blok na dnu); na desktopu ne postoji. */
#panel-nazad{ display:none; }
#info-panel-content{
  font-size:14px;
  line-height:1.6;
  color:#d8eddf;
  padding:46px 16px 16px;           /* 46px top drops the city name to the same height as the left title */
  overflow-y:auto;
  flex:1;
}
#info-panel-content::-webkit-scrollbar{width:4px}
#info-panel-content::-webkit-scrollbar-track{background:transparent}
#info-panel-content::-webkit-scrollbar-thumb{background:#1a2e20;border-radius:2px}

.panel-main{margin-bottom:14px}
.panel-main strong{font-size:17px;color:#fff;font-weight:700;display:block;margin-bottom:3px}
.panel-subtitle{font-size:13px;color:#7ecf9e;display:block;margin-bottom:1px}
.panel-section-title{
  font-size:11px;color:#3d6448;text-transform:uppercase;
  letter-spacing:0.8px;margin:14px 0 6px;font-weight:600;
}
.panel-list-item{
  display:flex;align-items:center;gap:8px;
  padding:6px 4px;border-radius:4px;
  border-bottom:1px solid #0c1c10;
  cursor:pointer;
  transition:background 0.15s;
}
.panel-list-item:last-child{border-bottom:none}
.panel-list-item:hover{background:rgba(58,125,82,0.1)}
.panel-item-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}
.panel-item-name{flex:1;color:#b0c8b4;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.panel-item-count{color:#4a7a54;font-size:11px;font-family:monospace;flex-shrink:0}
.panel-return-btn{
  display:flex; align-items:center; gap:8px;
  margin-top:16px; padding:10px 12px;
  border:1px solid #2a4a38; border-radius:8px;
  background:rgba(20,40,28,0.5); color:#9acea4;
  font-size:13px; font-weight:600; cursor:pointer;
  transition:background .15s ease, border-color .15s ease, color .15s ease;
}
.panel-return-btn:hover{ background:rgba(46,90,62,0.5); border-color:#3a7d52; color:#d4f0df; }

.panel-faculty-group{margin-bottom:10px}
.panel-faculty-header{
  display:flex;align-items:center;gap:6px;
  padding:4px 0 3px;
  border-bottom:1px solid #152a1e;
  margin-bottom:2px;
}
.panel-faculty-name{font-size:11px;color:#5a8a64;font-weight:600;letter-spacing:0.3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.panel-faculty-group .panel-list-item{padding-left:8px}

/* Hide info-dot when sidebar is open (sidebar header × takes over) */
#sidebar:not(.collapsed) ~ #info-dot{
  opacity:0;
  pointer-events:none;
  transition:opacity 0.3s;
}

/* Sidebar — slides in from left, hidden by default */
.sidebar{
  position:absolute;
  top:0;left:0;bottom:0;
  width:340px;
  background:rgba(8,18,12,0.88);
  border-right:1px solid #1a2e20;
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
  z-index:10;
  box-shadow:5px 0 25px rgba(0,0,0,0.5);
  transition:transform 0.45s cubic-bezier(0.16,1,0.3,1);
  box-sizing:border-box;
  display:flex;
  flex-direction:column;
}
.sidebar.collapsed{transform:translateX(-100%)}

.sidebar-header{
  display:flex;
  align-items:center;
  justify-content:flex-start;       /* title sits at the left (× is absolute, in the corner) */
  padding:46px 16px 10px;           /* tall top reserves the band above the title where the fixed home link sits */
  flex-shrink:0;
}
#sidebar-close{
  position:absolute;
  top:14px; right:14px;             /* × pinned to the sidebar's top-right corner */
  z-index:2;
}
.sidebar-title{
  font-size:16px;
  font-weight:700;
  color:#d0e8d4;
  letter-spacing:0.4px;
}

.sidebar-content{
  display:flex;
  flex-direction:column;
  flex:1;
  padding:16px 24px 20px 16px;      /* left 16 aligns the section headers with the title/home link */
  box-sizing:border-box;
  overflow:hidden;
}
.sidebar-section{
  display:flex;
  flex-direction:column;
  margin-bottom:20px;
  min-height:0;
  flex:1;
}
.sidebar-section:nth-child(2){flex:1.2}
.sidebar-section:nth-child(3){flex:1.4}
.sidebar-section:nth-child(4){flex:1.4}
.sidebar-section h3{
  font-size:14px;
  margin:0 0 8px 0;
  color:#5a7a60;
  text-transform:uppercase;
  letter-spacing:0.8px;
  font-weight:600;
}

.search-container{margin-bottom:8px}
.search-input{
  width:100%;
  padding:8px 12px;
  border-radius:6px;
  border:1px solid #1a2e20;
  background:#080f0a;
  color:#c8d5c0;
  font-size:12px;
  box-sizing:border-box;
  transition:border-color 0.2s,box-shadow 0.2s;
}
.search-input:focus{
  outline:none;
  border-color:#2e5a3e;
  box-shadow:0 0 0 2px rgba(46,90,62,0.3);
}

.legend-list,.stats-list{
  flex:1;
  overflow-y:auto;
  border:1px solid #1a2e20;
  border-radius:6px;
  background:rgba(4,10,6,0.6);
  padding:8px;
}
.legend-list{display:flex;flex-direction:column;gap:8px}

.legend-item{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:12px;
  color:#b0c8b4;
  padding:6px;
  border-radius:4px;
  cursor:pointer;
}
.legend-color{width:10px;height:10px;border-radius:50%;flex-shrink:0;box-shadow:0 0 5px rgba(0,0,0,0.5)}/* unused — replaced by svg flower */
.legend-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.stats-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:6px 10px;
  border-radius:4px;
  font-size:12px;
  margin-bottom:4px;
  cursor:pointer;
}
.stats-item-left{display:flex;align-items:center;gap:8px;min-width:0}
.stats-dot{width:6px;height:6px;border-radius:50%;flex-shrink:0}
.stats-name{color:#b0c8b4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stats-count{
  background:#0c180f;
  border:1px solid #1e3524;
  padding:2px 6px;
  border-radius:10px;
  font-size:11px;
  color:#6a9a74;
  font-weight:600;
  font-family:monospace;
  flex-shrink:0;
}

.legend-item.pinned{
  background:rgba(58,125,82,0.15);
  border-radius:4px;
  box-shadow:inset 0 0 0 1px rgba(58,125,82,0.35);
}
.stats-item.pinned{
  background:rgba(46,90,62,0.3);
  border:1px solid #2e5a3e;
}

/* Intro overlay — scrim behind the card */
#intro-overlay{
  position:fixed;
  inset:0;
  background:rgba(3,8,5,0.55);
  backdrop-filter:blur(3px);
  -webkit-backdrop-filter:blur(3px);
  z-index:200;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:opacity 0.6s cubic-bezier(0.4,0,0.2,1);
}
#intro-overlay.fade-out{
  opacity:0;
  pointer-events:none;
}
/* The card itself */
#intro-content{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:20px;
  width:360px;
  text-align:center;
  padding:36px 32px 32px;
  background:rgba(6,16,10,0.92);
  border:1px solid #1e3a28;
  border-radius:18px;
  box-shadow:0 8px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(58,125,82,0.08);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
#intro-flower{
  width:160px;
  height:160px;
  filter:drop-shadow(0 0 22px rgba(92,168,122,0.45));
}
#intro-title{
  margin:0;
  font-size:32px;
  font-weight:700;
  color:#d4f0df;
  letter-spacing:1px;
}
#intro-desc{
  margin:0;
  font-size:15px;
  line-height:1.7;
  color:#7a9e84;
}
#intro-play{
  margin-top:6px;
  padding:13px 42px;
  background:rgba(30,60,42,0.6);
  border:1px solid #2e5a3e;
  border-radius:8px;
  color:#d4f0df;
  font-size:16px;
  font-weight:600;
  cursor:pointer;
  letter-spacing:0.8px;
  transition:background 0.3s,box-shadow 0.3s,border-color 0.3s;
}
#intro-play:hover{
  background:rgba(46,90,62,0.7);
  border-color:#4a9e6a;
  box-shadow:0 0 24px rgba(58,125,82,0.35);
}

/* Scrollbars */
.legend-list::-webkit-scrollbar,
.stats-list::-webkit-scrollbar,
.sidebar-content::-webkit-scrollbar{width:6px;height:6px}
.legend-list::-webkit-scrollbar-track,
.stats-list::-webkit-scrollbar-track,
.sidebar-content::-webkit-scrollbar-track{background:transparent}
.legend-list::-webkit-scrollbar-thumb,
.stats-list::-webkit-scrollbar-thumb,
.sidebar-content::-webkit-scrollbar-thumb{background:#1a2e20;border-radius:3px}

/* ============================================================
   4K (3840×2160) — the flower art scales via the SVG viewBox,
   but the HTML chrome is authored in fixed px and stays tiny on
   a 4K screen. Scale it up (~1.9×) so panels/controls/text read.
   Scoped to ena_zita only.
   ============================================================ */
@media (min-width: 2560px){
  /* Top controls — year buttons + timeline */
  #controls{padding:28px 40px 20px}
  #years{gap:12px}
  #years button{padding:12px 20px;font-size:27px;letter-spacing:0.8px}
  #time-track{height:4px;margin-top:16px}
  #time-track::after{height:8px}
  #time-cursor{width:16px;height:16px}
  #playbar{margin-top:16px;gap:16px}
  #playbar button{padding:14px 36px;font-size:24px;border-radius:12px}

  /* Info dot */
  #info-dot{top:50%;left:30px;width:92px;height:92px;font-size:40px;border-width:2px}
  #info-dot.open{font-size:44px}

  /* Home link */
  .home-link{top:28px;left:30px;font-size:20px}

  /* Right info panel */
  .info-panel{width:560px}
  .panel-nav-btn{padding:10px 22px;font-size:24px;border-radius:10px}
  #panel-close{top:26px;right:26px}
  #info-panel-content{font-size:26px;padding:88px 30px 30px}
  .panel-main strong{font-size:32px}
  .panel-subtitle{font-size:24px}
  .panel-section-title{font-size:20px;letter-spacing:1.4px;margin:26px 0 12px}
  .panel-list-item{gap:14px;padding:12px 8px}
  .panel-item-dot{width:14px;height:14px}
  .panel-item-name{font-size:22px}
  .panel-item-count{font-size:20px}
  .panel-faculty-name{font-size:20px}
  .panel-return-btn{padding:18px 20px;font-size:22px;margin-top:28px;border-radius:12px}

  /* Left sidebar */
  .sidebar{width:620px}
  .sidebar-header{padding:88px 30px 18px}
  #sidebar-close{top:26px;right:26px}
  .sidebar-title{font-size:30px}
  .sidebar-content{padding:30px 44px 36px 30px}
  .sidebar-section{margin-bottom:36px}
  .sidebar-section h3{font-size:24px;margin:0 0 14px 0;letter-spacing:1.4px}
  .search-input{padding:15px 22px;font-size:22px;border-radius:10px}
  .legend-list,.stats-list{padding:14px;border-radius:10px}
  .legend-item{gap:18px;font-size:22px;padding:12px}
  .stats-item{padding:12px 18px;font-size:22px;margin-bottom:8px}
  .stats-dot{width:11px;height:11px}
  .stats-count{padding:4px 12px;font-size:20px;border-radius:18px}

  /* Intro overlay card */
  #intro-content{gap:36px;width:680px;padding:68px 60px 60px;border-radius:32px}
  #intro-flower{width:300px;height:300px}
  #intro-title{font-size:60px;letter-spacing:2px}
  #intro-desc{font-size:28px}
  #intro-play{margin-top:12px;padding:24px 78px;font-size:30px;border-radius:14px}

  /* Wider scrollbars so they're grabbable */
  .legend-list::-webkit-scrollbar,
  .stats-list::-webkit-scrollbar,
  .sidebar-content::-webkit-scrollbar{width:11px;height:11px}
  #info-panel-content::-webkit-scrollbar{width:8px}
}

/* ============================================================
   Mobiteli (≤640px široko, ili ≤480px visoko u landscapeu).
   Držati medijski upit doslovno jednak MOBILE_MQ u viz.js.
   Oba izbornika su preko cijelog ekrana i otvaraju se S LIJEVA;
   panel ima veliki NAZAD (× je skriven); tooltip se sidri na
   fiksna mjesta (mreza/kompas uzorak).
   ============================================================ */
@media (max-width: 640px), (max-height: 480px) {
  /* Vremenska traka ispod home-linka (fixed top:15px, 11px) — bez preklapanja. */
  #controls{top:34px;max-width:100vw}
  #years button{font-size:12px;padding:5px 8px}
  #playbar button{font-size:12px;padding:6px 14px}

  /* Oba izbornika: cijeli ekran, s lijeva. */
  .sidebar{width:100vw}
  .info-panel{
    left:0;right:auto;width:100vw;
    border-left:none;border-right:1px solid #1a3a28;
    transform:translateX(-100%);
  }
  .info-panel.visible{transform:translateX(0)}

  /* Veliki NAZAD na vrhu panela; mali × skriven (NAZAD je jedini, očiti izlaz). */
  #panel-close{display:none}
  #panel-nazad{
    display:flex;align-items:center;justify-content:center;gap:8px;
    margin:12px 14px 0;padding:14px;
    border:1px solid #2a4a38;border-radius:10px;
    background:rgba(20,40,28,0.6);color:#9acea4;
    font-size:16px;font-weight:700;letter-spacing:0.5px;
    cursor:pointer;font-family:'Segoe UI',sans-serif;
    -webkit-tap-highlight-color:transparent;
  }
  #panel-nazad:active{background:rgba(46,90,62,0.5);border-color:#3a7d52;color:#d4f0df}
  #info-panel-content{padding-top:14px}

  /* Tooltip: usidren na jedno od dva FIKSNA mjesta (vrh/dno), centriran — čisti CSS. */
  #city-tooltip.dock-top,
  #city-tooltip.dock-bottom{
    left:8px;right:8px;
    width:max-content;
    max-width:min(320px, calc(100vw - 16px));
    margin:0 auto;
  }
  #city-tooltip.dock-top{top:156px;bottom:auto}     /* ispod cijelog bloka kontrola (godine + traka + gumbi) */
  #city-tooltip.dock-bottom{top:auto;bottom:12px}

  /* Uvodna kartica ne smije biti šira od ekrana (fiksnih 360px + content-box padding). */
  #intro-content{box-sizing:border-box;width:min(424px, 92vw)}
}
