/* Startpage du foyer — esprit Bonjourr : plein écran, épuré, ambiance qui
   suit l'heure du jour (data-theme sur <html>, posé par main.js). */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ——— Ambiances ——— */
[data-theme="night"] {
  --bg: linear-gradient(168deg, #060913 0%, #0d1428 52%, #070b18 100%);
  --halo-a: rgba(99, 102, 241, 0.16);
  --halo-b: rgba(45, 212, 191, 0.07);
  --ink: #eef0fb;
  --ink-soft: rgba(238, 240, 251, 0.62);
  --glass: rgba(255, 255, 255, 0.07);
  --glass-edge: rgba(255, 255, 255, 0.11);
  --glass-hover: rgba(255, 255, 255, 0.12);
}
[data-theme="dawn"] {
  --bg: linear-gradient(168deg, #1c2140 0%, #574468 48%, #c08a76 100%);
  --halo-a: rgba(255, 196, 130, 0.22);
  --halo-b: rgba(147, 129, 255, 0.14);
  --ink: #fdf3ec;
  --ink-soft: rgba(253, 243, 236, 0.68);
  --glass: rgba(255, 255, 255, 0.10);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --glass-hover: rgba(255, 255, 255, 0.17);
}
[data-theme="day"] {
  --bg: linear-gradient(165deg, #dcebf7 0%, #b5d2ec 55%, #8fb4da 100%);
  --halo-a: rgba(255, 255, 255, 0.55);
  --halo-b: rgba(96, 165, 250, 0.20);
  --ink: #1c2a3f;
  --ink-soft: rgba(28, 42, 63, 0.62);
  --glass: rgba(255, 255, 255, 0.38);
  --glass-edge: rgba(255, 255, 255, 0.55);
  --glass-hover: rgba(255, 255, 255, 0.52);
}
[data-theme="dusk"] {
  --bg: linear-gradient(168deg, #171b36 0%, #45305c 52%, #a05a4c 100%);
  --halo-a: rgba(251, 146, 60, 0.20);
  --halo-b: rgba(129, 100, 255, 0.14);
  --ink: #f7efe9;
  --ink-soft: rgba(247, 239, 233, 0.66);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-edge: rgba(255, 255, 255, 0.13);
  --glass-hover: rgba(255, 255, 255, 0.14);
}

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: #060913;
  overflow: hidden;
}

/* ——— Fond : dégradé + halos flottants + grain ——— */
.bg {
  position: fixed;
  inset: 0;
  background: var(--bg);
  transition: background 1.2s ease;
  z-index: -1;
  overflow: hidden;
}
.halo {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
}
.halo-a {
  width: 55vmax; height: 55vmax;
  top: -18vmax; right: -12vmax;
  background: var(--halo-a);
  animation: drift-a 26s var(--ease) infinite alternate;
}
.halo-b {
  width: 45vmax; height: 45vmax;
  bottom: -16vmax; left: -10vmax;
  background: var(--halo-b);
  animation: drift-b 32s var(--ease) infinite alternate;
}
@keyframes drift-a { to { transform: translate(-6vmax, 5vmax) scale(1.12); } }
@keyframes drift-b { to { transform: translate(5vmax, -4vmax) scale(1.08); } }

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ——— Mise en page ——— */
main {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8vh 24px calc(5vh + env(safe-area-inset-bottom));
  animation: appear 0.9s var(--ease) both;
}
@keyframes appear {
  from { opacity: 0; transform: translateY(10px); }
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: auto;
  margin-bottom: auto;
}

/* Horloge géante, graisse fine */
#clock {
  font-size: clamp(4.5rem, 17vmin, 9.5rem);
  font-weight: 200;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.18);
}

.date {
  margin-top: 0.9rem;
  font-size: clamp(1rem, 2.6vmin, 1.35rem);
  font-weight: 400;
  color: var(--ink-soft);
  text-transform: capitalize;
}

.greeting {
  margin-top: 0.35rem;
  font-size: clamp(1.1rem, 3vmin, 1.6rem);
  font-weight: 300;
}

/* Pastille météo */
.weather {
  margin-top: 1.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: inherit;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s var(--ease);
}
.weather:hover { background: var(--glass-hover); transform: translateY(-2px); }
.weather-main { font-size: 1.05rem; font-weight: 500; }
.weather-sub { font-size: 0.8rem; color: var(--ink-soft); }

/* Recherche discrète */
.search {
  margin-top: 2.2rem;
  position: relative;
  width: min(30rem, 86vw);
  opacity: 0.75;
  transition: opacity 0.25s ease;
}
.search:focus-within, .search:hover { opacity: 1; }
.search-icon {
  position: absolute;
  left: 1.05rem; top: 50%;
  translate: 0 -50%;
  width: 1.05rem; height: 1.05rem;
  color: var(--ink-soft);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 0.85rem 1.2rem 0.85rem 2.9rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.search input::placeholder { color: var(--ink-soft); }
.search input:focus { border-color: var(--ink-soft); background: var(--glass-hover); }
.search input::-webkit-search-cancel-button { display: none; }

/* Tuiles de services — marge suffisante pour la lévitation (rien ne rogne) */
.links {
  display: flex;
  gap: clamp(0.9rem, 3vw, 1.6rem);
  padding: 6px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  width: clamp(5.2rem, 16vw, 6.5rem);
  padding: 1rem 0.5rem 0.85rem;
  border-radius: 1.4rem;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: inherit;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.3s var(--ease), box-shadow 0.3s ease;
}
.tile:hover, .tile:focus-visible {
  background: var(--glass-hover);
  transform: translateY(-5px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}
.tile:active { transform: translateY(-2px) scale(0.98); }
.tile-icon { width: 1.7rem; height: 1.7rem; opacity: 0.92; }
.tile-icon svg { width: 100%; height: 100%; }
.tile-label { font-size: 0.82rem; font-weight: 500; letter-spacing: 0.01em; }

/* ——— Divers ——— */
@media (prefers-reduced-motion: reduce) {
  .halo { animation: none; }
  main { animation: none; }
}
@media (max-height: 520px) {
  main { padding-top: 4vh; }
  .search { margin-top: 1.2rem; }
}
