/* ---------------------------------------------------------------
   Savo Pejović — portfolio
   Palette / type tokens
   --------------------------------------------------------------- */
:root {
  --bg: #fafcfd;
  --fg: #2b3743;
  --fg-light: rgba(43, 55, 67, 0.62);
  --fg-faint: rgba(43, 55, 67, 0.10);
  --primary: #024AD8;          /* HP blue */
  --primary-ink: #ffffff;
  --card: #ffffff;
  --max: 1800px;
  --sans: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --serif: "Newsreader", "Tiempos Text", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

html, body { min-height: 100%; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* custom cursor: hide the native one on fine pointers only */
@media (hover: hover) and (pointer: fine) {
  body.custom-cursor, body.custom-cursor * { cursor: none !important; }
}

::selection { background: rgba(2, 74, 216, .18); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--fg);
}
h1 { font-size: 2.75rem; line-height: 1.08; }
@media (min-width: 1200px) { h1 { font-size: 3.25rem; } }
h2 { font-size: 1.9rem; line-height: 1.2; }
h3 { font-size: 1.325rem; line-height: 1.3; }
h1 em, h2 em { font-style: italic; color: var(--primary); }

h4, .mono {
  font-family: var(--mono);
  text-transform: uppercase;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: .02em;
  color: var(--fg-light);
  margin: 0;
}
p { margin: 0; color: var(--fg-light); font-size: 15px; }
p b, p strong { color: var(--fg); font-weight: 500; }

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--primary); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; }

/* ---------------------------------------------------------------
   Header
   --------------------------------------------------------------- */
.site-header {
  position: relative; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--fg-faint);
  padding: 0 24px;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; min-height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: 14px; }
.brand .logo {
  position: relative; display: block; width: 44px; height: 29px;
}
.brand .logo img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transition: opacity .25s var(--ease);
}
.brand .logo img.alt { opacity: 0; }
.brand:hover .logo img.alt { opacity: 1; }
.brand .who { display: flex; gap: 16px; align-items: baseline; }
.brand .who h4 { color: var(--fg); }
.brand .who h4 + h4 { color: var(--fg-light); }

.site-nav { display: flex; gap: 28px; align-items: center; }
.site-nav a h4 { color: var(--fg-light); transition: color .2s; }
.site-nav a:hover h4, .site-nav a[aria-current] h4 { color: var(--primary); }

@media (max-width: 640px) {
  .brand .who { display: none; }
  .site-nav { gap: 18px; }
}

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */
main.page { padding: 0 24px; }
.hero {
  display: grid; grid-template-columns: 1fr; gap: 48px;
  padding: 40px 0 64px;
}
@media (min-width: 1024px) {
  .hero { grid-template-columns: 1fr 1fr; gap: 48px; padding: 18vh 0 72px; align-items: end; }
}
.hero h1 { max-width: 720px; }
.hero .lede { max-width: 520px; margin-top: 18px; font-size: 16px; }

/* Timeline (project roles from CV) */
.timeline { display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 1024px) {
  .timeline {
    gap: 4px;
    max-height: 160px; /* ~6 rows */
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--fg-faint) transparent;
  }
  .timeline-wrap { position: relative; }
  .timeline-wrap::after {
    content: ""; position: absolute; left: 0; right: 16px; bottom: 0; height: 28px;
    background: linear-gradient(to bottom, rgba(250, 252, 253, 0), var(--bg));
    pointer-events: none;
  }
  .timeline::-webkit-scrollbar { width: 6px; }
  .timeline::-webkit-scrollbar-thumb { background: var(--fg-faint); border-radius: 999px; }
  .timeline::after { content: ""; flex: 0 0 24px; }
}
.timeline .row {
  display: grid; grid-template-columns: 56px 1fr; gap: 8px; align-items: baseline;
}
.timeline .row > h4 { white-space: nowrap; }
.timeline .row .what { display: flex; flex-direction: column; gap: 1px; }
@media (min-width: 1024px) {
  .timeline .row .what { flex-direction: row; gap: 12px; }
  .timeline .row .what > :first-child { flex: 1 1 auto; min-width: 0; }
  .timeline .row .what > p { white-space: nowrap; width: 210px; min-width: 210px; }
}
.timeline .row a { color: var(--fg); }
.timeline .row a::after { content: " ↗"; color: var(--primary); opacity: 0; transition: opacity .2s; font-size: .85em; }
.timeline .row a:hover::after { opacity: 1; }
.timeline .row p { font-size: 14px; }
.timeline .row.side .what > :first-child { color: var(--fg); }
.timeline-more { margin-top: 14px; }

/* ---------------------------------------------------------------
   Project grid
   --------------------------------------------------------------- */
.projects {
  display: grid; grid-template-columns: 1fr; gap: 24px;
  padding-bottom: 96px;
}
@media (min-width: 1024px) { .projects { grid-template-columns: 1fr 1fr; } }
.projects .col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.hero > *, .card, .about > * { min-width: 0; }

.card { display: block; color: inherit; }
.card .frame {
  position: relative; width: 100%;
  border: 1px solid var(--fg-faint);
  background: #eef2f4;
  overflow: hidden;
  aspect-ratio: var(--ar, 16 / 9);
}
.card .frame video, .card .frame img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.card .frame video { opacity: 0; transition: opacity .5s ease; }
.card .frame video.ready { opacity: 1; }
.card .frame .veil {
  position: absolute; inset: 0; background: rgba(250, 252, 253, 0);
  transition: background .3s var(--ease);
}
.card:hover .frame .veil { background: rgba(250, 252, 253, .35); }
.card .meta {
  display: flex; flex-direction: column; gap: 2px; margin-top: 12px;
}
@media (min-width: 1024px) {
  .card .meta { flex-direction: row; justify-content: space-between; gap: 16px; }
}
.card .meta h3 { font-size: 17px; color: var(--fg); transition: color .25s; }
.card:hover .meta h3 { color: var(--primary); }
.card .meta h4 { overflow-wrap: anywhere; }
@media (min-width: 1024px) { .card .meta h4 { white-space: nowrap; } }

/* ---------------------------------------------------------------
   About + footer
   --------------------------------------------------------------- */
.about {
  border-top: 1px solid var(--fg-faint);
  padding: 72px 0 96px;
  display: grid; gap: 40px; grid-template-columns: 1fr;
}
@media (min-width: 1024px) { .about { grid-template-columns: 1fr 1fr; } }
.about .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 24px; }
.about .facts > div { display: flex; flex-direction: column; gap: 6px; }
.about .facts p { color: var(--fg); }
.about .facts p small { color: var(--fg-light); display: block; font-size: 13px; }
.about h2 { max-width: 620px; }
.about .lede { margin-top: 18px; max-width: 560px; font-size: 16px; }

.site-footer {
  border-top: 1px solid var(--fg-faint);
  padding: 28px 24px 40px;
}
.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; justify-content: space-between;
}
.site-footer .links { display: flex; gap: 24px; flex-wrap: wrap; }
.site-footer .logo { width: 34px; height: 22px; object-fit: contain; vertical-align: -5px; margin-right: 10px; }
.site-footer .made { display: inline-flex; align-items: center; }

/* ---------------------------------------------------------------
   Project page
   --------------------------------------------------------------- */
.project {
  display: grid; grid-template-columns: 1fr; gap: 0;
  max-width: var(--max); margin: 0 auto;
}
@media (min-width: 900px) {
  .project { grid-template-columns: 1fr auto 1fr; gap: 32px; }
}
.project aside {
  padding: 48px 0 0; min-width: 160px;
}
@media (min-width: 900px) { .project aside { position: sticky; top: 0; height: fit-content; padding: 48px 0; } }
.project aside .back { display: inline-flex; align-items: center; gap: 8px; }
.project aside .back h4 { color: var(--fg); }
.project aside .back:hover h4 { color: var(--primary); }
.project aside nav { display: none; margin-top: 32px; }
@media (min-width: 900px) { .project aside nav { display: flex; flex-direction: column; gap: 8px; } }
.project aside nav a { color: var(--fg-light); font-size: 14px; }
.project aside nav a.active, .project aside nav a:hover { color: var(--fg); }

.project article {
  width: 100%; padding: 48px 0 96px;
  display: flex; flex-direction: column; gap: 56px;
}
@media (min-width: 900px) { .project article { max-width: 56rem; gap: 96px; } }
.project .head { display: flex; flex-direction: column; gap: 32px; }
.project .head .title { display: flex; flex-direction: column; gap: 14px; }

.hero-video {
  position: relative; width: 100%;
  aspect-ratio: var(--ar, 16 / 9);
  border: 1px solid var(--fg-faint);
  background: #eef2f4;
  overflow: hidden;
}
.hero-video video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; background: transparent;
}
.hero-video .state {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 14px 26px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-family: var(--mono); text-transform: uppercase; font-size: 13px; letter-spacing: .06em;
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.hero-video.paused .state { opacity: 1; }
.hero-video .tools {
  position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px;
  opacity: 0; transition: opacity .25s;
}
.hero-video:hover .tools, .hero-video.paused .tools { opacity: 1; }
.hero-video .tools button {
  border: 0; background: rgba(0, 0, 0, .55); color: #fff; width: 36px; height: 36px;
  border-radius: 999px; display: grid; place-items: center; padding: 0;
}
.hero-video .tools button:hover { background: var(--primary); }
.hero-video .tools svg { width: 16px; height: 16px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (min-width: 900px) { .facts { grid-template-columns: repeat(4, 1fr); gap: 48px; } }
.facts > div { display: flex; flex-direction: column; gap: 8px; }
.facts p { color: var(--fg); }
.facts p + p { margin-top: 0; }

.project section { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 32px; }
.project section h2 { margin-bottom: 4px; }
.project section p { font-size: 16px; line-height: 1.65; }
.project section ul { margin: 0; padding-left: 20px; color: var(--fg-light); font-size: 16px; line-height: 1.65; }
.project section .shot {
  width: 100%; border: 1px solid var(--fg-faint); display: block; margin-top: 8px; background: #eef2f4;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  padding: 6px 10px; border: 1px solid var(--fg-faint); border-radius: 999px; color: var(--fg);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border: 1px solid var(--fg); border-radius: 999px;
  color: var(--fg); font-size: 14px; transition: all .2s var(--ease);
}
.btn:hover { background: var(--fg); color: #fff; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #0239a8; border-color: #0239a8; }
.btn svg { width: 16px; height: 16px; }

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  border-top: 1px solid var(--fg-faint); padding-top: 32px;
}
.pager a { display: flex; flex-direction: column; gap: 6px; }
.pager a.next { text-align: right; align-items: flex-end; }
.pager a h3 { font-size: 17px; transition: color .2s; }
.pager a:hover h3 { color: var(--primary); }

/* ---------------------------------------------------------------
   Custom cursor
   --------------------------------------------------------------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity .3s ease-out;
  will-change: transform;
}
.cursor .dot {
  display: flex; align-items: center; justify-content: center;
  height: 14px; width: 14px; border-radius: 999px;
  background: var(--primary); color: var(--primary-ink);
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap; padding: 0;
  transition: width .2s ease-out, height .2s ease-out, padding .2s ease-out, background .2s, transform .1s ease-out;
}
.cursor .dot span {
  opacity: 0; width: 0; overflow: hidden;
  transition: opacity .2s ease-out, width .2s ease-out;
}
.cursor.visible { opacity: 1; }
.cursor.hover .dot { height: 22px; width: 22px; }
.cursor.label .dot { height: 32px; width: auto; padding: 0 14px; }
.cursor.label .dot span { opacity: 1; width: auto; }
.cursor.down .dot { transform: scale(.85); }
.cursor.media .dot { background: rgba(43, 55, 67, .9); }

@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------------------------------------------------------------
   Reveal on load
   --------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
