/* ==========================================================
   portail.css — page d'accueil et connexion des espaces
   S'appuie sur theme.css (couleurs, thèmes clair/sombre, .btn)
   ========================================================== */

body.portail {
    display: flex; flex-direction: column;
    min-height: 100vh; min-height: 100dvh;
}
/* fond quadrillé + halo central */
body.portail::before {
    background-image:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: center;
}
body.portail::after {
    content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(ellipse at 50% 32%, transparent 0%, var(--paper) 78%);
}

.portail-shell {
    position: relative; z-index: 1;
    width: 100%; max-width: 920px; margin: 0 auto;
    padding: 26px 22px 30px;
    flex: 1; display: flex; flex-direction: column;
}

/* ---------- barre du haut ---------- */
.topbar {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-dim);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--amber); }

.led {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none;
    background: var(--amber); box-shadow: 0 0 8px var(--amber);
}
.led-on { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* ---------- en-tête de l'accueil ---------- */
.hero { margin: 9vh 0 34px; }
.kicker {
    font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber);
}
.hero h1 {
    font-family: 'Newsreader', serif; font-weight: 600;
    font-size: clamp(42px, 8vw, 66px); line-height: 1;
    letter-spacing: -0.025em; margin: 14px 0 16px;
}
.hero p {
    font-family: 'IBM Plex Mono', monospace; font-size: 13px; line-height: 1.7;
    color: var(--ink-dim); max-width: 520px; margin: 0;
}

/* ---------- cartes d'espaces ---------- */
.espaces {
    display: grid; gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    list-style: none; margin: 0; padding: 0;
}
.espace {
    position: relative; height: 100%;
    display: flex; flex-direction: column; gap: 14px;
    padding: 22px 22px 18px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
    color: inherit; text-decoration: none; overflow: hidden;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
/* liseré ambre qui se déploie au survol */
.espace::before {
    content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 2px;
    background: var(--amber); transform: scaleX(0); transform-origin: left;
    transition: transform 0.3s ease;
}
.espace:hover, .espace:focus-visible {
    border-color: var(--amber); transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22); outline: none;
}
.espace:hover::before, .espace:focus-visible::before { transform: scaleX(1); }

.espace-head {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-dim);
}
.etat { display: inline-flex; align-items: center; gap: 8px; }
.espace h2 {
    font-family: 'Newsreader', serif; font-weight: 600;
    font-size: 32px; line-height: 1.05; letter-spacing: -0.015em; margin: 4px 0 0;
}
.espace p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-dim); }

.pastilles { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pastilles li {
    font-family: 'IBM Plex Mono', monospace; font-size: 10px;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim);
    border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px;
}

.espace-pied {
    margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line);
    display: flex; justify-content: space-between; align-items: center;
    font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    letter-spacing: 0.1em; text-transform: uppercase;
}
.fleche { color: var(--amber); font-size: 15px; transition: transform 0.2s; }
.espace:hover .fleche, .espace:focus-visible .fleche { transform: translateX(5px); }

/* ---------- pied de page ---------- */
.pied {
    margin-top: auto; padding-top: 44px;
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    font-family: 'IBM Plex Mono', monospace; font-size: 10px;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint);
}
.pied a { color: inherit; }
.pied a:hover { color: var(--red); }

/* ---------- connexion ---------- */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 34px 0 10px; }
.panel {
    width: 100%; max-width: 390px;
    background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
    overflow: hidden; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.panel-head {
    border-bottom: 1px solid var(--line); padding: 14px 22px;
    display: flex; align-items: center; justify-content: space-between;
    font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-dim);
}
.panel-body { padding: 28px 26px 30px; }
.panel h1 {
    font-family: 'Newsreader', serif; font-weight: 600;
    font-size: 30px; margin: 0 0 4px; letter-spacing: -0.01em;
}
.tag { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--ink-dim); margin-bottom: 22px; }
.panel label {
    display: block; font-family: 'IBM Plex Mono', monospace;
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ink-dim); margin: 16px 0 6px;
}
.panel input {
    width: 100%; padding: 11px 13px;
    background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
    color: var(--ink); font-family: 'IBM Plex Mono', monospace; font-size: 14px;
    outline: none; transition: border 0.15s;
}
.panel input:focus { border-color: var(--amber); }
.panel button[type="submit"] {
    width: 100%; margin-top: 24px; padding: 12px;
    background: var(--amber); color: #1a1300; border: none; border-radius: 10px;
    font-family: 'IBM Plex Mono', monospace; font-weight: 600;
    font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
    cursor: pointer; transition: filter 0.15s;
}
.panel button[type="submit"]:hover { filter: brightness(1.1); }
.msg {
    font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.5;
    padding: 8px 12px; margin-bottom: 8px; border-left: 2px solid;
}
.msg-erreur { color: var(--red); border-color: var(--red); background: rgba(255, 90, 82, 0.08); }
.msg-info { color: var(--ink-dim); border-color: var(--amber); background: rgba(255, 176, 0, 0.07); }
.retour {
    display: inline-block; margin-top: 18px;
    font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-dim); text-decoration: none;
}
.retour:hover { color: var(--amber); }

@media (max-width: 600px) {
    .portail-shell { padding: 18px 16px 24px; }
    .hero { margin: 6vh 0 26px; }
    .espace { padding: 20px 18px 16px; }
    .espace h2 { font-size: 28px; }
    .topbar .host { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .espace, .espace::before, .fleche { transition: none; }
}
