/* Gjurmët — prints and folders, in the colours of Vizioni M and O.K.H. Merhamet.
   Mobile first. */

:root {
  --paper: #fdfcfa;           /* very slightly warm white */
  --paper-hi: #ffffff;
  --photo: #ffffff;           /* white border of the prints */
  --folder: #f4f3f1;          /* folders and tabs: a hint darker than the page */
  --ink: #333333;             /* charcoal, the Vizioni M logo colour */
  --ink-2: #5c5c5c;
  --muted: #808080;
  --line: #333333;
  --rule: rgba(51, 51, 51, .16);
  --rule-strong: rgba(51, 51, 51, .32);
  --accent: #c8161d;          /* Merhamet red — used rarely */
  --accent-dark: #a51e22;

  --font: "Montserrat", "Helvetica Neue", Arial, sans-serif;

  --gutter: 16px;
  --tabs-h: 58px;
  --outline: 0 0 0 1px var(--line), 0 2px 6px -3px rgba(51, 51, 51, .18);

  /* The woven pattern from the top of the Vizioni M logo. */
  --weave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' fill='%23333333'/%3E%3Cg fill='%23ffffff'%3E%3Crect x='2' width='8' height='24'/%3E%3Crect x='14' width='8' height='24'/%3E%3Crect y='2' width='24' height='8'/%3E%3Crect y='14' width='24' height='8'/%3E%3C/g%3E%3Cg fill='%23333333'%3E%3Crect x='2' y='1' width='8' height='1'/%3E%3Crect x='2' y='10' width='8' height='1'/%3E%3Crect x='13' y='2' width='1' height='8'/%3E%3Crect x='22' y='2' width='1' height='8'/%3E%3Crect x='1' y='14' width='1' height='8'/%3E%3Crect x='10' y='14' width='1' height='8'/%3E%3Crect x='14' y='13' width='8' height='1'/%3E%3Crect x='14' y='22' width='8' height='1'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--paper);
}
html.locked, html.locked body { overflow: hidden; }

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Woven band (used sparingly) ---------- */

.weave {
  display: block;
  height: 15px;               /* 12px inside the edges: one full woven tile */
  background-color: var(--ink);
  background-image: var(--weave);
  background-size: 12px 12px;
  border-top: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
}

/* ---------- Organisation marks ---------- */

.org {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  white-space: nowrap;
}
.org:last-child { margin-right: 0; }
.mark { width: 17px; height: 14px; flex: none; }

/* ---------- Prints ---------- */

.print {
  --r: 0deg;
  position: relative;
  display: block;
  margin: 0;
  padding: 6px 6px 24px;
  background: var(--photo);
  box-shadow: var(--outline);
  transform: rotate(var(--r));
}
.print img {
  display: block;
  width: 100%;
  height: auto;
  background: #ececea;
  outline: 1px solid rgba(51, 51, 51, .12);
}
.print.crop img { aspect-ratio: 4 / 5; object-fit: cover; }
.print.empty { aspect-ratio: 4 / 5.4; }

/* Year on the white border. */
.pencil, .print .yr {
  font-family: var(--font);
  font-weight: 300;
  font-size: .72rem;
  color: var(--ink-2);
}
.print .yr {
  position: absolute;
  left: 12px;
  bottom: 4px;
  transform: rotate(-1.5deg);
  transform-origin: left center;
}

/* Gentle slide-in when scrolled into view (only when JS is running). */
.js .reveal {
  opacity: 0;
  transform: translateY(16px) rotate(var(--r, 0deg));
  transition: opacity .7s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
  transition-delay: var(--d, 0s);
}
.js .reveal.in {
  opacity: 1;
  transform: rotate(var(--r, 0deg));
}

/* ---------- Opening ---------- */

.opening { padding-top: max(18px, env(safe-area-inset-top)); }

.kicker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-strong);
  font-size: .8rem;
  font-weight: 300;
  color: var(--ink-2);
}
.kicker-logos { display: flex; align-items: center; gap: 14px; }
.kicker-logos .logo { height: 30px; width: auto; }

.pile {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1 / 1.06;
  margin: 30px auto 10px;
}
.pile .print { position: absolute; width: 50%; padding: 5px 5px 20px; }
.pile .p1 { left: 1%;  top: 2%;  z-index: 1; }
.pile .p2 { left: 47%; top: 0;   z-index: 2; }
.pile .p3 { left: 26%; top: 20%; z-index: 3; }
.pile .p4 { left: 49%; top: 35%; z-index: 4; }
.pile .p5 { left: 4%;  top: 37%; z-index: 5; }

.opening h1 {
  margin: 18px 0 14px;
  font-weight: 600;
  font-size: clamp(2.7rem, 13vw, 5.4rem);
  line-height: 1;
  letter-spacing: -.02em;
}
.weave-band { width: min(220px, 60%); margin: 0 0 18px; }
.lede {
  margin: 0;
  max-width: 28ch;
  font-size: 1.2rem;
  line-height: 1.5;
}
.scroll-hint { margin: 26px 0 0; font-size: .8rem; font-weight: 300; color: var(--muted); }

/* ---------- Sections ---------- */

.sec { padding-top: 72px; }
.sec-head { padding-top: 12px; border-top: 1px solid var(--line); }
.sec-head h2 {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.8rem, 7.5vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -.015em;
}
.sec-note { margin: 8px 0 0; max-width: 36ch; color: var(--ink-2); font-size: 1rem; }

/* ---------- Numbers ---------- */

.bignums { margin-top: 18px; }
.bignum { padding: 16px 0 20px; border-top: 1px solid var(--rule); }
.bignum:first-child { border-top: 0; }
.bignum-v {
  margin: 0;
  font-weight: 600;
  font-size: clamp(3rem, 17vw, 5.2rem);
  line-height: 1;
  letter-spacing: -.03em;
  font-variant-numeric: lining-nums;
}
.bignum-l { margin: 8px 0 0; font-size: 1.05rem; line-height: 1.4; max-width: 26ch; }
.bignum-s { margin: 6px 0 0; font-size: .75rem; font-weight: 300; color: var(--muted); }

/* ---------- Organisations ---------- */

.orgs { display: grid; gap: 18px; margin-top: 22px; }
.orgcard {
  padding: 20px 20px 24px;
  background: var(--paper-hi);
  border: 1px solid var(--line);
}
.orgcard-logo { display: block; height: 56px; width: auto; margin-bottom: 16px; }
.orgcard h3 {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-strong);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.3;
  letter-spacing: .28em;          /* like M E R H A M E T in the logo */
  text-transform: uppercase;
}
.orgcard p:last-child { margin: 0; }
.orgcard .placeholder { color: var(--muted); font-style: italic; }

/* ---------- Folder tabs (sticky theme navigation) ---------- */

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 22px calc(var(--gutter) * -1) 0;
  padding-top: max(10px, env(safe-area-inset-top));
  background-color: var(--paper);
  border-bottom: 1px solid var(--line);
}
.tabs-inner {
  display: flex;
  gap: 3px;
  padding: 0 var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.tabs-inner::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: -1px;
  padding: 0 14px;
  background-color: var(--folder);
  border: 1px solid var(--rule-strong);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  color: var(--ink-2);
}
.tab.on {
  background-color: var(--paper-hi);
  border-color: var(--line);
  color: var(--ink);
  overflow: hidden;
}
.tab.on::before {            /* a thin woven strip on the open tab */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--ink) var(--weave) 0 -3px / 12px 12px;
}

/* ---------- Folders and project cards ---------- */

.folder {
  position: relative;
  margin-top: 64px;
  padding: 20px 14px 30px;
  background-color: var(--folder);
  border: 1px solid var(--line);
  border-radius: 0 10px 10px 10px;
  scroll-margin-top: calc(var(--tabs-h) + 46px);
}
.folder-tab {
  position: absolute;
  top: -31px;
  left: -1px;
  height: 32px;
  margin: 0;
  padding: 0 14px;
  display: flex;
  align-items: center;
  background-color: var(--folder);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.folder-tab .weave { width: 60px; }
.folder-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-strong);
}
.folder-head h3 {
  margin: 0;
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.2;
}
.folder-count { margin: 0; font-size: .8rem; font-weight: 300; color: var(--ink-2); }

.cards {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 16px;
  margin: 22px 0 0;
  padding: 0;
}
.card { display: block; text-decoration: none; color: inherit; }
.card .print { transition: transform .25s ease; }
.card:active .print { transform: rotate(var(--r)) scale(.97); }
.card h4 {
  margin: 14px 0 5px;
  font-weight: 600;
  font-size: .98rem;
  line-height: 1.3;
}
.card-org {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-size: .72rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink-2);
}

/* ---------- Ending ---------- */

.ending { padding-top: 96px; padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
.collage { columns: 3; column-gap: 12px; }
.collage .print {
  break-inside: avoid;
  margin: 0 0 14px;
  padding: 4px 4px 13px;
}
.closing {
  margin: 44px auto 0;
  max-width: 16ch;
  text-align: center;
  font-weight: 600;
  font-size: clamp(1.7rem, 7.5vw, 2.8rem);
  line-height: 1.2;
}
.sign {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule-strong);
  text-align: center;
}
.sign-logos { display: flex; justify-content: center; align-items: center; gap: 22px; margin: 0; }
.sign-logos .logo { height: 40px; width: auto; }
.sign-names {
  margin: 14px 0 0;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Buttons ---------- */

.btn {
  min-width: 48px;
  min-height: 48px;
  padding: 0 14px;
  background: var(--paper-hi);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 1rem;
  font-weight: 500;
}
.btn-text {
  min-height: 44px;
  padding: 0 4px;
  background: none;
  border: 0;
  font-size: .9rem;
  font-weight: 500;
}

/* ---------- Project sheet ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--paper);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .3s ease, transform .35s cubic-bezier(.2, .7, .2, 1);
}
.sheet.open { opacity: 1; transform: none; }

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(4px, env(safe-area-inset-top)) var(--gutter) 4px;
  background-color: var(--paper);
  border-bottom: 1px solid var(--line);
}
.sheet-cat {
  font-size: .8rem;
  font-weight: 300;
  color: var(--ink-2);
  text-align: right;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sheet-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 26px var(--gutter) calc(40px + env(safe-area-inset-bottom));
}
.sheet-org {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-size: .8rem;
  color: var(--ink-2);
}
.sheet-title {
  margin: 10px 0 0;
  font-weight: 600;
  font-size: clamp(2rem, 9vw, 3.3rem);
  line-height: 1.1;
  letter-spacing: -.02em;
}
.since { display: inline-block; margin: 12px 0 0; font-size: .85rem; }
.sheet-desc { margin: 18px 0 0; font-size: 1.1rem; line-height: 1.6; }

.snums { margin-top: 26px; border-top: 1px solid var(--line); }
.snum { padding: 12px 0 14px; border-bottom: 1px solid var(--rule); }
.snum-v {
  margin: 0;
  font-weight: 600;
  font-size: clamp(2.4rem, 12vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -.03em;
}
.snum-l { margin: 4px 0 0; font-size: 1rem; line-height: 1.4; color: var(--ink-2); }

.photos-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 40px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.photos-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.switch { display: flex; gap: 6px; }
.switch button {
  min-height: 44px;
  padding: 0 6px;
  background: none;
  border: 0;
  font-size: .85rem;
  font-weight: 400;
  color: var(--muted);
}
.switch button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 6px;
}

.stack {
  position: relative;
  height: min(118vw, 62vh, 640px);
  margin: 14px calc(var(--gutter) * -1) 0;
  touch-action: pan-y;
}
.sprint {
  position: absolute;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
  padding: 7px 7px 30px;
  border: 0;
  transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--r));
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.sprint img { pointer-events: none; }
.sprint.top { cursor: grab; }
.sprint.drag { cursor: grabbing; transition: none; }
.sprint.fly { transition: transform .26s ease-in, opacity .26s ease-in; }
.sprint.land { animation: land .32s cubic-bezier(.2, .7, .2, 1); }
@keyframes land {
  from { opacity: 0; transform: translateX(28px) rotate(var(--r)); }
}

.stack-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 16px; }
.counter { min-width: 5ch; text-align: center; font-size: .85rem; font-weight: 300; color: var(--ink-2); }
.hint { margin: 10px 0 0; text-align: center; font-size: .75rem; font-weight: 300; color: var(--muted); }

.fb {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 0;
  font-size: .78rem;
  font-weight: 300;
  color: var(--ink-2);
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 4px;
}
.fb:hover { color: var(--accent-dark); }
.stack-view { text-align: center; }

.pgrid {
  list-style: none;
  columns: 2;
  column-gap: 14px;
  margin: 18px 0 0;
  padding: 0;
}
.pgrid li { break-inside: avoid; margin-bottom: 16px; }
.gprint { width: 100%; border: 0; text-align: left; }

.sheet-end { display: block; margin: 44px auto 0; }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #1f1f1f;
  color: #f2f2f2;
}
.lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 6px 6px;
  touch-action: pan-y pinch-zoom;
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity .2s ease;
}
.lb-bar { padding: 6px var(--gutter) calc(12px + env(safe-area-inset-bottom)); }
.lb-meta, .lb-link {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font-size: .8rem;
  font-weight: 300;
  color: #bdbdbd;
}
.lb-link a { padding: 8px 0; color: #bdbdbd; text-underline-offset: 4px; }
.lb-ctrl { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 10px; margin-top: 6px; }
.lightbox .btn { background: transparent; color: #f2f2f2; border-color: rgba(242, 242, 242, .35); }

/* ---------- Review mode (?review=1): photo ids for EXCLUDE_PHOTOS ---------- */

.review [data-pid]::after {
  content: attr(data-pid);
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 3;
  padding: 2px 5px;
  background: var(--ink);
  color: #ffffff;
  font: 500 11px/1.2 var(--font);
  letter-spacing: 0;
  transform: none;
}
.review .lb-stage { position: relative; }

/* ---------- Larger screens ---------- */

@media (min-width: 640px) {
  .bignums { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 32px; }
  .bignum:nth-child(2) { border-top: 0; }
  .orgs { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px 26px; }
  .collage { columns: 4; }
  .folder { padding: 26px 26px 36px; }
  .pgrid { columns: 3; }
}

@media (min-width: 900px) {
  :root { --gutter: 32px; }
  body { font-size: 1.125rem; }
  .opening-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 48px;
    min-height: min(82vh, 760px);
  }
  .opening-text { order: -1; }
  .pile { max-width: 520px; margin: 40px 0; }
  .bignums { grid-template-columns: repeat(4, 1fr); }
  .bignum { border-top: 0; border-left: 1px solid var(--rule); padding: 8px 0 8px 18px; }
  .bignum:first-child { border-left: 0; padding-left: 0; }
  .bignum-v { font-size: clamp(2.8rem, 4.6vw, 4.2rem); }
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .collage { columns: 6; column-gap: 16px; }
  .sec { padding-top: 110px; }
  .stack { height: min(70vh, 640px); margin-left: 0; margin-right: 0; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .js .reveal, .js .reveal.in { opacity: 1; transform: rotate(var(--r, 0deg)); transition: none; }
  .sheet { transition: none; transform: none; }
  .card .print, .sprint.fly, .lb-img { transition: none; }
  .sprint.land { animation: none; }
}
