*, *::before, *::after { box-sizing: border-box; margin: 0; }

:root {
  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent),
            0 8px 24px -12px color-mix(in srgb, var(--text) 18%, transparent);
}

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body), Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain papier */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain, .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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Halo chaud en haut de page */
.glow {
  position: fixed;
  top: -220px;
  left: 50%;
  width: 640px;
  height: 480px;
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--accent2) 30%, transparent), transparent),
    radial-gradient(closest-side at 70% 60%, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
  filter: blur(20px);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(64px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom));
}

/* ---------- Hero ---------- */
.hero { text-align: center; }

.avatar {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 0 auto 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent2), var(--accent)) center / cover no-repeat;
  color: #fff;
  font-family: var(--font-title), Georgia, serif;
  font-style: italic;
  font-size: 3.4rem;
  font-weight: 500;
  box-shadow: 0 12px 32px -10px color-mix(in srgb, var(--accent) 60%, transparent);
  animation: rise .7s var(--ease) both;
}
.avatar::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent2) 55%, transparent);
}

h1 {
  font-family: var(--font-title), Georgia, serif;
  font-size: 2.6rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.02em;
  line-height: 1.05;
  animation: rise .7s .06s var(--ease) both;
}

.bio {
  margin-top: 10px;
  color: var(--muted);
  font-size: 1.1rem;
  font-style: italic;
  animation: rise .7s .12s var(--ease) both;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 26px auto 30px;
  color: var(--accent2);
  font-size: .8rem;
  animation: rise .7s .18s var(--ease) both;
}
.ornament span {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent2) 70%, transparent));
}
.ornament span:last-child { transform: scaleX(-1); }

/* ---------- Liens ---------- */
.links { display: flex; flex-direction: column; gap: 12px; }

.link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 16px 12px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--text) 9%, transparent);
  box-shadow: var(--shadow);
  touch-action: manipulation;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
  animation: rise .7s var(--ease) both;
}
.link:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 6%, transparent),
              0 16px 32px -14px color-mix(in srgb, var(--accent) 45%, transparent);
}
.link:active { transform: scale(.98); transition-duration: .1s; }

.link .icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: calc(var(--radius) - 6px);
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.link .text { flex: 1; min-width: 0; text-align: left; }
.link .title { display: block; font-weight: 600; font-size: 1.05rem; line-height: 1.25; }
.link .subtitle { display: block; margin-top: 2px; color: var(--muted); font-size: .9rem; font-style: italic; }

.link .arrow {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform .25s var(--ease), color .25s;
}
.link:hover .arrow { transform: translate(2px, -2px); color: var(--accent); }

/* Bouton principal */
.link.highlight {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent2)));
  color: var(--accent-text);
  border-color: transparent;
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--accent) 80%, transparent);
}
.link.highlight .icon { background: color-mix(in srgb, var(--accent-text) 18%, transparent); color: var(--accent-text); }
.link.highlight .subtitle,
.link.highlight .arrow { color: color-mix(in srgb, var(--accent-text) 82%, transparent); }
.link.highlight:hover .arrow { color: var(--accent-text); }

/* Icônes SVG */
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon .brand {
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}
.icon .emoji { font-size: 1.4rem; }

/* ---------- Histoires ---------- */
.stories { margin-top: 44px; }
.stories h2 {
  font-family: var(--font-title), Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 18px;
}

.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.book {
  display: block;
  color: var(--text);
  text-decoration: none;
  animation: rise .7s var(--ease) both;
}
.book .cover {
  aspect-ratio: 256 / 400;
  border-radius: 4px 10px 10px 4px;
  overflow: hidden;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  box-shadow: inset 4px 0 6px -3px rgba(0,0,0,.35), 0 10px 22px -10px rgba(0,0,0,.45);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.book img { width: 100%; height: 100%; object-fit: cover; display: block; }
.book:hover .cover { transform: translateY(-4px) rotate(-1.5deg); box-shadow: inset 4px 0 6px -3px rgba(0,0,0,.35), 0 18px 30px -12px rgba(0,0,0,.5); }
.book .book-title { display: block; margin-top: 10px; font-size: .9rem; font-weight: 600; line-height: 1.25; }
.book .book-tag { display: block; font-size: .8rem; color: var(--muted); font-style: italic; }

/* ---------- Partage ---------- */
.share {
  position: fixed;
  z-index: 10;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease);
}
.share svg { width: 20px; height: 20px; }
.share:active { transform: scale(.92); }

.toast {
  position: absolute;
  top: 52px;
  right: 0;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: .85rem;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: none; }

footer {
  margin-top: 48px;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}

a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
