/* Magic Link — charte BWA Agence (reprise de bwagence.fr : palette, Inter, dégradé, galaxie). */

@font-face { font-family: Inter; src: url('/assets/inter-400-subset.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url('/assets/inter-500-subset.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url('/assets/inter-600-subset.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url('/assets/inter-700-subset.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --ink: #101c27;
  --night: #061524;
  --night-2: #0b1f33;
  --paper: #f8f8f4;
  --white: #fff;
  --muted: #647078;
  --line: #dfe3e4;
  --blue: #2187e8;
  --pink: #dc5dca;
  --cyan: #21b6e9;
  --ok: #1f9d6b;
  --bad: #d4455f;
  --gradient: linear-gradient(110deg, #21b6e9 2%, #7079ed 53%, #d85cce 100%);
  --radius: 20px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --shadow: 0 1px 2px #101c270a, 0 12px 40px #101c270f;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font: 400 16px/1.65 Inter, Arial, sans-serif; -webkit-font-smoothing: antialiased;
}
body.dark { background: var(--night); color: #fff; }
main { flex: 1; }
::selection { background: #d4dcfc; color: #071421; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
:focus-visible { outline: 3px solid #5c98f5; outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 400; line-height: 1.08; letter-spacing: -.05em; }
h1 { font-size: clamp(40px, 5.6vw, 76px); }
h2, .h2 { font-size: clamp(30px, 3.6vw, 48px); }
.h3 { font-size: 24px; letter-spacing: -.035em; font-weight: 500; }
.h4 { font-size: 17px; letter-spacing: -.02em; font-weight: 500; margin: 0; }
p { margin: 0 0 1em; }
.shell { width: min(1200px, 100% - 32px); margin-inline: auto; position: relative; z-index: 1; }
.narrow { width: min(620px, 100% - 32px); }
.muted { color: var(--muted); }
.dark .muted, .dark .lead { color: #a5b1be; }
.small { font-size: 13px; }
.block { display: block; }
.lead { font-size: 18px; color: var(--muted); max-width: 620px; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-link { border-bottom: 1px solid currentColor; }

.eyebrow {
  display: flex; align-items: center; gap: 10px; margin-bottom: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; line-height: 1.5;
}
.eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; }
.dark .eyebrow { color: #b0bfce; }
.dark .eyebrow::before { background: #70cfed; box-shadow: 0 0 10px #70cfed; }

/* --- En-tête & logo -------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 80; background: var(--night); color: #fff; border-bottom: 1px solid #ffffff12; }
.nav-shell { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-block: 12px; }
.brand { display: flex; flex-direction: column; gap: 4px; line-height: 1; width: 128px; flex: none; }
.brand-logo { display: block; width: 100%; height: auto; overflow: visible; }
.brand-signature { font-size: 10px; letter-spacing: .22em; color: #e2eafb; padding-left: 2px; }
.brand-star-halo { transform-origin: 129px 8.9px; animation: bwa-star-light 7s ease-in-out infinite; pointer-events: none; }
.brand-star-sheen { opacity: .55; animation: bwa-star-sweep 7s ease-in-out infinite; pointer-events: none; }
@keyframes bwa-star-light { 0%, 100% { opacity: .85; transform: scale(1); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes bwa-star-sweep {
  0%, 100% { opacity: .18; transform: translateX(-9.3px); } 22% { opacity: .9; }
  45% { opacity: .85; transform: translateX(80px); } 65% { opacity: .15; transform: translateX(145px); }
  66% { opacity: 0; transform: translateX(-130px); }
}
.main-nav { display: flex; align-items: center; gap: 26px; margin-left: auto; flex-wrap: wrap; }
.nav-link { font-size: 14px; color: #c7d2dd; position: relative; transition: color .25s; }
.nav-link::after { content: ''; position: absolute; left: 0; right: 100%; bottom: -6px; height: 2px; background: var(--gradient); border-radius: 2px; transition: right .35s var(--ease); }
.nav-link:hover { color: #fff; }
.nav-link:hover::after { right: 0; }

/* --- Boutons --------------------------------------------------------------------------------- */
.btn {
  display: inline-flex; gap: 14px; justify-content: center; align-items: center; position: relative; isolation: isolate;
  border: 1px solid transparent; border-radius: 999px; padding: 15px 26px;
  font-weight: 500; font-size: 14px; line-height: 1.4; white-space: nowrap;
  background: var(--ink); color: #fff;
  transition: background .25s, transform .3s var(--ease), box-shadow .3s, border-color .25s;
}
.btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 8px 28px #162a3a33; }
.btn-gradient { background: var(--gradient); color: #061524; font-weight: 600; background-size: 160% 100%; background-position: 0 0; transition: background-position .6s var(--ease), transform .3s var(--ease), box-shadow .3s; }
.btn-gradient:hover:not(:disabled) { background-position: 100% 0; box-shadow: 0 8px 28px #7762d955; }
.btn-line { background: transparent; color: var(--ink); border-color: #cbd1d6; }
.btn-line:hover:not(:disabled) { background: #101c270a; box-shadow: none; }
.dark .btn-line, .site-header .btn-line { color: #fff; border-color: #657380; }
.dark .btn-line:hover:not(:disabled), .site-header .btn-line:hover:not(:disabled) { background: #ffffff10; }
.btn-small { padding: 9px 16px; font-size: 12.5px; }
.btn-wide { width: 100%; }
.btn-danger { color: var(--bad); border-color: #e7b7c0; }
.btn .arrow { transition: transform .35s var(--ease); }
.btn:hover .arrow { transform: translateX(5px); }
.btn.is-busy { pointer-events: none; }
.btn.is-busy .arrow { animation: busy 1s linear infinite; }
.btn.is-done { background: var(--ok); color: #fff; }
@keyframes busy { 0% { transform: translateX(0); opacity: 1; } 50% { transform: translateX(8px); opacity: .3; } 100% { transform: translateX(0); opacity: 1; } }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); font-size: 15px;
  transition: background .2s, transform .2s var(--ease);
}
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--ink); color: #fff; transform: translateY(-2px); }
.icon-btn--danger:hover { background: var(--bad); border-color: var(--bad); }
.dark .icon-btn { background: #ffffff0d; border-color: #ffffff26; color: #fff; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px dashed #b6c0c8; background: transparent; border-radius: 999px; padding: 6px 13px; font-size: 12.5px; color: var(--ink); transition: .2s; }
.chip:hover { border-style: solid; border-color: var(--blue); color: var(--blue); background: #2187e80d; }

/* --- Héros & galaxie ------------------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding: 72px 0; }
.hero.dark, .dark .hero { background: var(--night); color: #fff; }
.hero--compact { padding: 64px 0 80px; }
.hero--center { min-height: calc(100vh - 80px - 70px); display: grid; align-items: center; padding: 56px 0; }
.hero .lead { max-width: 640px; }
.galaxy { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; contain: paint; }
.galaxy-haze {
  position: absolute; inset: -30% -15%;
  background:
    radial-gradient(ellipse at 75% 50%, #a145bb2a 0, transparent 41%),
    radial-gradient(ellipse at 55% 54%, #4977d838 0, transparent 48%),
    radial-gradient(ellipse at 89% 19%, #298fc630 0, transparent 39%),
    radial-gradient(ellipse at 12% 90%, #21b6e91c 0, transparent 35%);
  animation: galaxy-drift 28s ease-in-out infinite alternate;
}
.galaxy-orbit {
  position: absolute; width: 1100px; height: 350px; right: -150px; top: 8%;
  border: 1px solid #8496e022; border-radius: 50%;
  box-shadow: 0 -1px 16px #6798e815, inset 0 1px 35px #7679d00d;
  animation: galaxy-orbit 42s ease-in-out infinite alternate;
}
.galaxy-orbit--2 { width: 760px; height: 240px; right: -60px; top: 38%; opacity: .7; animation-duration: 34s; animation-direction: alternate-reverse; }
.galaxy-orbit::after {
  content: ''; position: absolute; width: 6px; height: 6px; border-radius: 50%; top: -3px; left: 50%;
  background: #fff; box-shadow: 0 0 12px 3px #9fb6ff, 0 0 30px 8px #c07ad955;
}
.galaxy-stars { position: absolute; inset: 0; animation: galaxy-stars 34s ease-in-out infinite alternate; }
.galaxy-stars i {
  position: absolute; left: var(--x); top: var(--y); width: var(--size); height: var(--size);
  background: #a6c8f4; border-radius: 50%; opacity: var(--alpha);
  animation: twinkle 5s ease-in-out var(--delay) infinite;
}
.galaxy-stars i:nth-child(4n) { background: #d391dc; box-shadow: 0 0 6px #d391dc75; }
.galaxy-stars i:nth-child(7n) { box-shadow: 0 0 8px #91d6ed70; }
@keyframes galaxy-drift { from { transform: translate(-3%, 1%) rotate(-3deg) scale(1); } to { transform: translate(4%, -3%) rotate(4deg) scale(1.1); } }
@keyframes galaxy-orbit { from { transform: translateY(0) rotate(-22deg); } to { transform: translateY(24px) rotate(-16deg); } }
@keyframes galaxy-stars { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(13px, -10px, 0); } }
@keyframes twinkle { 0%, 100% { opacity: var(--alpha); } 50% { opacity: calc(var(--alpha) * .35); } }

/* --- Apparitions ----------------------------------------------------------------------------- */
.reveal { animation: rise 1s var(--ease) both; }
.hero .reveal > * { animation: rise .9s var(--ease) both; }
.hero .reveal > :nth-child(2) { animation-delay: .08s; } .hero .reveal > :nth-child(3) { animation-delay: .16s; } .hero .reveal > :nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.card, .section-head { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.is-in { opacity: 1; transform: none; }
.pop { animation: pop .6s var(--ease); }
@keyframes pop { from { transform: scale(.97); opacity: .4; } to { transform: none; opacity: 1; } }

/* --- Sections & cartes ----------------------------------------------------------------------- */
.section { padding: 64px 0; }
.section--tight { padding-top: 8px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.glass { background: #0b1f33b3; border-color: #ffffff1a; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 80px #0009, inset 0 1px 0 #ffffff14; color: #fff; }
.grid-create { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: start; margin-top: -120px; }
.grid-create > aside { position: sticky; top: 104px; }
.grid-admin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; margin: 28px 0; }
.notice { background: #2187e814; border: 1px solid #2187e840; color: #0f4d86; border-radius: 14px; padding: 12px 16px; }

/* --- Formulaires ----------------------------------------------------------------------------- */
.form { display: grid; gap: 18px; margin-top: 28px; }
.card.form { margin-top: 0; }
#login-form { margin-top: 36px; }
.form label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 6px; font-size: 13.5px; font-weight: 500; }
.form label > input, .form label > textarea, .form label > select { flex-basis: 100%; }
.form label .muted { font-weight: 400; }
input:not([type=radio]):not([type=checkbox]), textarea, select {
  width: 100%; border: 1px solid #cfd6da; border-radius: 12px; background: #fff; padding: 12px 14px; font-size: 15px; font-weight: 400;
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px #2187e81f; }
.dark input:not([type=radio]):not([type=checkbox]) { background: #ffffff0d; border-color: #ffffff2b; color: #fff; }
.dark input:focus { border-color: #70cfed; box-shadow: 0 0 0 4px #70cfed22; }
.form-error { margin: 0; color: var(--bad); font-size: 14px; background: #d4455f12; border: 1px solid #d4455f33; border-radius: 12px; padding: 10px 14px; }
.dark .form-error { color: #ff9fb0; }
.form-ok { margin: 0; color: var(--ok); font-size: 14px; }
.spaced { margin-top: 12px; }

.fields-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fields { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.fields:empty { display: none; }
.field {
  display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1.6fr) auto auto; gap: 10px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fbfbf9; animation: pop .35s var(--ease);
}
.field-input { display: flex; gap: 6px; align-items: center; }
.field-flag { display: flex !important; grid-auto-flow: column; align-items: center; gap: 6px !important; font-size: 12px !important; color: var(--muted); }
.field-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px !important; }

.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.segmented legend { font-size: 13.5px; font-weight: 500; margin-bottom: 8px; width: 100%; }
.segmented label { display: block !important; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-block; padding: 9px 16px; border: 1px solid #cfd6da; border-radius: 999px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease);
}
.segmented span:hover { border-color: var(--ink); }
.segmented input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.segmented input:focus-visible + span { outline: 3px solid #5c98f5; outline-offset: 2px; }
.views-count { max-width: 260px; }
.rule-summary { margin: 0; padding: 12px 16px; border-radius: 14px; background: linear-gradient(110deg, #21b6e912, #7079ed12, #d85cce12); border: 1px solid #7079ed2a; font-size: 14px; }
.advanced { border-top: 1px solid var(--line); padding-top: 14px; }
.advanced summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.advanced[open] summary { margin-bottom: 14px; }
.advanced label + label { margin-top: 14px; }

/* --- Résultat & explications ----------------------------------------------------------------- */
.result { border: 1px solid transparent; background: linear-gradient(#fff, #fff) padding-box, var(--gradient) border-box; }
.link-box { display: flex; gap: 8px; margin: 18px 0 14px; }
.link-box input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px !important; }
.how { background: var(--night); color: #fff; border-color: var(--night-2); }
.how .eyebrow { color: #b0bfce; }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 14px; color: #c4cfd9; font-size: 14.5px; }
.steps strong { color: #fff; font-weight: 500; }
.steps li::marker { color: #70cfed; font-weight: 600; }

/* --- Tableaux -------------------------------------------------------------------------------- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.links-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.links-table th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 18px; background: #f3f4f0; }
.links-table td { padding: 14px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
.links-table tbody tr { transition: background .2s; }
.links-table tbody tr:hover { background: #fafaf7; }
.actions { text-align: right; white-space: nowrap; }
.actions > * + * { margin-left: 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok { background: #1f9d6b17; color: var(--ok); }
.badge--ok::before { animation: pulse 2s ease-in-out infinite; }
.badge--done { background: #7079ed17; color: #5a5fd6; }
.badge--off { background: #64707814; color: var(--muted); }
.badge--bad { background: #d4455f14; color: var(--bad); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 #1f9d6b66; } 50% { box-shadow: 0 0 0 5px #1f9d6b00; } }
.empty { padding: 28px; text-align: center; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }

/* --- Consultation d'un lien ------------------------------------------------------------------ */
.viewer-card { padding: 40px; text-align: left; }
.viewer-card .h2 { font-size: clamp(28px, 3.4vw, 40px); }
.state { animation: pop .5s var(--ease); }
.seal {
  width: 76px; height: 76px; border-radius: 22px; margin-bottom: 26px; position: relative; display: grid; place-items: center;
  background: var(--gradient); box-shadow: 0 10px 40px #7079ed66; animation: float 5s ease-in-out infinite;
}
.seal::before { content: ''; position: absolute; inset: -10px; border-radius: 28px; background: var(--gradient); filter: blur(22px); opacity: .45; z-index: -1; animation: breathe 5s ease-in-out infinite; }
/* Étoile BWA à quatre branches */
.seal span { width: 34px; height: 34px; background: #fff; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: spin 14s linear infinite; }
.seal--gone { background: #1c2c3d; box-shadow: none; animation: none; }
.seal--gone::before { display: none; }
.seal--gone span { background: #5f7183; animation: none; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.95); } 50% { opacity: .6; transform: scale(1.08); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #ffffff22; border-top-color: #70cfed; animation: spin .9s linear infinite; margin-bottom: 14px; }
.secret-description { white-space: pre-wrap; overflow-wrap: anywhere; color: #d5dee7; background: #ffffff08; border: 1px solid #ffffff14; border-radius: 14px; padding: 16px 18px; margin: 18px 0; }
.secret-fields { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.secret-field { display: grid; gap: 6px; padding: 14px 16px; border-radius: 14px; background: #ffffff0a; border: 1px solid #ffffff17; animation: pop .5s var(--ease) both; }
.secret-field:nth-child(2) { animation-delay: .06s; } .secret-field:nth-child(3) { animation-delay: .12s; } .secret-field:nth-child(4) { animation-delay: .18s; }
.secret-label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #8fa2b4; }
.secret-row { display: flex; align-items: center; gap: 8px; }
.secret-value { flex: 1; min-width: 0; font: 500 15px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; color: #fff; }
.secret-value.is-masked { -webkit-text-security: disc; filter: blur(6px); user-select: none; transition: filter .25s; }
.viewer .btn:not(.btn-gradient):not(.btn-line) { background: #fff; color: var(--night); }

/* --- Pied de page ---------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; font-size: 12.5px; }
.site-footer .shell { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dark .site-footer { border-color: #ffffff12; color: #8fa2b4; }

/* --- Responsive ------------------------------------------------------------------------------ */
@media (max-width: 960px) {
  .grid-create, .grid-admin { grid-template-columns: 1fr; margin-top: 0; }
  .grid-create { margin-top: -60px; }
  .grid-create > aside { position: static; }
}
@media (max-width: 720px) {
  .card, .viewer-card { padding: 22px; }
  .hero { padding: 48px 0; }
  .main-nav { gap: 16px; width: 100%; justify-content: flex-start; }
  .field { grid-template-columns: 1fr auto; }
  .field-label { grid-column: 1 / -1; }
  .field-input { grid-column: 1 / -1; }
  .links-table thead { display: none; }
  .links-table, .links-table tbody, .links-table tr, .links-table td { display: block; }
  .links-table tr { padding: 10px 0; border-top: 1px solid var(--line); }
  .links-table tr:first-child { border-top: 0; }
  .links-table td { border: 0; padding: 5px 16px; }
  .links-table td[data-th]::before { content: attr(data-th); display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
  .actions { text-align: left; white-space: normal; }
  .actions > * { margin: 4px 6px 0 0 !important; }
  .link-box { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card, .section-head { opacity: 1; transform: none; }
}
.result .btn-line { margin-top: 14px; }
