/* =================================================================
   Karlo  -  personal site
   Stripped clean: b-roll wallpaper + minimal text. No chrome.
   Click About me / For you -> blurred reveal of clean content.
   Inspiration: kosta.fyi, benji.org, grizz.fyi, ja.mt - restraint,
   one column, hairlines, whitespace, a live local-time detail.
   ================================================================= */

:root {
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --ink:   rgba(255, 255, 255, 0.94);
  --dim:   rgba(255, 255, 255, 0.52);
  --faint: rgba(255, 255, 255, 0.30);
  --hair:  rgba(255, 255, 255, 0.12);
  --accent:#E0796B;   /* warm, scarce */

  --edge: clamp(22px, 4.5vw, 52px);
  --ease: cubic-bezier(0.25, 0.10, 0.25, 1.00);
  --spring: cubic-bezier(0.34, 1.40, 0.64, 1.00);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #0a0908; color: var(--ink);
  font-family: var(--sans); -webkit-font-smoothing: antialiased; font-size: 16px; }
body { height: 100dvh; position: relative; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:focus-visible { outline: 1.5px solid rgba(255,255,255,0.6); outline-offset: 4px; border-radius: 3px; }

/* =================================================================
   WALLPAPER
   ================================================================= */
.wall { position: fixed; inset: 0; z-index: 0; overflow: hidden;
  animation: settle 1.6s var(--ease) both; }
/* the b-roll sits ABOVE the placeholder gradient and fades in once it actually plays */
.wall__video { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.2s var(--ease); will-change: opacity; }
.wall__video.is-live { opacity: 1; }
.wall__fallback {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(120% 90% at 78% 64%, rgba(192,70,59,0.42), transparent 55%),
    radial-gradient(90% 80% at 20% 12%, rgba(60,40,38,0.45), transparent 60%),
    linear-gradient(180deg, #120d0c 0%, #0a0807 60%, #080606 100%);
  animation: drift 22s ease-in-out infinite alternate;
}
body[data-mood="afternoon"] .wall__fallback {
  background: radial-gradient(120% 90% at 80% 30%, rgba(196,128,72,0.40), transparent 55%),
    radial-gradient(90% 90% at 18% 80%, rgba(46,58,96,0.45), transparent 60%),
    linear-gradient(180deg, #15110d 0%, #0c0a0a 60%, #08080a 100%); }
body[data-mood="morning"] .wall__fallback {
  background: radial-gradient(120% 100% at 70% 20%, rgba(150,168,186,0.30), transparent 58%),
    radial-gradient(90% 90% at 15% 85%, rgba(70,78,86,0.40), transparent 60%),
    linear-gradient(180deg, #16181b 0%, #0e0f11 60%, #0a0b0c 100%); }
.wall__grain { position: absolute; inset: -50%; z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.045; mix-blend-mode: overlay; pointer-events: none; }
/* legibility scrim - keeps minimal text clean over any frame */
.wall__scrim { position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(180deg, rgba(8,7,6,0.5) 0%, transparent 30%, transparent 62%, rgba(8,7,6,0.62) 100%); }

@keyframes drift { from { transform: scale(1.04) translate(-1%,-1%);} to { transform: scale(1.10) translate(1.5%,1%);} }
@keyframes settle { from { opacity: 0.55; transform: scale(1.05);} to { opacity: 1; transform: none;} }
@keyframes rise { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none;} }

/* =================================================================
   RESTING SCREEN
   ================================================================= */
.screen { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column;
  align-items: center; padding: var(--edge); }

/* resting top: name + a small live Croatia clock, centred */
.id__name { font-size: clamp(21px, 2.3vw, 27px); font-weight: 500; letter-spacing: -0.015em;
  animation: rise .9s var(--ease) both; animation-delay: .25s; }
.clock { margin-top: 9px; font-size: clamp(12px, 1.25vw, 14px); color: var(--dim);
  letter-spacing: 0.14em; font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
  animation: rise .9s var(--ease) both; animation-delay: .4s; }
/* socials live inside About me now (under the lede) */
.socials { display: flex; gap: 16px; margin-top: 16px; font-size: 13px; }
.socials a { color: var(--dim); transition: color .2s var(--ease); }
.socials a:hover { color: var(--ink); }

/* name + clock grouped at the top */
.id { display: flex; flex-direction: column; align-items: center; }
/* links + player grouped at the bottom (links sit just above the widget) */
.foot { margin-top: auto; display: flex; flex-direction: column; align-items: center;
  gap: clamp(16px, 2.6vh, 24px); width: 100%; }
.links { display: flex; align-items: center; gap: 18px;
  animation: rise .9s var(--ease) both; animation-delay: .45s; }
.link { font-size: clamp(15px, 1.6vw, 17px); color: var(--ink); letter-spacing: 0.005em;
  transition: color .25s var(--ease); position: relative; padding: 2px 0; }
.link::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: center; transition: transform .3s var(--ease); }
.link:hover::after, .link[aria-expanded="true"]::after { transform: scaleX(1); }
.links__div { width: 1px; height: 15px; background: var(--hair); }

/* spotify widget - bottom-centre, just under the links */
.player { width: 100%; max-width: 280px;
  animation: rise .9s var(--ease) both; animation-delay: .6s; }
.player__embed { display: block; width: 100%; height: 80px; border: 0; border-radius: 12px; }

/* =================================================================
   OVERLAY  -  blurred reveal
   ================================================================= */
.overlay {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  padding: clamp(40px, 7vh, 90px) var(--edge);
  opacity: 0; visibility: hidden;
  background: rgba(8, 7, 6, 0.0);
  backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px);
  transition: opacity .45s var(--ease), background .45s var(--ease), backdrop-filter .45s var(--ease), visibility .45s;
}
body.open .overlay {
  opacity: 1; visibility: visible;
  background: rgba(8, 7, 6, 0.55);
  backdrop-filter: blur(22px) saturate(1.1); -webkit-backdrop-filter: blur(22px) saturate(1.1);
}
/* "back" control: arrow + word, dim text, brightens on hover. Shared look for
   the panel-list close and the year-view back. */
.overlay__close, .yearwrap__back {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; white-space: nowrap;
  border: 0; background: none; cursor: pointer; padding: 0;
  font: inherit; font-size: 14px; line-height: 1; letter-spacing: 0.01em; color: var(--dim);
  transition: color .2s var(--ease);
}
.overlay__close::before, .yearwrap__back::before { content: "\2190"; font-size: 16px; line-height: 1; }
.overlay__close:hover, .yearwrap__back:hover { color: var(--ink); }

/* list view: "Back" sits on the title's row, pushed to the column's right edge.
   Inherits the sheet's show/hide (opacity + pointer-events), so no toggle needed. */
.sheet__titlerow { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

/* year view: "Back" fixed at the column's top-right; stays put as the story scrolls.
   Kept out of .overlay so its backdrop-filter doesn't trap the fixed positioning. */
.yearwrap__back {
  position: fixed; z-index: 50;
  top: clamp(44px, 8vh, 88px); right: max(var(--edge), calc((100vw - 620px) / 2));
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: color .2s var(--ease), opacity .3s var(--ease), visibility .3s;
}
body.year-open .yearwrap__back { opacity: 1; visibility: visible; pointer-events: auto; }

.sheet {
  grid-area: 1 / 1;            /* both sheets share one cell, centered, overlap */
  width: min(620px, 100vw - 2 * var(--edge));   /* definite width -> never overflows the viewport */
  overflow: visible;          /* NO clipping - photo stacks fan out beyond the list */
  opacity: 0; transform: translateY(12px);
  transition: opacity .4s var(--ease), transform .5s var(--ease);
  pointer-events: none;
}
.sheet.is-open { opacity: 1; transform: none; pointer-events: auto; }
/* For you can get tall - let it scroll (About stays overflow:visible for the fan) */
.sheet[data-panel="for-you"] { overflow-y: auto; overflow-x: hidden; max-height: calc(100dvh - 170px);
  scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }

.sheet__head { margin-bottom: clamp(22px, 4vh, 38px); }
.sheet__title { font-size: clamp(22px, 3vw, 28px); font-weight: 500; letter-spacing: -0.02em; }
.sheet__lede { margin-top: 8px; font-size: 14px; color: var(--dim); line-height: 1.5; }
/* About: role line (his title) + a short bio under it */
.sheet__role { margin-top: 8px; font-size: 15px; color: var(--ink); letter-spacing: -0.005em; }
.sheet__bio { margin-top: 11px; font-size: 14px; color: var(--dim); line-height: 1.7; }

/* ---- About: list of years (ja.mt-style) ---- */
.years { position: relative; }
.yr { position: relative; z-index: 1; width: 100%; display: grid; grid-template-columns: 70px 1fr auto;
  align-items: center; gap: 18px; padding: 14px 0; border-top: 1px solid var(--hair); text-align: left;
  transition: filter .3s var(--ease), opacity .3s var(--ease); }
.yr:last-child { border-bottom: 1px solid var(--hair); }

/* photo stack thumbnail - a little pile that fans open + grows on hover */
.yr__stack { position: relative; width: 64px; height: 52px;
  transform-origin: 50% 55%; transition: transform .5s var(--spring); }
.yr__photo { position: absolute; inset: 0; padding: 4px; background: #fbfaf7; border-radius: 6px;
  box-shadow: 0 6px 16px -5px rgba(0,0,0,.55);
  transition: transform .5s var(--spring), box-shadow .4s var(--ease); }
.yr__photo .ph { width: 100%; height: 100%; border-radius: 3px; }
.yr__photo img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.yr__photo:nth-child(1) { transform: rotate(-6deg) translate(-2px, 2px); z-index: 1; }
.yr__photo:nth-child(2) { transform: rotate(5deg) translate(2px, 0); z-index: 2; }
.yr__photo:nth-child(3) { transform: rotate(-1deg); z-index: 3; }
.yr:hover .yr__stack { transform: scale(1.1); }
.yr:hover .yr__photo:nth-child(1) { transform: rotate(-12deg) translate(-9px, -2px); box-shadow: 0 10px 22px -6px rgba(0,0,0,.55); }
.yr:hover .yr__photo:nth-child(2) { transform: rotate(9deg) translate(9px, -1px); box-shadow: 0 10px 22px -6px rgba(0,0,0,.55); }
.yr:hover .yr__photo:nth-child(3) { transform: rotate(-2deg) translate(0, -4px); box-shadow: 0 12px 24px -6px rgba(0,0,0,.6); }

.yr__title { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink); }
.yr__date { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
/* current year: same gray date as the rest, plus a live "now" dot */
.yr--now .yr__date::before { content: ""; display: inline-block; width: 7px; height: 7px;
  margin-right: 7px; border-radius: 50%; background: #30d158; vertical-align: middle;
  box-shadow: 0 0 0 0 rgba(48,209,88,0.5); animation: livepulse 2.2s ease-out infinite; }
@keyframes livepulse {
  0%   { box-shadow: 0 0 0 0 rgba(48,209,88,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(48,209,88,0); }
  100% { box-shadow: 0 0 0 0 rgba(48,209,88,0); }
}

/* hover one row -> blur the rest (and the header) */
.years:hover .yr { filter: blur(2.5px); opacity: .42; }
.years:hover .yr:hover { filter: none; opacity: 1; z-index: 20; }
.sheet:has(.years:hover) .sheet__head { filter: blur(2.5px); opacity: .5;
  transition: filter .3s var(--ease), opacity .3s var(--ease); }

/* placeholder fill (thumbs, heroes) */
.ph { background: linear-gradient(160deg, #d9d4cb, #b7b1a6); color: #837c70;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; }

/* ---- year view: opens with the photo zooming in to lead ---- */
.yearwrap { position: absolute; inset: 0; z-index: 6; overflow-y: auto;
  padding: clamp(44px, 8vh, 88px) var(--edge) 80px;
  opacity: 0; visibility: hidden; transition: opacity .35s var(--ease), visibility .35s;
  scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
.yearwrap.is-open { opacity: 1; visibility: visible; }
/* hide the list behind the open year view */
body.year-open .sheet { opacity: 0 !important; pointer-events: none; transition: opacity .3s var(--ease); }
.yearview { max-width: 620px; margin: 0 auto; display: none; }
.yearview.is-active { display: block; animation: yvUp .45s var(--ease) both; }
@keyframes yvUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
.yearview__title { font-size: clamp(24px, 3.4vw, 32px); font-weight: 500; letter-spacing: -0.02em; }
.yearview__date { margin-top: 6px; font-size: 14px; color: var(--dim); }
.yearview__story { margin-top: clamp(20px, 3vh, 30px); }
.yearview__story p { font-size: 15px; line-height: 1.65; color: rgba(255,255,255,0.78); }
.yearview__story a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--faint); transition: text-decoration-color .2s var(--ease); }
.yearview__story a:hover { text-decoration-color: var(--ink); }
.yearview__story > * + * { margin-top: 1.05em; }
.yearview__story .slist { list-style: none; padding-left: 18px; border-left: 2px solid var(--hair);
  display: flex; flex-direction: column; gap: 7px; }
.yearview__story .slist li { font-size: 15px; line-height: 1.5; color: rgba(255,255,255,0.84); }
.yearview__story p.yearview__quote { font-size: clamp(17px, 2.2vw, 21px); line-height: 1.45;
  color: var(--ink); letter-spacing: -0.01em; }
.yearview__story p.yearview__sep { text-align: center; color: var(--faint); letter-spacing: 0.3em; margin-top: 1.6em; }
.yearview__story .yearview__sig { margin-top: 2.4em; font-size: 12.5px; color: var(--faint); letter-spacing: 0.02em; }

/* "up next" - just the year + a down arrow, centred. e.g. "2025 v" */
.yv-next { display: block; width: 100%; margin-top: clamp(44px, 7vh, 70px); text-align: center; }
.yv-next__k, .yv-next__t { display: none; }
.yv-next__row { display: flex; justify-content: center; align-items: center; gap: 9px; }
.yv-next__y { font-size: 14px; font-weight: 400; color: var(--dim); letter-spacing: 0.01em; transition: color .2s var(--ease); }
.yv-next__a { font-size: 16px; color: var(--faint); transition: transform .25s var(--spring), color .2s var(--ease); }
.yv-next:hover .yv-next__y { color: var(--ink); }
.yv-next:hover .yv-next__a { transform: translateY(4px); color: var(--ink); }

/* ---- annotated text -> photo popup (kosta.fyi-style) ---- */
.annot { position: relative; cursor: pointer; color: var(--ink);
  text-decoration: underline; text-decoration-style: dotted; text-decoration-color: rgba(255,255,255,0.45);
  text-underline-offset: 3px; transition: text-decoration-color .2s var(--ease); border-radius: 2px; }
.annot:hover, .annot:focus-visible { text-decoration-color: var(--ink); outline: none; }
.annot__cards { display: none; }   /* source markup - rendered in #pop by JS */

#pop { position: fixed; z-index: 60; display: flex; align-items: flex-end; pointer-events: none;
  opacity: 0; transform: translateY(8px) scale(0.96); transform-origin: center bottom;
  transition: opacity .18s var(--ease), transform .3s var(--spring); }
#pop.show { opacity: 1; transform: none; }
.pcard { display: block; padding: 6px; background: #fbfaf7; border-radius: 9px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06), 0 18px 38px -10px rgba(0,0,0,0.6); transform: rotate(var(--r, 0deg)); }
.pcard + .pcard { margin-left: -48px; }
.pcard img, .pcard__ph { display: block; width: 150px; height: 186px; object-fit: cover; border-radius: 4px; }
.pcard__ph { background: linear-gradient(160deg, #d9d4cb, #b7b1a6); color: #837c70;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; }

/* slideshow popup (e.g. student wins from Discord) - cards cross-fade in place */
#pop.is-slides { display: grid; }
#pop.is-slides .pcard { grid-area: 1 / 1; margin: 0; opacity: 0; z-index: 0;
  transform: rotate(var(--r, 0deg)) scale(.96);
  transition: opacity .55s var(--ease), transform .6s var(--ease); }
#pop.is-slides .pcard.is-top { opacity: 1; z-index: 2; transform: rotate(var(--r, 0deg)) scale(1); }
#pop.is-slides .pcard__ph, #pop.is-slides .pcard img { width: 230px; height: 150px; }

/* ---- For you ---- */
.fy { display: flex; flex-direction: column; gap: clamp(20px, 3.2vh, 30px); }
.fy__label { font-size: 12px; color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }

/* free game: two compact article cards (icon + headline, the hook) */
.fy__cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.art { display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: 14px;
  padding: 13px 15px; border-radius: 14px;
  background: rgba(255,255,255,0.03); box-shadow: inset 0 0 0 1px var(--hair);
  transition: background .25s var(--ease), box-shadow .25s var(--ease); }
.art:hover { background: rgba(255,255,255,0.055); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16); }
.art__icon { width: 50px; height: 50px; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--hair); }
.art__icon .ph { width: 100%; height: 100%; }
.art__body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.art__for { font-size: 12px; color: var(--dim); line-height: 1.3; }
.art__title { font-size: 14px; font-weight: 600; line-height: 1.32; letter-spacing: -0.01em; color: var(--ink); }

/* destinations: icon rows */
.dest { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--hair); }
.fy__sec .dest:last-child { border-bottom: 1px solid var(--hair); }
.dest__icon { width: 44px; height: 44px; border-radius: 11px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--hair); }
.dest__icon .ph { width: 100%; height: 100%; }
.art__icon img, .dest__icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dest__main { min-width: 0; }
.dest__top { display: flex; align-items: center; gap: 10px; }
.dest__title { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; color: var(--ink);
  background-image: linear-gradient(var(--ink), var(--ink)); background-size: 0% 1px;
  background-repeat: no-repeat; background-position: 0 1.25em; transition: background-size .3s var(--ease); }
.dest:hover .dest__title { background-size: 100% 1px; }
.dest__tag { flex: 0 0 auto; font-size: 11px; color: var(--dim); padding: 2px 9px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--hair); white-space: nowrap; }
.dest__note { display: block; margin-top: 3px; font-size: 13.5px; line-height: 1.5; color: var(--dim); }
.dest__go { color: var(--faint); font-size: 15px; transition: transform .25s var(--spring), color .25s var(--ease); }
.dest:hover .dest__go { transform: translate(2px, -2px); color: var(--ink); }

/* =================================================================
   MOBILE
   ================================================================= */
@media (max-width: 640px) {
  .links { gap: 16px; }
  .fy__cards { grid-template-columns: 1fr; }
  .pcard img, .pcard__ph { width: 128px; height: 158px; }
  .pcard + .pcard { margin-left: -40px; }
  .overlay { padding: clamp(56px, 9vh, 90px) var(--edge); place-items: start center; }
  /* mobile has no hover-fan to clip, so let the About list scroll inside the sheet
     (the way For you already does) - fixes not being able to reach the bottom years. */
  .sheet[data-panel="about"] { overflow-y: auto; overflow-x: hidden;
    max-height: calc(100dvh - 2 * clamp(56px, 9vh, 90px)); -webkit-overflow-scrolling: touch; }
}

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