/* ==========================================================================
   KAURY STUDIO — Convertisseur
   Reprend le design system : orange #F56E2E, beige #F1E8CB, noir #1C1A1A.
   Typo : Cabinet Grotesk (titres) + Satoshi (texte).
   ========================================================================== */
@font-face {
  font-family: 'Cabinet Grotesk';
  src: url('/fonts/cabinet-grotesk-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Cabinet Grotesk';
  src: url('/fonts/cabinet-grotesk-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('/fonts/satoshi-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('/fonts/satoshi-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  src: url('/fonts/satoshi-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --beige: #f1e8cb;
  --beige-2: #e9ddb9;
  --paper: #f7f0da;
  --noir: #1c1a1a;
  --orange: #f56e2e;
  --orange-texte: #a83e0d;
  --vert: #3d5c3d;
  --due: #a6382a;

  --encre: var(--noir);
  --encre-2: rgba(28, 26, 26, 0.72);
  --ligne: rgba(28, 26, 26, 0.16);
  --ligne-forte: rgba(28, 26, 26, 0.28);

  --police-titre: 'Cabinet Grotesk', 'Arial Black', sans-serif;
  --police-texte: 'Satoshi', 'Helvetica Neue', sans-serif;

  --display-xl: clamp(2.6rem, 7vw, 6rem);
  --display-l: clamp(2rem, 5vw, 3.6rem);

  --rayon-media: 24px;
  --rayon-pilule: 999px;
  --largeur-max: 1120px;
  --gouttiere: clamp(1.25rem, 4vw, 3.5rem);
  --sortie: cubic-bezier(0.16, 1, 0.3, 1);
  --z-header: 40;
  --z-grain: 60;
}

/* ---- Mode sombre ---- */
:root[data-theme='dark'] {
  --beige: #17140e;
  --beige-2: #241f16;
  --paper: #1f1b13;
  --noir: #f3ecd7;
  --orange: #f56e2e;
  --orange-texte: #f7a468;
  --vert: #8fb88f;

  --encre: #f3ecd7;
  --encre-2: rgba(243, 236, 215, 0.72);
  --ligne: rgba(243, 236, 215, 0.16);
  --ligne-forte: rgba(243, 236, 215, 0.3);
}
:root[data-theme='dark'] .grain {
  mix-blend-mode: screen;
  opacity: 0.05;
}
:root[data-theme='dark'] .btn-orange {
  color: #1c1a1a;
}
:root[data-theme='dark'] .btn-orange:hover {
  background: #f3ecd7;
  color: #1c1a1a;
}
:root[data-theme='dark'] .seg.actif,
:root[data-theme='dark'] .mode.actif {
  color: #1c1a1a;
}
:root[data-theme='dark'] .outil {
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.6);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--beige);
  color: var(--encre);
  font-family: var(--police-texte);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--police-titre);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
  margin: 0;
  text-wrap: balance;
}

:focus-visible {
  outline: 3px solid var(--noir);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--orange);
  color: var(--noir);
}

.accent-italique {
  font-style: italic;
  color: var(--orange-texte);
  line-height: 1.1;
}

/* Grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.conteneur {
  max-width: var(--largeur-max);
  margin-inline: auto;
  padding-inline: var(--gouttiere);
}

/* Header */
.entete {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in srgb, var(--beige) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ligne);
}
.entete-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 2rem;
}
.entete-logo {
  display: inline-flex;
  align-items: center;
  color: var(--noir);
  text-decoration: none;
}
.logo-mot {
  height: 26px;
  width: auto;
  display: block;
  transition: opacity 0.25s var(--sortie);
}
.entete-logo:hover .logo-mot {
  opacity: 0.75;
}
.entete-nav a {
  font-weight: 500;
  text-decoration: none;
  color: var(--noir);
  position: relative;
}
.entete-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--sortie);
}
.entete-nav a:hover::after {
  transform: scaleX(1);
}

/* Bouton theme (soleil/lune) */
.btn-theme {
  background: none;
  border: 1.5px solid var(--ligne-forte);
  border-radius: var(--rayon-pilule);
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--noir);
  transition: border-color 0.25s var(--sortie), transform 0.25s var(--sortie);
}
.btn-theme:hover {
  border-color: var(--orange);
  transform: rotate(-15deg);
}

/* Bouton coller */
.btn-coller {
  flex: 0 0 auto;
  background: var(--beige-2);
  border: 2px solid var(--ligne-forte);
  border-radius: var(--rayon-pilule);
  padding: 0 1.1rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--encre-2);
  cursor: pointer;
  transition: border-color 0.25s var(--sortie), color 0.25s var(--sortie);
}
.btn-coller:hover {
  border-color: var(--orange);
  color: var(--noir);
}

/* Hero */
.hero {
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(1.5rem, 3vw, 2.5rem);
  text-align: center;
}
.hero-kicker {
  display: inline-block;
  margin: 0 0 1.1rem;
  padding: 0.3rem 0.9rem;
  border: 1.5px solid var(--vert);
  border-radius: var(--rayon-pilule);
  color: var(--vert);
  font-size: 0.82rem;
  font-weight: 700;
}
.hero-titre {
  font-size: var(--display-xl);
}
.hero-sous {
  max-width: 46ch;
  margin: 1.4rem auto 0;
  color: var(--encre-2);
  font-size: 1.1rem;
}

/* Selecteur de mode */
.mode-switch {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin: 0 auto clamp(1.5rem, 3vw, 2.2rem);
  background: var(--beige-2);
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon-pilule);
  max-width: 560px;
}
.mode {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--encre-2);
  padding: 0.75rem 1rem;
  border-radius: var(--rayon-pilule);
  cursor: pointer;
  transition: background 0.25s var(--sortie), color 0.25s var(--sortie);
}
.mode.actif {
  background: var(--noir);
  color: var(--beige);
}
.mode-ico {
  margin-right: 0.3rem;
}
.panneau[hidden] {
  display: none;
}

/* Zone de depot */
.depot {
  border: 2px dashed var(--ligne-forte);
  border-radius: 18px;
  background: var(--beige);
  padding: clamp(2rem, 5vw, 3.2rem) 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s var(--sortie), background 0.25s var(--sortie);
}
.depot:hover,
.depot:focus-visible,
.depot.survol {
  border-color: var(--orange);
  background: var(--paper);
}
.depot-ico {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 0.6rem;
}
.depot-titre {
  margin: 0;
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.25rem;
}
.depot-sous {
  margin: 0.35rem 0 0;
  color: var(--encre-2);
  font-size: 0.92rem;
}
.depot-badge {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  border-radius: var(--rayon-pilule);
  border: 1.5px solid var(--vert);
  color: var(--vert);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.7rem;
}
.depot-nom {
  margin: 0;
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.15rem;
  word-break: break-all;
}
.depot-taille {
  margin: 0.3rem 0 0.6rem;
  color: var(--encre-2);
  font-size: 0.9rem;
}
.lien-retirer {
  background: none;
  border: none;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--orange-texte);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.conv-options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  margin-top: 1.5rem;
}
.conv-options .champ-qualite {
  flex: 1 1 220px;
}
.conv-options .btn-large {
  margin-top: 0;
  width: auto;
  flex: 0 0 auto;
}
@media (max-width: 560px) {
  .conv-options .btn-large {
    width: 100%;
  }
}

/* Carte outil */
.outil {
  background: var(--paper);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-media);
  box-shadow: 0 24px 60px -34px rgba(28, 26, 26, 0.4);
  padding: clamp(1.4rem, 3.5vw, 2.6rem);
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.barre-url {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.barre-url input {
  flex: 1 1 320px;
  min-width: 0;
  padding: 1rem 1.15rem;
  border: 2px solid var(--ligne-forte);
  border-radius: var(--rayon-pilule);
  background: var(--beige);
  color: var(--noir);
  font: inherit;
  font-weight: 500;
}
.barre-url input:focus {
  outline: 3px solid var(--orange);
  outline-offset: 0;
  border-color: var(--orange);
}
.barre-astuce {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
  color: var(--encre-2);
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 1.9rem;
  border-radius: var(--rayon-pilule);
  border: 2px solid var(--noir);
  font-family: var(--police-texte);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.3s var(--sortie), background-color 0.3s var(--sortie),
    color 0.3s var(--sortie);
}
.btn-orange {
  background: var(--orange);
  color: var(--noir);
}
.btn-orange:hover {
  transform: translateY(-2px);
  background: var(--noir);
  color: var(--beige);
}
.btn:active {
  transform: scale(0.98);
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-large {
  width: 100%;
  padding: 1.15rem 2rem;
  font-size: 1.1rem;
  margin-top: 1.6rem;
}
.btn.charge .btn-txt {
  opacity: 0.6;
}

/* Message */
.message {
  margin-top: 1.2rem;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
}
.message.erreur {
  background: #f4ddd6;
  color: var(--due);
  border: 1.5px solid var(--due);
}
.message.info {
  background: var(--beige-2);
  color: var(--encre-2);
  border: 1.5px solid var(--ligne);
}

/* Resultat */
.resultat {
  margin-top: 1.8rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--ligne);
}
.video-tete {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}
.video-vignette {
  position: relative;
  flex: 0 0 auto;
  width: 168px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: var(--beige-2);
}
.video-vignette img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.badge-duree {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(28, 26, 26, 0.85);
  color: var(--beige);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.42rem;
  border-radius: 6px;
}
.video-titre {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-family: var(--police-titre);
  font-weight: 700;
  line-height: 1.15;
}
.video-auteur {
  margin: 0.4rem 0 0;
  color: var(--encre-2);
  font-size: 0.95rem;
}

/* Choix format */
.choix {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.6rem;
  align-items: flex-end;
}
.segment {
  display: inline-flex;
  padding: 5px;
  background: var(--beige-2);
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon-pilule);
  gap: 4px;
}
.seg {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--encre-2);
  padding: 0.6rem 1.1rem;
  border-radius: var(--rayon-pilule);
  cursor: pointer;
  transition: background 0.25s var(--sortie), color 0.25s var(--sortie);
}
.seg.actif {
  background: var(--noir);
  color: var(--beige);
}
.seg-ico {
  margin-right: 0.15rem;
}

.champ-qualite {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 200px;
  min-width: 180px;
}
.champ-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--encre-2);
}
.select-qualite {
  padding: 0.8rem 1rem;
  border: 2px solid var(--ligne-forte);
  border-radius: 14px;
  background: var(--beige);
  color: var(--noir);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.select-qualite:focus {
  outline: 3px solid var(--orange);
  outline-offset: 0;
  border-color: var(--orange);
}

/* Option (checkbox) */
.option-ligne {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--encre-2);
  cursor: pointer;
}
.option-ligne input {
  width: 18px;
  height: 18px;
  accent-color: var(--orange);
  cursor: pointer;
}

/* Reglages avances */
.avance {
  margin-top: 1.3rem;
  border: 1.5px solid var(--ligne);
  border-radius: 14px;
  background: var(--beige);
  padding: 0.4rem 1rem;
}
.avance > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.6rem 0;
  color: var(--encre-2);
  list-style: none;
}
.avance > summary::before {
  content: '⚙ ';
}
.avance[open] > summary {
  border-bottom: 1px solid var(--ligne);
  margin-bottom: 0.9rem;
}
.avance-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  padding-bottom: 0.9rem;
}
.avance-grille .champ-qualite[hidden] {
  display: none;
}

/* Progression */
.progression {
  margin-top: 1.4rem;
}
.progression-detail {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--orange-texte);
  min-height: 1.1em;
}
.progression-tete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
}
.btn-annuler {
  background: none;
  border: 1.5px solid var(--ligne-forte);
  border-radius: var(--rayon-pilule);
  padding: 0.35rem 0.9rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--encre-2);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-annuler:hover {
  border-color: var(--due);
  color: var(--due);
}

/* Miniature / extras */
.extras {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
.extra-lien {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon-pilule);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--encre-2);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.extra-lien:hover {
  border-color: var(--orange);
  color: var(--orange-texte);
}

/* Decoupe (trim) */
.trim {
  margin-top: 1.1rem;
  border: 1.5px solid var(--ligne);
  border-radius: 14px;
  background: var(--beige);
  padding: 0.4rem 1rem;
}
.trim > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.6rem 0;
  color: var(--encre-2);
  list-style: none;
}
.trim > summary::before {
  content: '✂ ';
}
.trim-grille {
  display: flex;
  gap: 0.8rem;
  padding: 0.3rem 0 0.9rem;
}
.trim-grille label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--encre-2);
}
.trim-grille input {
  padding: 0.6rem 0.7rem;
  border: 2px solid var(--ligne-forte);
  border-radius: 12px;
  background: var(--beige-2);
  color: var(--noir);
  font: inherit;
}

/* Historique */
.historique {
  margin-bottom: clamp(3rem, 6vw, 5rem);
}
.historique h2 {
  font-size: 1.3rem;
  font-family: var(--police-texte);
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.histo-vider {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--orange-texte);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.histo-liste {
  display: grid;
  gap: 0.6rem;
}
.histo-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--paper);
  border: 1px solid var(--ligne);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
}
.histo-ico {
  font-size: 1.2rem;
}
.histo-nom {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.histo-meta {
  color: var(--encre-2);
  font-size: 0.82rem;
  white-space: nowrap;
}
.histo-rejouer {
  background: none;
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon-pilule);
  padding: 0.3rem 0.75rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--encre-2);
  cursor: pointer;
}
.histo-rejouer:hover {
  border-color: var(--orange);
  color: var(--orange-texte);
}
.barre-fond {
  height: 12px;
  background: var(--beige-2);
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon-pilule);
  overflow: hidden;
}
.barre-jauge {
  height: 100%;
  width: 0%;
  background: var(--orange);
  border-radius: var(--rayon-pilule);
  transition: width 0.35s var(--sortie);
}
.progression-ligne {
  display: flex;
  justify-content: space-between;
  margin-top: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--encre-2);
}

/* Notes */
.notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-bottom: clamp(3rem, 6vw, 5rem);
}
.note {
  background: var(--paper);
  border: 1px solid var(--ligne);
  border-radius: 18px;
  padding: 1.4rem 1.5rem;
}
.note h3 {
  font-size: 1.05rem;
  font-family: var(--police-texte);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.note p {
  margin: 0;
  color: var(--encre-2);
  font-size: 0.95rem;
}

/* Pied */
.pied-mini {
  border-top: 1px solid var(--ligne);
  padding-block: 1.8rem;
  font-size: 0.9rem;
  color: var(--encre-2);
}
.pied-mini a {
  color: var(--orange-texte);
  font-weight: 700;
  text-decoration: none;
}

/* Reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
}
[data-reveal].visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s var(--sortie), transform 0.8s var(--sortie);
}

/* Responsive */
@media (max-width: 720px) {
  .notes {
    grid-template-columns: 1fr;
  }
  .video-tete {
    flex-direction: column;
    align-items: flex-start;
  }
  .video-vignette {
    width: 100%;
  }
  .entete-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}
