/* Page News : le bureau de studio vu de haut, en pleine largeur tout en haut de la page (l'en-tête, le logo
   et le titre « News » sont posés dessus), avec les news de l'année jetées en vrac (assets/js/news/table.js).
   Les polaroïds sont ceux du mur (news.css), sans scotch ni punaise ; leur rotation est portée par .ntable-item.
   Easter egg : un polaroïd retourné sous la pile (.ntable-egg), au bout des traces de pattes.
   Fond : 2 photos ChatGPT du même bureau (assets/generated/news-bureau.webp et -portrait.jpg, prompts dans
   docs/news-prompts.md) ; écran en hauteur : la photo portrait en pleine largeur, calée en bas, et au-dessus
   le même noir (#232323, mesuré sur la photo) avec un grain, raccordé en fondu. */

/* ---------- En-tête et titre posés sur le bureau ---------- */
.page-news:has(.ntable:not([hidden])) .site-head {
  position: absolute; top: 0; left: 0; right: 0;
  background: transparent;
  --ink-light: #f2f1ee; --ink-dim: rgba(242, 241, 238, .62);
}
.page-news:has(.ntable:not([hidden])) .news-intro {
  position: absolute; z-index: 5; top: var(--head); left: clamp(16px, 4vw, 56px); right: clamp(16px, 4vw, 56px);
  pointer-events: none;   /* on peut glisser un polaroïd sous le titre */
}
.page-news:has(.ntable:not([hidden])) .news-title { color: #f2f1ee; text-shadow: 0 2px 18px rgba(0, 0, 0, .5); }

/* pleine largeur : on annule la marge intérieure de <main class="news"> */
.ntable {
  container-type: inline-size;      /* 150cqw = hauteur de la photo portrait posée en pleine largeur */
  position: relative; z-index: 0;   /* les polaroïds passent sous l'en-tête et le logo */
  margin: 0 calc(-1 * clamp(16px, 4vw, 56px)) 28px;
}
.ntable[hidden] { display: none; }

.ntable-top {
  --pw: 190px;
  position: relative; overflow: hidden;
  height: max(620px, min(100svh, 980px));
  /* photo ChatGPT du bureau (prompts : docs/news-prompts.md), calée en bas : le haut, nu, peut être rogné */
  background: url("../generated/news-bureau.webp") center bottom / cover no-repeat, #282828;
  box-shadow: 0 24px 40px -30px rgba(0, 0, 0, .6);
  touch-action: pan-y;          /* on fait défiler la page en glissant sur le bureau… */
  -webkit-user-select: none; user-select: none;
}
.ntable-top.is-dragging { cursor: grabbing; }
/* écrans en hauteur (téléphones, tablettes debout) */
@media (max-aspect-ratio: 4/5) {
  .ntable-top {
    background:
      url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>") 0 0 / 220px 220px,
      linear-gradient(180deg, #232323 calc(100% - 80px), rgba(35, 35, 35, 0)) top / 100% max(0px, calc(100% - 150cqw + 80px)) no-repeat,
      url("../generated/news-bureau-portrait.webp") center bottom / 100% auto no-repeat,
      #232323;
  }
}

/* post-it jaune (couleur du menu) avec la consigne */
.ntable-note {
  position: absolute; left: 22%; bottom: 5%; z-index: 9000; width: 170px;   /* collé par-dessus tout, ne gêne pas le glisser */ margin: 0; padding: 14px 14px 18px;
  font-family: "Caveat", cursive; font-size: 19px; line-height: 1.05; color: #2a2520;
  background: linear-gradient(170deg, #ffe46a, #ffd427 70%, #f4c51c);
  box-shadow: 0 1px 1px rgba(0,0,0,.3), 0 12px 18px -10px rgba(0,0,0,.7);
  transform: rotate(-4deg);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 8% 100%, 0 93%);
  pointer-events: none;
}
.ntable-note strong { display: block; font-family: "Permanent Marker", cursive; font-weight: 400; font-size: 18px; margin-bottom: 6px; }

/* traces de pattes poussiéreuses */
.ntable-paws { position: absolute; inset: 0; z-index: 1; pointer-events: none; color: rgba(235,228,215,.16); }
.ntable-paw { position: absolute; display: block; }
.ntable-paw svg { display: block; width: 100%; height: 100%; }

/* ---------- Les pièces ---------- */
.ntable-item {
  position: absolute; left: 0; top: 0; width: var(--pw);
  cursor: grab; touch-action: none;   /* …mais un polaroïd se déplace sous le doigt */
  will-change: transform;
}
.ntable-item.is-held { cursor: grabbing; }
.ntable .pola-slot { --r: 0deg; --dx: 0px; --dy: 0px; max-width: none; transform: none; }
.ntable .pola { cursor: inherit; -webkit-user-drag: none; }
.ntable .pola img { -webkit-user-drag: none; pointer-events: none; }
.ntable-item { --rot: 0deg; }   /* rotation de la pièce (table.js) : reflets et lumière restent fixés à l'écran */

/* ---------- Polaroïds plus vrais : papier légèrement bombé, arêtes, coins soulevés, photo brillante ---------- */
.ntable .pola,
.ntable .pola-more {
  background:
    radial-gradient(ellipse 110% 85% at 50% 38%, rgba(255,255,255,.55), rgba(255,255,255,0) 62%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    linear-gradient(calc(165deg - var(--rot)), #fdfcf7, #f1eee5 55%, #e6e2d6);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -1px 0 rgba(0,0,0,.16),
    0 0 0 .5px rgba(0,0,0,.5),
    0 1px 1.5px rgba(0,0,0,.65),
    0 5px 9px -3px rgba(0,0,0,.5);
}
/* coins du bas un peu soulevés : deux ombres plus longues qui dépassent sous le papier */
.ntable-item::before,
.ntable .pola-slot::before {
  content: ""; position: absolute; bottom: 4%; width: 42%; height: 16%; pointer-events: none;
  box-shadow: 0 calc(var(--pw) * .05) calc(var(--pw) * .06) rgba(0,0,0,.6);
  transition: box-shadow .25s;
}
.ntable-item::before { right: 5%; transform: rotate(3.5deg); }
.ntable .pola-slot::before { left: 5%; transform: rotate(-3.5deg); }
.ntable-item.is-egg::before { display: none; }
/* la photo : brillante (reflet de la lumière du haut), grain du film, fenêtre légèrement en creux */
.ntable .pola-photo::after {
  background:
    linear-gradient(calc(172deg - var(--rot)), rgba(255,255,255,.24) 0%, rgba(255,255,255,.07) 26%, rgba(255,255,255,0) 44%, rgba(255,255,255,0) 82%, rgba(255,255,255,.06) 100%),
    radial-gradient(ellipse 75% 75% at 50% 45%, transparent 55%, rgba(30,20,10,.3)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  box-shadow: inset 0 1px 2px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.35), inset 0 -1px 0 rgba(255,255,255,.25);
}
.ntable .pola:hover, .ntable .pola:focus-visible { transform: translateY(-2px); }
/* pris en main : il quitte la table, son ombre s'éloigne et s'adoucit */
.ntable-item.is-held .pola,
.ntable-item.is-held .ntable-card {
  transform: scale(1.06) translateY(-4px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 0 0 .5px rgba(0,0,0,.45),
    0 8px 10px rgba(0,0,0,.35),
    0 36px 46px -14px rgba(0,0,0,.85);
}
.ntable-item.is-held::before,
.ntable-item.is-held .pola-slot::before { box-shadow: 0 calc(var(--pw) * .14) calc(var(--pw) * .12) rgba(0,0,0,.45); }
.ntable .pola-title { font-size: calc(var(--pw) * .1); }
.ntable .pola-date { font-size: max(11px, calc(var(--pw) * .068)); }
.ntable .pola-blank-text { font-size: calc(var(--pw) * .085); }
.ntable .pola-video::after { border-width: calc(var(--pw) * .035) 0 calc(var(--pw) * .035) calc(var(--pw) * .055); }

/* ---------- Easter egg : le polaroïd retourné ---------- */
.ntable-egg {
  display: block; width: 100%; aspect-ratio: 88 / 107; padding: 0; border: 0; background: none; cursor: inherit;
  perspective: 900px; font: inherit;
}
.ntable-card {
  position: relative; display: block; width: 100%; height: 100%; border-radius: 2px;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.3,.7,.2,1.15), box-shadow .3s;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.5), 0 1px 1.5px rgba(0,0,0,.65), 0 5px 9px -3px rgba(0,0,0,.5);
}
.ntable-egg.is-flipped .ntable-card { transform: rotateY(180deg); }
.ntable-item.is-held .ntable-egg.is-flipped .ntable-card { transform: rotateY(180deg) scale(1.06) translateY(-4px); }
.ntable-back, .ntable-front {
  position: absolute; inset: 0; border-radius: 2px;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
/* dos : noir mat, écrit au marqueur argent */
.ntable-back {
  display: grid; place-items: center;
  background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    linear-gradient(160deg, #2b2b2a, #161615);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}
.ntable-back::before {   /* languette du bas, comme au dos d'un vrai instantané */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 17%;
  background: linear-gradient(#1d1d1c, #0f0f0e); border-top: 1px solid rgba(255,255,255,.06);
}
.ntable-back span {
  font-family: "Permanent Marker", cursive; color: #cfcfca; font-size: calc(var(--pw) * .11); line-height: 1.05;
  text-align: center; padding: 0 12%; transform: rotate(-9deg) translateY(-8%);
  text-shadow: 0 0 1px rgba(255,255,255,.35);
}
/* face : la photo de la chienne d'Olaf (assets/egg/chienne.jpg ; pas dans assets/news/, que deploy.sh n'envoie pas) */
.ntable-front {
  transform: rotateY(180deg);
  background: linear-gradient(160deg, #fdfcf8, #f3f1ea);
}
.ntable-film {
  position: absolute; left: 6.8%; right: 6.8%; top: 5.6%; aspect-ratio: 1;
  background: radial-gradient(ellipse at 30% 25%, #34332f, #121210 70%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.ntable-film img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.88) contrast(1.04) sepia(.08);   /* un peu « instantané » */
  pointer-events: none; -webkit-user-drag: none; user-select: none;
}
.ntable-wuff {
  position: absolute; left: 8%; right: 6%; bottom: 3.5%; top: calc(5.6% + 86.4% * 88 / 107 + 2.5%);
  display: flex; align-items: center;
  font-family: "Caveat", cursive; font-weight: 600; font-size: calc(var(--pw) * .12); color: #24378f;
  transform: rotate(-2deg);
}
.ntable-egg:focus-visible { outline: 2px solid #1d1f22; outline-offset: 6px; }

/* ---------- Téléphones ---------- */
@media (max-width: 760px) {
  .ntable { margin: 0 -16px 20px; }
  .page-news:has(.ntable:not([hidden])) .news-intro { left: 16px; right: 16px; }
  .ntable-top { height: max(560px, min(135svh, 1150px)); }   /* plus haut qu'un écran : les polaroïds, plus grands, ont de la place */
  .ntable-note { width: 128px; font-size: 15px; padding: 10px 10px 13px; left: auto; right: 4%; bottom: auto; top: calc(var(--head) + 18px); transform: rotate(3deg); }
  .ntable-note strong { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ntable-card { transition: none; }
}
