/* Locataire+ 2.1 — interrupteur jour/nuit, icônes animées, fluidité, espacements uniformes */

/* ---------- Espacement unique entre les blocs ---------- */
:root { --sec-gap: 28px; --head-gap: 20px; }
@media (min-width: 1024px) { :root { --sec-gap: 32px; --head-gap: 24px; } }
.page-head { margin: 0 0 var(--head-gap); }
.back + .page-head { margin-top: 0; }
.sec, .gap-t { margin-top: var(--sec-gap); }
.sec:first-child, .home__main > .sec, .home__aside > .sec, .cols > * > .sec:first-child { margin-top: 0; }
.home, .home__main, .home__aside, .cols { gap: var(--sec-gap); }
@media (min-width: 1024px) { .home { gap: var(--sec-gap) calc(var(--sec-gap) * 1.25); } }
@media (min-width: 900px) { .cols { gap: var(--sec-gap) calc(var(--sec-gap) * 1.25); } }
.sec__head { margin-bottom: 12px; min-height: 28px; align-items: center; }
.gap-b, .note-gap { margin-bottom: 16px; }
.toolbar { margin-bottom: 12px; }
.plaque-caption { margin-top: 10px; }
.ledger .row-actions, .row-actions { margin-top: 16px; }
.meters, .docs, .photos, .templates, .topics, .shortcuts { gap: 12px; }

/* ---------- Interrupteur jour / nuit ---------- */
.daynight { display: grid; place-items: center; width: 54px; height: 34px; padding: 0; border: 0; border-radius: 999px; background: none; }
.dn {
  position: relative; display: block; width: 48px; height: 26px; border-radius: 999px; overflow: hidden;
  background: linear-gradient(180deg, #9CC3FF 0%, #D7E6FF 100%);
  box-shadow: inset 0 1px 2px rgba(20, 40, 90, .18);
  transition: background .6s ease;
}
.dn::before { /* ciel de nuit, en fondu */
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease;
  background: linear-gradient(180deg, #1B1C3F 0%, #3A3C8A 100%);
}
.dn__knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FFE38A, #FFB627 70%);
  box-shadow: 0 0 0 3px rgba(255, 214, 92, .35), 0 0 10px 2px rgba(255, 190, 40, .55);
  transition: transform .6s cubic-bezier(.5, 1.5, .45, 1), background .5s ease, box-shadow .5s ease;
}
.dn__moon { position: absolute; inset: 0; border-radius: 50%; opacity: 0; transform: rotate(-60deg); transition: opacity .35s ease .1s, transform .6s cubic-bezier(.5, 1.5, .45, 1); }
.dn__moon i { position: absolute; border-radius: 50%; background: #B9BCD6; }
.dn__moon i:nth-child(1) { width: 6px; height: 6px; top: 4px; left: 9px; }
.dn__moon i:nth-child(2) { width: 4px; height: 4px; top: 11px; left: 4px; }
.dn__moon i:nth-child(3) { width: 3px; height: 3px; top: 13px; left: 12px; }
.dn__cloud { position: absolute; height: 7px; border-radius: 999px; background: #fff; transition: transform .55s cubic-bezier(.4, 0, .2, 1), opacity .4s ease; }
.dn__cloud::before { content: ""; position: absolute; left: 25%; top: -4px; width: 50%; height: 8px; border-radius: 999px; background: inherit; }
.dn__cloud--a { width: 15px; right: 6px; top: 13px; }
.dn__cloud--b { width: 10px; right: 15px; top: 7px; opacity: .85; }
.dn__stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; opacity: 0; transform: scale(0); transition: opacity .4s ease, transform .5s cubic-bezier(.5, 1.8, .4, 1); }
.dn__stars i:nth-child(1) { left: 8px; top: 7px; }
.dn__stars i:nth-child(2) { left: 15px; top: 15px; width: 1.5px; height: 1.5px; }
.dn__stars i:nth-child(3) { left: 5px; top: 17px; width: 1.5px; height: 1.5px; }
.dn__stars i:nth-child(4) { left: 19px; top: 5px; }
.daynight[aria-checked="true"] .dn::before { opacity: 1; }
.daynight[aria-checked="true"] .dn__knob {
  transform: translateX(22px) rotate(360deg);
  background: radial-gradient(circle at 35% 35%, #FFFFFF, #DADCEE 75%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .12), 0 0 10px 1px rgba(200, 205, 255, .45);
}
.daynight[aria-checked="true"] .dn__moon { opacity: 1; transform: none; }
.daynight[aria-checked="true"] .dn__cloud { transform: translateY(16px); opacity: 0; }
.daynight[aria-checked="true"] .dn__stars i { opacity: 1; transform: scale(1); animation: dn-twinkle 2.4s ease-in-out infinite; }
.daynight[aria-checked="true"] .dn__stars i:nth-child(1) { transition-delay: .15s; }
.daynight[aria-checked="true"] .dn__stars i:nth-child(2) { transition-delay: .25s; animation-delay: .6s; }
.daynight[aria-checked="true"] .dn__stars i:nth-child(3) { transition-delay: .32s; animation-delay: 1.2s; }
.daynight[aria-checked="true"] .dn__stars i:nth-child(4) { transition-delay: .4s; animation-delay: 1.8s; }
.daynight:hover .dn__knob { filter: brightness(1.05); }
.daynight:active .dn__knob { width: 24px; }
.daynight[aria-checked="true"]:active .dn__knob { transform: translateX(18px) rotate(360deg); }
@keyframes dn-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.daynight:focus-visible { box-shadow: var(--focus); }

/* Bascule du thème : dévoilement en cercle (View Transitions) */
:root.vt-theme::view-transition-old(root), :root.vt-theme::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.vt-theme::view-transition-new(root) { z-index: 2; }

/* ---------- Icônes animées ---------- */
.ico { transform-box: fill-box; transform-origin: 50% 50%; }
.ico-bell { transform-origin: 50% 8%; }
.ico-pin, .ico-drop { transform-origin: 50% 100%; }

@keyframes i-hop { 0%, 100% { transform: none; } 35% { transform: translateY(-3px) scale(1.06); } 65% { transform: translateY(0) scale(.97, 1.03); } }
@keyframes i-ring { 0%, 100% { transform: none; } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }
@keyframes i-shake { 0%, 100% { transform: none; } 20% { transform: rotate(-10deg); } 40% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); } }
@keyframes i-tilt { 0%, 100% { transform: none; } 40% { transform: rotate(-8deg) translateY(-1px); } 70% { transform: rotate(4deg); } }
@keyframes i-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes i-quarter { 0% { transform: none; } 60% { transform: rotate(100deg); } 100% { transform: rotate(90deg); } }
@keyframes i-right { 0%, 100% { transform: none; } 50% { transform: translateX(3px); } }
@keyframes i-left { 0%, 100% { transform: none; } 50% { transform: translateX(-3px); } }
@keyframes i-up { 0%, 100% { transform: none; } 45% { transform: translateY(-3px); } }
@keyframes i-down { 0%, 100% { transform: none; } 45% { transform: translateY(3px); } }
@keyframes i-diag { 0%, 100% { transform: none; } 45% { transform: translate(2px, -2px); } }
@keyframes i-pop { 0%, 100% { transform: none; } 40% { transform: scale(1.2); } 70% { transform: scale(.94); } }
@keyframes i-flip { 0%, 100% { transform: none; } 50% { transform: scaleY(.55); } }
@keyframes i-blink { 0%, 100% { transform: none; } 45%, 55% { transform: scaleY(.15); } }
@keyframes i-fly { 0% { transform: none; } 45% { transform: translate(5px, -5px) scale(.8); opacity: 0; } 46% { transform: translate(-5px, 5px) scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes i-float { 0%, 100% { transform: none; } 50% { transform: translateY(-2px); } }
@keyframes i-flash { 0%, 100% { opacity: 1; } 30% { opacity: .25; } 60% { opacity: 1; transform: scale(1.12); } }
@keyframes i-drop { 0% { transform: none; } 30% { transform: translateY(-4px); } 55% { transform: translateY(0) scale(1.08, .9); } 80% { transform: translateY(-1px); } 100% { transform: none; } }
@keyframes i-turn { 0%, 100% { transform: none; } 50% { transform: rotate(-35deg); } }

/* Qui fait quoi */
.ico-home, .ico-user, .ico-building, .ico-building-2, .ico-landmark, .ico-door, .ico-coins, .ico-euro, .ico-wallet { --i-anim: i-hop; }
.ico-bell, .ico-timer, .ico-clock { --i-anim: i-ring; }
.ico-alert, .ico-lock, .ico-shield, .ico-trash { --i-anim: i-shake; }
.ico-file, .ico-folder, .ico-receipt, .ico-book, .ico-archive, .ico-box, .ico-mail, .ico-message, .ico-edit, .ico-copy, .ico-image { --i-anim: i-tilt; }
.ico-settings, .ico-refresh, .ico-spark, .ico-history { --i-anim: i-spin; }
.ico-plus, .ico-grid, .ico-x { --i-anim: i-quarter; }
.ico-chevron-right, .ico-chevron, .ico-logout, .ico-chevron-down { --i-anim: i-right; }
.ico-chevron-left { --i-anim: i-left; }
.ico-upload { --i-anim: i-up; }
.ico-download { --i-anim: i-down; }
.ico-external { --i-anim: i-diag; }
.ico-check, .ico-search, .ico-scan, .ico-info, .ico-phone, .ico-heat { --i-anim: i-pop; }
.ico-calendar { --i-anim: i-flip; }
.ico-eye { --i-anim: i-blink; }
.ico-send { --i-anim: i-fly; }
.ico-cloud, .ico-moon { --i-anim: i-float; }
.ico-bolt { --i-anim: i-flash; }
.ico-pin, .ico-drop { --i-anim: i-drop; }
.ico-key, .ico-wrench { --i-anim: i-turn; }
.ico-menu { --i-anim: i-flip; }

/* Au survol (souris) et à l’appui (doigt), l’icône du bouton joue une fois */
@media (hover: hover) {
  :is(button, a, label):hover > .ico,
  :is(button, a, label):hover > .item__icon > .ico,
  :is(button, a, label):hover > .item__aside > .ico,
  :is(button, a):hover > .tab__plus > .ico,
  .topic:hover .ico,
  .item:hover .item__icon .ico { animation: var(--i-anim, i-pop) .7s cubic-bezier(.3, .7, .3, 1) both; }
  .ico-settings, .ico-refresh, .ico-spark, .ico-history { animation-duration: .9s !important; }
}
:is(button, a, label):active > .ico,
:is(button, a, label):active > .item__icon > .ico,
:is(button, a):active > .tab__plus > .ico { animation: var(--i-anim, i-pop) .6s cubic-bezier(.3, .7, .3, 1) both; }

/* L’onglet qu’on vient d’ouvrir s’anime (barre du bas : elle n’est pas redessinée à chaque mise à jour) */
.tab[aria-current="page"] > .ico { animation: var(--i-anim, i-pop) .7s cubic-bezier(.3, .7, .3, 1) both; }
.tab[aria-current="page"] > .ico-home { animation-name: i-hop; }

/* La cloche sonne à l’arrivée d’une notification */
.is-ringing > .ico-bell { animation: i-ring 1s ease both; }
.is-ringing .icon-btn__dot { animation: i-pop .6s ease .2s both; }

/* Icônes de l’état vide : légère respiration */
.empty__icon .ico { animation: i-float 3.2s ease-in-out infinite; }

/* ---------- Fluidité ---------- */
.item, .shortcut, .template, .topic, .doc__open, .sheet__link, .pick__opt, .choice span, .pill, .tab, .nav__item, .check, .cal__day, .icon-btn, .avatar, .link {
  transition: transform .25s cubic-bezier(.3, .7, .3, 1), background-color .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
}
button.item:active, a.item:active, .shortcut:active, .template:active, .sheet__link:active, .pick__opt:active, .pill:active, .cal__day:active, .check:active, .doc__open:active { transform: scale(.98); }
.tab:active > .ico, .icon-btn:active, .avatar:active { transform: scale(.9); }
.choice span { transition-duration: .2s; }
.input { transition: border-color .2s ease, box-shadow .25s ease, background-color .25s ease; }
.switch, .switch::after { transition-timing-function: cubic-bezier(.5, 1.5, .45, 1); transition-duration: .35s; }
.bar span { transition: width .8s cubic-bezier(.3, .7, .3, 1); }
.toast { transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), opacity .3s ease; }
.toast:not(.is-shown) { transform: translate(-50%, 24px) scale(.96); }

/* Ouverture des fenêtres */
@keyframes dlg-pop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
dialog[open]::backdrop { animation: fade-in .3s ease; }
.dlg[open], .sheet[open], .confirm-dlg[open] { animation: dlg-pop .34s cubic-bezier(.3, .8, .3, 1); }
@media (max-width: 640px) {
  .dlg[open], .sheet[open] { animation: sheet-up .42s cubic-bezier(.3, .9, .3, 1); }
}
/* Les éléments d’un menu apparaissent en vague */
@keyframes link-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sheet[open] .sheet__link { animation: link-in .4s cubic-bezier(.3, .8, .3, 1) both; }
.sheet[open] .sheet__link:nth-child(2) { animation-delay: .03s; }
.sheet[open] .sheet__link:nth-child(3) { animation-delay: .06s; }
.sheet[open] .sheet__link:nth-child(4) { animation-delay: .09s; }
.sheet[open] .sheet__link:nth-child(5) { animation-delay: .12s; }
.sheet[open] .sheet__link:nth-child(6) { animation-delay: .15s; }
.sheet[open] .sheet__link:nth-child(7) { animation-delay: .18s; }
.sheet[open] .sheet__link:nth-child(8) { animation-delay: .21s; }
.sheet[open] .sheet__link:nth-child(n+9) { animation-delay: .24s; }

/* ---------- Moins d’animations ---------- */
@media (prefers-reduced-motion: reduce) {
  .ico, .dn *, .dn::before, .sheet__link { animation: none !important; transition: none !important; }
}
:root.reduce-motion .ico, :root.reduce-motion .dn *, :root.reduce-motion .dn::before { animation: none !important; transition: none !important; }
.about { margin-top: var(--sec-gap); }
