/*
 * responsive.css
 * Surcharges responsive pour Bootstrap + thème Doc_Black
 * Ce fichier est chargé APRÈS home.css / denied.css ET après Bootstrap
 * pour corriger les conflits et améliorer le responsive mobile/tablette.
 */

/* ============================================================
   RESET DES CONFLITS BOOTSTRAP ↔ THÈME
   ============================================================ */

/* Bootstrap reset le box-sizing — on le garde, c'est compatible */

/* Empêcher Bootstrap d'écraser les couleurs du thème */
a { color: inherit; }
a:hover { color: inherit; }

/* Bootstrap met des marges sur p, h1-h6 qu'on veut pas */
.terminal p,
.terminal h1,
.terminal h2,
.terminal h3,
.terminal h4,
.terminal h5,
.terminal h6 {
  margin-top: 0;
}

/* Le btn Bootstrap ne doit pas interférer avec nos boutons custom */
/* On s'assure que les styles Bootstrap ne les écrasent pas */
.access-btn,
.platformBtn,
.topBtn,
.backHome,
.tbtn,
.modalBtn,
.ctfMore,
.certModalClose {
  font-family: var(--mono);
  text-decoration: none;
  line-height: inherit;
}

/* ============================================================
   AMÉLIORATIONS MOBILE GLOBALES
   ============================================================ */

/* Permettre le scroll vertical sur petits écrans */
body {
  overflow-x: hidden;
}

/* dvh pour les navigateurs mobiles modernes */
@supports (height: 100dvh) {
  body { min-height: 100dvh; }
}

/* ============================================================
   MOBILE (< 576px)
   ============================================================ */
@media (max-width: 575.98px) {

  /* Le body doit pouvoir scroller si le contenu dépasse */
  body {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Stage : pas de grid centering rigide */
  .stage {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* Terminal : pleine largeur, hauteur auto */
  .terminal {
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* Barre de titre */
  .tbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }

  .title {
    order: 1;
    flex: 1 1 100%;
    text-align: center;
    font-size: 10px;
    letter-spacing: .12em;
  }

  .tleft { order: 0; }
  .badge { order: 2; margin-left: auto; }
  .tright { order: 2; }
  .topActions { order: 2; }
  .backHome { font-size: 11px; padding: 8px 10px; }

  /* Écran intérieur : mode colonne forcé */
  .screen {
    padding: 10px;
    overflow: visible;
  }

  .screen-inner {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px;
    overflow: visible;
    padding-right: 0;
  }

  /* Panels */
  .panel {
    border-radius: 10px;
  }

  .phead {
    padding: 10px 12px;
  }

  .pbody {
    padding: 10px;
  }

  /* PROFIL */
  .idtop {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .idavatar {
    width: 90px;
    height: 90px;
  }

  .idname {
    font-size: 22px;
  }

  .idrole {
    font-size: 14px;
  }

  .idrow {
    grid-template-columns: 1fr;
    gap: 4px;
    text-align: center;
  }

  .idrow .k {
    font-size: 11px;
  }

  .platformBtns {
    justify-content: center;
  }

  .platformBtn {
    font-size: 10px;
    padding: 8px 10px;
    min-height: 38px;
  }

  /* GLOBE / LINKS */
  .globeWrap {
    height: 280px;
  }

  .linkChip {
    font-size: 10px;
    padding: 8px 10px;
  }

  /* CONTACT */
  .contact {
    height: auto;
    min-height: 280px;
  }

  .contactBody {
    min-height: 250px;
  }

  .contactScroll {
    min-height: 160px;
  }

  .cmdrow {
    flex-wrap: wrap;
  }

  .ps1 {
    font-size: 11px;
  }

  .cmd {
    font-size: 14px;
    min-height: 44px;
    width: 100%;
  }

  /* Footer */
  .footer {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }

  .meta {
    font-size: 10px;
    flex: 1 1 100%;
    text-align: center;
  }

  .rightmeta {
    font-size: 10px;
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* ============================================================
   TABLETTE (576px — 979px)
   ============================================================ */
@media (min-width: 576px) and (max-width: 979.98px) {

  body {
    overflow-y: auto;
    height: auto;
  }

  .stage {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 14px;
  }

  .terminal {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 90vh;
  }

  /* Forcer colonne sur tablette aussi (pas assez large pour la grille) */
  .screen-inner {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px;
    overflow: visible;
  }

  .idtop {
    flex-direction: row;
    align-items: flex-start;
  }

  .idavatar {
    width: 100px;
    height: 100px;
  }

  .globeWrap {
    height: 340px;
  }

  .contact {
    height: auto;
    min-height: 320px;
  }

  .footer {
    flex-wrap: nowrap;
  }
}

/* ============================================================
   CTF PAGE — RESPONSIVE
   ============================================================ */
@media (max-width: 575.98px) {

  .ctfTop {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .ctfMeta {
    flex-wrap: wrap;
    white-space: normal;
    font-size: 11px;
  }

  .ctfTitle {
    font-size: 14px;
  }

  .ctfSummary {
    font-size: 12px;
  }

  .ctfMore {
    font-size: 11px;
    padding: 10px 12px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }

  .ctfItem {
    padding: 10px;
  }
}

/* ============================================================
   CERTIFS PAGE — RESPONSIVE
   ============================================================ */
@media (max-width: 575.98px) {

  .certLayout {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .viewer {
    height: 320px;
  }

  /* HUD: cacher sur mobile (pas assez de place) */
  .hud {
    display: none;
  }

  .certTip {
    font-size: 10px;
  }

  /* Liste certifs */
  .certRow {
    padding: 10px;
  }

  .certRowTop {
    flex-direction: column;
    gap: 4px;
  }

  .certRowName {
    font-size: 11px;
  }

  /* Modal */
  .certModalBox {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
  }

  .certModalGrid {
    grid-template-columns: 1fr !important;
  }

  .certModalHead {
    flex-wrap: wrap;
    gap: 8px;
  }

  .certModalTitle {
    font-size: 11px;
    white-space: normal;
  }

  .certModalAvatar {
    width: 32px;
    height: 32px;
  }

  .certModalBody {
    padding: 10px;
  }

  .certActions {
    justify-content: center;
  }

  .modalBtn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

@media (min-width: 576px) and (max-width: 979.98px) {
  .certLayout {
    grid-template-columns: 1fr !important;
  }

  .viewer {
    height: 420px;
  }
}

/* ============================================================
   CONSOLE PAGE — RESPONSIVE
   ============================================================ */
@media (max-width: 575.98px) {
  .consoleSoon {
    font-size: 28px;
    letter-spacing: .25em;
  }

  .termCmdRow {
    flex-wrap: wrap;
  }

  .termInputWrap {
    width: 100%;
    min-height: 44px;
  }
}

/* ============================================================
   DENIED (index) PAGE — RESPONSIVE
   ============================================================ */
@media (max-width: 575.98px) {
  .access-btn {
    width: 100% !important;
    min-height: 48px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .gate {
    padding: 10px;
  }

  .pwrap {
    flex: 1;
    min-width: 0;
  }

  /* Page denied : le terminal doit prendre toute la hauteur */
  .lines {
    font-size: 12px;
    line-height: 1.45;
  }
}

@media (min-width: 576px) and (max-width: 979.98px) {
  /* Denied page : agrandir un peu le terminal sur tablette */
  .terminal {
    width: min(900px, 98vw);
    height: min(620px, 85vh);
  }
}

/* ============================================================
   TOUCH-FRIENDLY — tous écrans tactiles
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  /* Taille minimale tactile */
  .platformBtn,
  .linkChip,
  .topBtn,
  .backHome,
  .tbtn,
  .ctfMore,
  .modalBtn,
  .certModalClose,
  .certRow {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Input plus grand pour le pouce */
  .cmd,
  .termInputWrap {
    min-height: 48px;
    font-size: 16px; /* empêche le zoom auto sur iOS */
  }

  /* Pas de hover effects sur tactile */
  .platformBtn:hover,
  .linkChip:hover,
  .ctfMore:hover,
  .certRow:hover,
  .backHome:hover,
  .topBtn:hover,
  .tbtn:hover {
    transform: none;
    filter: none;
  }

  /* Mais on garde un :active pour le feedback */
  .platformBtn:active,
  .linkChip:active,
  .ctfMore:active,
  .certRow:active,
  .backHome:active,
  .topBtn:active,
  .tbtn:active {
    filter: brightness(1.15);
    border-color: rgba(0,255,136,.50);
  }
}

/* ============================================================
   PAYSAGE MOBILE
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .stage {
    padding: 4px;
  }

  .terminal {
    border-radius: 0;
  }

  .tbar {
    padding: 6px 10px;
  }

  .footer {
    padding: 6px 10px;
  }

  .globeWrap {
    height: 200px;
  }

  .viewer {
    height: 250px;
  }

  .contact {
    height: auto;
    min-height: 200px;
  }
}
