@import url("https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap");

:root {
  --bg: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #ecb536;
  --brand-600: #d29f1f;
  --ghost: #111827;
  --ghost-bg: #f3f4f6;
  --font-brand: "Comic Sans MS", "Comic Sans", "Comic Neue", cursive;
}

/* -------- Base -------- */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);

  font-family: var(--font-brand);
  font-size: 16px;
  line-height: 1.5;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
  text-decoration: none;
}
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* -------- Typography -------- */
.h1 {
  font-size: 44px;
  line-height: 1.15;
  margin: 0 0 12px;
}
.h2 {
  font-size: 32px;
  margin: 0 0 8px;
}
.h3 {
  font-size: 22px;
  margin: 0 0 4px;
}
.lead {
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 16px;
}
.center {
  text-align: center;
}
.sub {
  color: var(--muted);
  margin-top: 6px;
}

/* -------- Utilities -------- */
.muted {
  color: var(--muted);
}
.hidden {
  display: none !important;
}
.visually-hidden {
  position: absolute !important;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  padding: 0;
}

/* -------- Buttons -------- */
.btn {
  font-family: var(--font-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: 0.15s;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 14px;
}
.btn-primary {
  background: var(--brand);
  color: #000;
}
.btn-primary:hover {
  background: var(--brand-600);
}
.btn-muted {
  background: #f3f4f6;
  color: var(--ghost);
}
.btn-muted:hover {
  background: #e5e7eb;
}
.btn-ghost {
  background: var(--ghost-bg);
  color: var(--ghost);
}
.btn-ghost:hover {
  background: #e5e7eb;
}

/* Disabled + Loading */
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.btn.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.95;
  color: transparent;
}
.btn.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
/* Spinner contrast fix */
.btn.loading::after {
  border-color: rgba(17, 24, 39, 0.9);
  border-top-color: transparent;
}
.btn-primary.loading::after {
  border-color: rgba(255, 255, 255, 0.95);
  border-top-color: transparent;
}

/* Optional UX: dim disabled buttons in account actions group */
#acct-actions .btn[disabled] {
  opacity: 0.7;
  filter: saturate(0.8);
}

/* -------- Header -------- */
/* Hide header actions until JS applies session state to avoid flicker */
.header-actions.is-hidden {
  visibility: hidden;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
  transition: box-shadow 0.2s ease;
}
.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 50px;
  height: 50px;
  border-radius: 6px;
}
.brand-name {
  font-weight: 800;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-email {
  font-size: 14px;
  color: var(--muted);
  margin-left: 6px;
}

/* -------- Sections -------- */
.section {
  padding: 56px 0;
  border-top: 1px solid transparent;
}
.bullets {
  margin: 12px 0 18px;
  padding-left: 18px;
}
.bullets li {
  margin: 6px 0;
  list-style: disc;
  color: #374151;
}

/* -------- Account / key-values -------- */
.kv {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
.kv .row {
  display: flex;
  justify-content: space-between;
  padding: 10px 6px;
}
.kv .key {
  color: var(--muted);
}
.kv .val {
  font-weight: 700;
}

/* -------- Result pages (success / cancel) -------- */
.result {
  max-width: 720px;
  margin: 28px auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 22px;
}
.result-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}
.icon-ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.icon-warn {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.result-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}
.result-body {
  color: #374151;
  margin: 8px 0 16px;
}
.result-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* -------- Alerts -------- */
.alert {
  padding: 10px 12px;
  border-radius: 10px;
  margin: 8px 0 14px;
  font-weight: 600;
}
.alert-ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.alert-warn {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* -------- Responsive (global only) -------- */
@media (max-width: 960px) {
  .header-inner {
    height: 58px;
  }
}

/* -------- Mobile-first adjustments (append) -------- */

/* Typo fluide */
html,
body {
  font-size: clamp(14px, 1.5vw, 16px);
}

/* Titres + lead en clamp pour éviter des sauts brutaux */
.h1 {
  font-size: clamp(28px, 6vw, 44px);
  line-height: 1.15;
}
.h2 {
  font-size: clamp(22px, 4.5vw, 32px);
}
.h3 {
  font-size: clamp(18px, 3.5vw, 22px);
}
.lead {
  font-size: clamp(15px, 2.9vw, 18px);
}

/* Container : padding plus serré sur mobile */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(12px, 4vw, 20px);
}

/* Header compact sur mobile */
.header-inner {
  height: clamp(52px, 9vw, 64px);
}
.brand {
  gap: clamp(8px, 2vw, 12px);
}
.brand-logo {
  width: clamp(40px, 8vw, 50px);
  height: clamp(40px, 8vw, 50px);
}
.header-actions {
  gap: clamp(6px, 2vw, 10px);
}
.user-email {
  font-size: clamp(12px, 2.6vw, 14px);
}

/* Boutons : moins haut + typo plus petite sur petit écran */
.btn {
  gap: clamp(6px, 1.8vw, 8px);
  border-radius: 10px;
  padding: clamp(8px, 2.4vw, 12px) clamp(10px, 3vw, 16px);
  font-weight: 600;
}
.btn-sm {
  padding: clamp(6px, 1.8vw, 8px) clamp(8px, 2.4vw, 12px);
  font-size: clamp(12px, 2.6vw, 14px);
}

/* Sections : vertical spacing réduit */
.section {
  padding: clamp(28px, 8vw, 56px) 0;
}

/* Listes : marges plus serrées */
.bullets {
  margin: 10px 0 14px;
  padding-left: 18px;
}
.bullets li {
  margin: 4px 0;
  font-size: clamp(14px, 2.8vw, 16px);
}

/* Cartes "result" : marges/paddings compacts sur mobile */
.result {
  max-width: 720px;
  margin: clamp(16px, 4.5vw, 28px) auto;
  padding: clamp(14px, 3.8vw, 22px);
  border-radius: clamp(12px, 3.8vw, 18px);
}
.result-head {
  gap: clamp(10px, 3vw, 14px);
}
.icon-circle {
  width: clamp(30px, 8vw, 40px);
  height: clamp(30px, 8vw, 40px);
  font-size: clamp(16px, 4.5vw, 20px);
}
.result-title {
  font-size: clamp(18px, 4.5vw, 20px);
}
.result-body {
  font-size: clamp(14px, 3.2vw, 16px);
}
.result-cta {
  gap: clamp(6px, 2.6vw, 10px);
}

/* Key-Values (kv) : passent en colonne sur petit écran */
.kv {
  border-radius: clamp(12px, 3.8vw, 16px);
  padding: clamp(12px, 3.6vw, 18px);
}
.kv .row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: clamp(8px, 2.4vw, 10px) 6px;
}
@media (max-width: 560px) {
  .kv .row {
    grid-template-columns: 1fr;
  }
  .kv .val {
    justify-self: start;
  }
}

/* CTA/Actions : wrap plus doux et interlignes cohérents */
.result-cta,
.header-actions {
  flex-wrap: wrap;
}

/* Petits desktops / tablettes : adoucir encore un peu */
@media (max-width: 960px) {
  .h1 {
    line-height: 1.2;
  }
  .container {
    padding: 0 clamp(14px, 3.5vw, 18px);
  }
}

@media (max-width: 720px) {
  .brand-name {
    font-size: clamp(14px, 3.4vw, 16px);
  }
  .lead {
    margin-bottom: 12px;
  }
}

/* Téléphones étroits */
@media (max-width: 480px) {
  .header-actions .btn {
    padding-left: 10px;
    padding-right: 10px;
  }
  .user-email {
    display: none;
  }
}
.brand-name {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-weight: 800;
}
.brand-name .bn-line2::before {
  content: "— ";
}

@media (max-width: 560px) {
  .brand-name {
    display: block;
    line-height: 18px;
  }
  .brand-name .bn-line2 {
    display: block;
    margin-top: 2px;
  }
  .brand-name .bn-line2::before {
    content: "";
  }

  .header-actions > :not(#btnSignIn):not(#authed-controls) {
    display: none !important;
  }

  #authed-controls:not(.hidden) {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
  }

  .user-email {
    display: none !important;
  }
}
html {
  scroll-behavior: smooth;
}

/* -------- Gofile guides cards grid -------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 24px;
}
.cards-grid .card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background: #fff;
}
.cards-grid .card .h3 {
  font-size: 17px;
  line-height: 1.35;
  margin: 0 0 10px;
}
.cards-grid .card .h3 a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cards-grid .card .h3 a:hover {
  color: var(--brand-600);
}
.cards-grid .card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}
@media (max-width: 820px) {
  .cards-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
