/* MISDONE landing: one screen, no scrolling, crumpled-paper sheets. */
:root {
  --paper: #EDE7DF;
  --paper-2: #F5F1EA;
  --sage: #687A6B;
  --terra: #D96857;
  --sand: #DED7CF;
  --charcoal: #111111;
  --muted: #69655f;
  --bar: 76px;
  --foot: 34px;
  --brand: clamp(100px, 22dvh, 190px);
  --gap: clamp(12px, 1.8vw, 28px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: "Space Grotesk", Arial, sans-serif;
  color: var(--charcoal);
  background: var(--paper) url("assets/paper.jpg") center / cover no-repeat;
  -webkit-font-smoothing: antialiased;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
/* soften the texture and add a quiet vignette so it reads as one sheet of paper */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(245,241,234,.72), rgba(245,241,234,.30) 70%, rgba(104,122,107,.14));
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--terra); color: var(--paper-2); }

/* ---------- top bar ---------- */
.bar {
  position: relative; z-index: 20;
  height: var(--bar);
  padding: 0 clamp(16px, 3vw, 40px);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  border-bottom: 1px solid rgba(17,17,17,.16);
  background: rgba(245,241,234,.55);
  backdrop-filter: blur(6px);
  flex: 0 0 auto;
}
.bar-brand { display: inline-flex; width: fit-content; }
.bar-brand img { display: block; height: 34px; width: auto; }
.bar-nav { display: flex; gap: clamp(18px, 3vw, 40px); font-size: .86rem; font-weight: 500; }
.bar-nav a { position: relative; padding: 6px 0; }
.bar-nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: currentColor; transition: right .25s ease; }
.bar-nav a:hover::after, .bar-nav a.is-current::after { right: 0; }
.bar-cta {
  justify-self: end; background: var(--charcoal); color: var(--paper-2);
  padding: 11px 16px; border-radius: 7px; font-size: .82rem; display: inline-flex; gap: 22px; font-weight: 500;
  transition: background .2s;
}
.bar-cta:hover { background: var(--terra); }

/* ---------- stage ---------- */
.stage {
  position: relative; z-index: 1;
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(10px, 2vh, 24px) clamp(14px, 3vw, 44px) calc(var(--foot) + 4px);
}
.tagline {
  margin: 0 0 clamp(8px, 1.6vh, 18px);
  text-align: center;
  font-weight: 700; letter-spacing: -.045em; line-height: 1;
  font-size: clamp(1.1rem, 2.6vw, 2.5rem);
  text-transform: uppercase;
}
.tagline em { color: var(--terra); font-style: normal; }

/* four sheets, each 1.3 times smaller than before, centred; the brand sits under them */
.wall {
  list-style: none; margin: 0 auto; padding: 0;
  flex: 0 0 auto;
  height: min(calc((100dvh - var(--bar) - 130px) / 1.3), calc(100dvh - var(--bar) - 150px - var(--brand)));   /* the old height divided by 1.3, unless the brand needs the room */
  min-height: 150px;
  width: calc(((100% - 4 * var(--gap)) / 5) * 4 / 1.3 + 3 * var(--gap));
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}
.brandline {
  flex: 0 0 auto; margin: clamp(14px, 4dvh, 44px) auto 0;
  width: calc(((100% - 4 * var(--gap)) / 5) * 4 / 1.3 + 3 * var(--gap));
  display: flex; justify-content: flex-start;
}
.brand3d {
  display: block; --poster-color: transparent; background: transparent; pointer-events: none;
  width: calc(50% - var(--gap) / 2); height: var(--brand);   /* two sheets wide: twice the old size */
  filter: drop-shadow(0 10px 12px rgba(40,36,30,.28));
}
.foot {
  position: fixed; left: clamp(14px, 3vw, 44px); right: clamp(14px, 3vw, 44px); bottom: 10px; z-index: 5;
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  pointer-events: none;
}
.foot .copy { margin-left: auto; text-align: right; }
.hint-touch { display: none; }

/* ---------- a crumpled sheet ---------- */
.sheet {
  position: relative; min-height: 0; cursor: pointer; outline: none;
  perspective: 900px;
  filter: drop-shadow(0 14px 18px rgba(40,36,30,.22)) drop-shadow(0 2px 3px rgba(40,36,30,.18));
  transition: transform .45s cubic-bezier(.2,.8,.2,1), filter .45s;
}
.sheet:nth-child(odd)  { margin-top: clamp(0px, 2.4vh, 26px); }
.sheet:nth-child(even) { margin-bottom: clamp(0px, 2.4vh, 26px); }
.sheet--1 { transform: rotate(-1.6deg); }
.sheet--2 { transform: rotate(1.2deg); }
.sheet--4 { transform: rotate(1.8deg); }
.sheet--5 { transform: rotate(-1.2deg); }
.sheet:hover, .sheet:focus-visible, .sheet.is-open {
  transform: rotate(0deg) translateY(-8px) scale(1.035);
  z-index: 3;
  filter: drop-shadow(0 26px 30px rgba(40,36,30,.30)) drop-shadow(0 3px 4px rgba(40,36,30,.20));
}

/* ragged torn-and-crumpled outline, a different one for every sheet */
.paper {
  position: absolute; inset: 0;
  background:
    linear-gradient(160deg, rgba(255,255,255,.45), rgba(255,255,255,0) 40%, rgba(60,50,40,.10)),
    url("assets/paper.jpg") var(--px, 20%) var(--py, 30%) / 260% auto;
  background-color: var(--paper-2);
  clip-path: var(--edge);
}
.sheet--1 { --edge: polygon(2% 4%, 14% 0, 33% 2%, 52% 0, 71% 3%, 90% 0, 100% 6%, 98% 27%, 100% 48%, 97% 70%, 100% 92%, 86% 100%, 66% 97%, 46% 100%, 26% 98%, 8% 100%, 0 90%, 3% 68%, 0 46%, 3% 24%); --px: 8%;  --py: 20%; }
.sheet--2 { --edge: polygon(0 5%, 18% 1%, 38% 4%, 58% 0, 80% 3%, 98% 1%, 100% 22%, 97% 44%, 100% 66%, 98% 90%, 80% 98%, 60% 100%, 40% 97%, 20% 100%, 3% 96%, 1% 74%, 4% 50%, 0 28%); --px: 55%; --py: 70%; }
.sheet--4 { --edge: polygon(0 2%, 16% 4%, 36% 0, 57% 3%, 77% 0, 96% 3%, 100% 20%, 98% 42%, 100% 64%, 97% 86%, 100% 100%, 80% 97%, 58% 100%, 38% 96%, 18% 100%, 2% 97%, 4% 72%, 0 48%, 3% 24%); --px: 75%; --py: 15%; }
.sheet--5 { --edge: polygon(2% 0, 22% 3%, 42% 0, 62% 4%, 82% 1%, 100% 5%, 97% 28%, 100% 52%, 98% 74%, 100% 94%, 82% 100%, 62% 97%, 42% 100%, 22% 96%, 4% 100%, 0 80%, 3% 56%, 0 32%); --px: 40%; --py: 90%; }

/* ---------- the model: blurred until the sheet is unfolded ---------- */
.model {
  position: absolute; inset: 9% 7% 20%;
  display: flex; align-items: center; justify-content: center;
  transform-style: preserve-3d;
}
.model model-viewer {
  /* drawn in a window 1.9 times the size of its slot (so nothing is cut off) and shrunk back; on hover it grows 1.5 times, crisp, and spills over the edges of the sheet */
  display: block; flex: none; width: 190%; height: 190%; --poster-color: transparent; background: transparent; pointer-events: none;
  transform: scale(.658);
  user-select: none; -webkit-user-drag: none;
  filter: grayscale(1) blur(9px) contrast(.95) opacity(.92) drop-shadow(0 8px 10px rgba(40,36,30,.30));
  transition: filter .55s ease, transform .55s ease;
  will-change: transform;
}
.sheet:hover .model model-viewer, .sheet:focus-visible .model model-viewer, .sheet.is-open .model model-viewer {
  filter: grayscale(0) blur(0) saturate(1.08) contrast(1) opacity(1) drop-shadow(0 16px 16px rgba(40,36,30,.38));
  transform: scale(.987);
}
/* the model turns slowly on its own: a full swing from side to side with a little bob */
@keyframes spin {
  0%   { transform: scale(var(--s, .94)) rotateY(-32deg) translateY(0); }
  50%  { transform: scale(var(--s, .94)) rotateY(32deg)  translateY(-6px); }
  100% { transform: scale(var(--s, .94)) rotateY(-32deg) translateY(0); }
}
.sheet:hover, .sheet:focus-visible, .sheet.is-open { --s: 1.08; }


/* ---------- caption ---------- */
.cap {
  position: absolute; left: 8%; right: 8%; bottom: 7%; margin: 0;
  display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline;
  font-size: clamp(.66rem, 1vw, .86rem); font-weight: 600; letter-spacing: -.01em;
  opacity: .78; transition: opacity .4s;
}
/* only the project name is printed upside down; the number and the status stay upright */
.cap .name { display: inline-block; transform: rotate(180deg); }
.cap b { font-weight: 700; color: var(--terra); }
.cap i { font-style: normal; margin-left: auto; font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.sheet:hover .cap, .sheet:focus-visible .cap, .sheet.is-open .cap { opacity: 1; }

/* ---------- panels (About / Contact) ---------- */
.panel {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px;
  background: rgba(17,17,17,.38); backdrop-filter: blur(5px);
  animation: fadein .25s ease;
}
.panel[hidden] { display: none; }
.panel-sheet {
  position: relative; width: min(560px, 100%);
  padding: clamp(28px, 5vw, 52px);
  background: linear-gradient(160deg, rgba(255,255,255,.4), rgba(0,0,0,.05)), url("assets/paper.jpg") 30% 40% / 220% auto, var(--paper-2);
  clip-path: polygon(0 3%, 15% 0, 38% 2%, 62% 0, 84% 2%, 100% 0, 98% 30%, 100% 58%, 98% 84%, 100% 100%, 78% 98%, 52% 100%, 26% 98%, 0 100%, 2% 70%, 0 40%);
  filter: drop-shadow(0 20px 30px rgba(0,0,0,.35));
}
.panel-kicker { font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.panel-sheet h2 { margin: 12px 0 18px; font-size: clamp(2rem, 6vw, 3.6rem); line-height: .94; letter-spacing: -.06em; font-weight: 700; }
.panel-sheet p { margin: 0 0 10px; line-height: 1.5; max-width: 420px; }
.panel-sheet .micro { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--terra); }
.panel-link { display: inline-flex; gap: 16px; font-size: clamp(1rem, 3vw, 1.4rem); font-weight: 600; border-bottom: 2px solid var(--terra); padding-bottom: 4px; }
.panel-close {
  position: absolute; top: 14px; right: 18px; width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: var(--charcoal); color: var(--paper-2); font: 400 1.4rem/1 "Space Grotesk", sans-serif; cursor: pointer;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- smaller screens: still one screen, no scrolling ---------- */
@media (max-width: 900px) {
  :root { --bar: 62px; }
  .bar { grid-template-columns: auto 1fr; gap: 12px; }
  .bar-nav { justify-self: end; gap: 16px; font-size: .8rem; }
  .bar-cta { display: none; }
  .bar-brand img { height: 28px; }
  .model { inset: 8% 6% 24%; }
  .model model-viewer { filter: grayscale(1) blur(6px) opacity(.92) drop-shadow(0 6px 8px rgba(40,36,30,.3)); }
  .sheet:hover .model model-viewer, .sheet:focus-visible .model model-viewer, .sheet.is-open .model model-viewer { filter: grayscale(0) blur(0) saturate(1.08) drop-shadow(0 12px 12px rgba(40,36,30,.36)); }
}
@media (max-width: 560px) {
  :root { --brand: clamp(46px, 8dvh, 76px); }
  .brandline { width: calc(100% / 1.15); }
  .brand3d { width: 100%; }
  .wall {
    width: calc(100% / 1.15); height: calc(100dvh - var(--bar) - var(--foot) - var(--brand) - 118px);
    grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr));
  }
  .sheet:nth-child(n) { margin: 0; }
  .cap i { display: none; }
  .tagline { font-size: 1rem; }
  .foot .hint { display: none; }
}
@media (hover: none) { .hint-hover { display: none; } .hint-touch { display: inline; } }
@media (prefers-reduced-motion: reduce) { .model model-viewer { animation: none; } .sheet { transition: none; } }

/* no loading bar over the models: the flat poster is shown until they are ready */
model-viewer::part(default-progress-bar) { display: none; }

/* a ribbon that follows the pointer, in the colours of the logo; it never takes clicks */
#trail { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; pointer-events: none; }
