/* Altear : pages secondaires (portfolio, contact, pages légales, 404).
   Chargé après style.css et motion.css. Réutilise le hero, .section, .card et .cta-card de l'accueil ;
   ne contient que ce qui n'existe pas déjà. */

/* ---------- Hero des pages secondaires (famille du hero d'accueil) ---------- */
.page-hero { padding-bottom: clamp(104px, 10vw, 140px); margin-bottom: clamp(-64px, -5vw, -40px); -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 96px), transparent); mask-image: linear-gradient(180deg, #000 calc(100% - 96px), transparent); } /* fondu limité à la marge basse : le texte reste net */
.page-hero .hero-gl, .page-hero .deco-orb { -webkit-mask-image: linear-gradient(180deg, #000 50%, transparent); mask-image: linear-gradient(180deg, #000 50%, transparent); }
.page-hero .hero-title { font-size: clamp(2.8rem, 10.5vw, 6.2rem); max-width: 16ch; margin-inline: auto; }
.page-hero .hero-lead { margin-inline: auto; }
.page-hero .eyebrow.center { margin-bottom: 22px; }
.page-hero .updated { margin-top: 20px; }
.page-hero .legal-nav { justify-content: center; margin: 30px 0 0; }
.page-hero .legal-nav a { min-height: 44px; display: inline-flex; align-items: center; }
.page-hero .hero-ctas { margin-top: 30px; }
/* La première section suit directement le hero : pas de double marge, le filet reste */
.page-hero + .section { padding-top: clamp(48px, 7vw, 88px); }

/* ---------- Pages légales : sommaire + colonne de lecture ---------- */
.legal-layout { display: grid; gap: 24px; align-items: start; }
.toc { padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--glass); }
.toc-title { margin: 0 0 10px; font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.toc a {
  display: block; padding: 7px 10px; margin-inline: -10px; border-radius: 8px;
  font-size: .9rem; line-height: 1.35; color: var(--muted); text-decoration: none;
  transition: color .2s, background-color .2s;
}
.toc a:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.legal-card { display: block; min-height: 0; width: 100%; max-width: calc(68ch + 2 * clamp(22px, 4vw, 48px)); padding: clamp(22px, 4vw, 48px); }
.legal-card::before { display: none; }
.legal-card.prose { max-width: calc(68ch + 2 * clamp(22px, 4vw, 48px)); }
.legal-sec { scroll-margin-top: calc(var(--nav-h) + 24px); }
.legal-sec h2 { scroll-margin-top: calc(var(--nav-h) + 24px); }
.legal-sec:first-child h2 { margin-top: 0; }
.legal-sec + .legal-sec { margin-top: 8px; }
@media (min-width: 1000px) {
  .legal-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; }
  .toc { position: sticky; top: calc(var(--nav-h) + 24px); max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; }
}

/* ---------- Portfolio ---------- */
.skills-grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .skills-grid { grid-template-columns: repeat(3, 1fr); } }
.skill-card { min-height: 0; }
.skill-card h3 { margin-bottom: 16px; }
.skill-card .chips { margin: 0; }
.projects { display: grid; gap: 16px; grid-template-columns: 1fr; }
.project { min-height: 0; }
.project.featured { grid-column: auto; }
.project > p:not(.note) { margin-bottom: 20px; }
.project .bench strong { font-size: clamp(1.6rem, 3vw, 2.2rem); }
@media (min-width: 640px) {
  .projects { grid-template-columns: repeat(2, 1fr); }
  .project.featured { grid-column: span 2; }
}
@media (min-width: 960px) { /* bento : deux grandes cartes, puis quatre petites sur une ligne */
  .projects { grid-template-columns: repeat(12, 1fr); }
  .project { grid-column: span 3; }
  .project.featured { grid-column: span 6; }
}

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1.5fr 1fr; } }
.form-card, .info-card { display: block; min-height: 0; }
.form-card .field label { transition: color .2s; }
.form-card .field:focus-within label { color: #c4b5fd; }
.form-card .field input, .form-card .field textarea { min-height: 48px; background: rgba(0, 0, 0, .38); }
.form-card .field input:hover, .form-card .field textarea:hover { border-color: rgba(255, 255, 255, .24); }
.form-card .field input:focus, .form-card .field textarea:focus {
  border-color: rgba(167, 139, 250, .85);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, .2), 0 0 32px -6px rgba(34, 211, 238, .35);
}
.form-card .field input:user-invalid, .form-card .field textarea:user-invalid { border-color: rgba(248, 113, 113, .7); }
.form-card .field input:user-invalid:focus, .form-card .field textarea:user-invalid:focus { box-shadow: 0 0 0 4px rgba(248, 113, 113, .18); }
.form-status { display: flex; align-items: center; gap: 10px; }
.form-status[data-kind="ok"], .form-status[data-kind="error"] { padding: 12px 14px; border-radius: 12px; border: 1px solid transparent; }
.form-status[data-kind="ok"] { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); }
.form-status[data-kind="error"] { border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .08); }
.form-status[data-kind="ok"]::before, .form-status[data-kind="error"]::before {
  content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor;
}
.form-card .btn[type="submit"] { max-width: 100%; }
.info-card a.mail:hover { color: #fff; }
.info-card a.mail { min-height: 44px; }

/* ---------- 404 ---------- */
.hero.page-hero.notfound { min-height: 0; display: block; place-items: unset; padding-inline: 0; padding-top: calc(var(--nav-h) + clamp(40px, 9vh, 100px)); padding-bottom: clamp(56px, 9vw, 110px); }
.notfound .code {
  margin: 0 0 8px; font-size: clamp(7rem, 30vw, 15rem); line-height: .95; letter-spacing: -.06em;
  user-select: none;
}
.notfound .code, .notfound .code * { /* SplitText imbrique ligne > mot > lettre : le dégradé doit atteindre chaque lettre */
  background-image: var(--grad); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
.notfound .nf-title { margin: 0 0 12px; font-size: clamp(1.6rem, 4.5vw, 2.6rem); font-weight: 750; letter-spacing: -.035em; }
.nf-visual { position: relative; width: min(100%, 420px); margin: clamp(40px, 7vw, 64px) auto 0; }
.nf-window {
  position: relative; text-align: left; border-radius: 18px; overflow: visible;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02)), #0a0c14;
  box-shadow: 0 40px 80px -30px rgba(99, 102, 241, .55), 0 0 0 1px rgba(255, 255, 255, .02);
}
.nf-window::before, .nf-window::after { /* fenêtres fantômes derrière, pour la profondeur */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  border: 1px solid var(--border); background: rgba(255, 255, 255, .025);
}
.nf-window::before { transform: translate(14px, 14px) scale(.97); opacity: .7; }
.nf-window::after { transform: translate(28px, 28px) scale(.94); opacity: .4; }
.nf-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.nf-bar span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.nf-bar span:first-child { background: #f87171; }
.nf-bar span:nth-child(2) { background: #fbbf24; }
.nf-bar span:nth-child(3) { background: #34d399; }
.nf-bar b { margin-left: 10px; font: 500 .75rem var(--mono); color: var(--dim); }
.nf-body { position: relative; padding: 22px 20px 26px; display: grid; gap: 12px; }
.nf-line { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .08); }
.nf-line.l1 { width: 70%; } .nf-line.l2 { width: 90%; } .nf-line.l3 { width: 45%; }
.nf-void {
  display: grid; place-items: center; height: 96px; margin-top: 6px; border-radius: 12px;
  border: 1px dashed rgba(167, 139, 250, .45); font: 700 2.6rem var(--font); color: #c4b5fd;
  background: radial-gradient(circle at 50% 0%, rgba(124, 58, 237, .25), transparent 70%);
}
@media (prefers-reduced-motion: no-preference) {
  .nf-visual { animation: nfFloat 6s ease-in-out infinite; }
  .nf-void { animation: nfPulse 3s ease-in-out infinite; }
}
@keyframes nfFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes nfPulse { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }

/* Petits écrans : pas de débordement, cibles tactiles confortables */
@media (max-width: 480px) {
  .page-hero .hero-ctas .btn { width: 100%; }
  .form-card .btn[type="submit"] { width: 100%; }
}

/* ======================================================================
   Phase 2 : pages secondaires sur iPhone (< 760 px)
   ====================================================================== */
@media (max-width: 759px) {
  .page-hero { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 16px); padding-bottom: 64px; margin-bottom: -20px; min-height: 0; -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 52px), transparent); mask-image: linear-gradient(180deg, #000 calc(100% - 52px), transparent); }
  .page-hero .hero-title { font-size: clamp(2.5rem, 12.4vw, 3.6rem); margin-bottom: 12px; }
  .page-hero .eyebrow.center { margin-bottom: 14px; }
  .page-hero .hero-ctas { margin-top: 22px; }
  .page-hero .hero-ctas .btn { height: 52px; }
  .page-hero .updated { margin-top: 14px; }
  .page-hero + .section { padding-top: 28px; }
  .hero.page-hero.notfound { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 16px); padding-bottom: 56px; }
  .nf-visual { margin-top: 36px; }

  /* Pages légales : navigation entre pages = rangée de puces qui défile */
  .page-hero .legal-nav {
    flex-wrap: nowrap; justify-content: flex-start; gap: 8px; margin: 22px calc(-1 * var(--gutter)) 0; padding: 2px var(--gutter);
    overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter);
  }
  .page-hero .legal-nav::-webkit-scrollbar { display: none; }
  .page-hero .legal-nav a { flex: none; white-space: nowrap; scroll-snap-align: start; padding: 0 16px; }

  /* Sommaire : puces horizontales collantes sous l'en-tête */
  .legal-layout { display: block; }
  .toc {
    position: sticky; top: 54px; z-index: 30;
    margin: 0 calc(-1 * var(--gutter)) 16px; padding: 8px var(--gutter); border-radius: 0; border-width: 1px 0;
    background: rgba(5, 6, 10, .78);
    -webkit-backdrop-filter: saturate(170%) blur(16px); backdrop-filter: saturate(170%) blur(16px);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .toc { background: rgba(5, 6, 10, .96); } }
  .toc-title { display: none; }
  .toc ol {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter);
  }
  .toc ol::-webkit-scrollbar { display: none; }
  .toc li { flex: none; scroll-snap-align: start; }
  .toc a {
    display: flex; align-items: center; min-height: 44px; margin: 0; padding: 0 16px; border-radius: 999px; white-space: nowrap;
    border: 1px solid var(--border-strong); background: var(--glass); font-size: .9rem;
  }
  .toc a:active { background: rgba(129, 140, 248, .18); }
  .legal-sec, .legal-sec h2 { scroll-margin-top: calc(var(--nav-h) + 76px); }
  .legal-card { padding: 22px 18px; border-radius: 24px; }
  .prose h2 { margin: 30px 0 10px; font-size: 1.25rem; }
  .prose p, .prose li { line-height: 1.65; }

  /* Portfolio compact */
  .skills-grid, .projects { gap: 12px; }
  .skill-card, .project { padding: 18px; border-radius: 22px; }
  .skill-card h3 { margin-bottom: 10px; }
  .project .meta { margin-bottom: 10px; }
  .project > p:not(.note) { margin-bottom: 14px; }
  .project h3 { font-size: 1.2rem; }
  .project ul { margin-bottom: 14px; font-size: .92rem; line-height: 1.55; }
  .bench { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .bench li { padding: 10px 8px; border-radius: 12px; }
  .bench strong, .project .bench strong { font-size: 1.25rem; }
  .bench span { display: block; margin-top: 2px; font-size: .7rem; line-height: 1.3; }
  .project .links { gap: 8px; }
  .project .links .btn { height: 44px; }
  .chips li { padding: 0 12px; min-height: 34px; display: inline-flex; align-items: center; }

  /* Contact confortable au pouce */
  .contact-grid { gap: 12px; }
  .form-card, .info-card { padding: 20px 18px; border-radius: 24px; }
  .form-card .field { margin-bottom: 14px; }
  .form-card .field input, .form-card .field textarea { min-height: 52px; padding: 14px 16px; font-size: 16px; border-radius: 14px; }
  .form-card .field textarea { min-height: 150px; }
  .field label { font-size: .95rem; }
  .consent input { width: 24px; height: 24px; }
  .form-card .btn[type="submit"] { width: 100%; height: 56px; }
  .info-card a.mail { min-height: 48px; }
}
@media (max-width: 759px) and (hover: none) {
  .form-card .field input:hover, .form-card .field textarea:hover { border-color: var(--border-strong); }
}
