/* =========================================================
   Rioprado – feuille de style commune
   ========================================================= */

:root {
    --text: #f6efe4;
    --muted: #b9ab98;
    --faint: #8a7d6c;
    --accent: #e8b46b;
    --accent-strong: #f0c27f;
    --accent-ink: #2a1d0e;
    --glass: rgba(255, 246, 232, 0.06);
    --glass-hover: rgba(255, 246, 232, 0.11);
    --line: rgba(255, 240, 220, 0.12);
    --line-strong: rgba(255, 240, 220, 0.22);
    --danger: #ff8a7a;
    --ok: #9fd8a4;
    --radius: 16px;
    --serif: "Fraunces", Georgia, "Times New Roman", serif;
    --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    min-height: 100vh;
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: #16120e;
    -webkit-font-smoothing: antialiased;
}

/* Photo de fond fixe + voile chaud */
body::before {
    content: "";
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(232, 180, 107, 0.18), transparent 60%),
        linear-gradient(180deg, rgba(22, 18, 14, 0.70) 0%, rgba(22, 18, 14, 0.86) 45%, rgba(18, 15, 12, 0.96) 100%),
        url("../images/background.jpg") center / cover no-repeat;
}

a { color: inherit; }
[hidden] { display: none !important; }

kbd {
    font-family: var(--sans);
    font-size: 11px;
    padding: 1px 6px;
    border: 1px solid var(--line-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    color: var(--muted);
}

code {
    font-size: 0.92em;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
}

svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* =========================================================
   Barre du haut
   ========================================================= */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px clamp(16px, 4vw, 48px);
    padding-top: max(14px, env(safe-area-inset-top));
    padding-left: max(clamp(16px, 4vw, 48px), env(safe-area-inset-left));
    padding-right: max(clamp(16px, 4vw, 48px), env(safe-area-inset-right));
    background: rgba(20, 16, 12, 0.6);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: var(--serif);
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.brand img { border-radius: 7px; }

.search {
    flex: 1;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 42px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--line);
    transition: border-color .2s, background .2s;
}
.search:focus-within { border-color: var(--accent); background: rgba(255, 246, 232, 0.09); }
.search svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search input {
    font-size: 16px !important;
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }

.user { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-strong), #c27a3f);
    color: var(--accent-ink);
    font-weight: 600;
}
.user-name { font-weight: 500; white-space: nowrap; }
.user-name em {
    font-style: normal;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent);
    margin-left: 4px;
}
.icon-btn {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: all .2s;
}
.icon-btn:hover { color: var(--text); background: var(--glass-hover); border-color: var(--line); }
.icon-btn svg { width: 19px; height: 19px; }

/* =========================================================
   Accueil
   ========================================================= */
.wrap {
    width: calc(100% - 64px);
    max-width: 1200px;
    width: min(1200px, 100% - 2 * clamp(16px, 4vw, 48px));
    margin: 0 auto;
    padding-bottom: 40px;
}

.hero { padding: clamp(36px, 7vw, 76px) 0 24px; animation: rise .6s ease both; }
.eyebrow {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.hero h1 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(34px, 5.5vw, 58px);
    line-height: 1.08;
    letter-spacing: -0.01em;
}
.clock {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* Raccourcis de catégories */
.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 6px 0 12px;
    animation: rise .6s .08s ease both;
}
.chip {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--glass);
    text-decoration: none;
    font-size: 13.5px;
    color: var(--muted);
    transition: all .2s;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); background: var(--glass-hover); }
body.searching .chips { opacity: .35; pointer-events: none; }

/* Sections */
.section { margin-top: 36px; animation: rise .6s .14s ease both; }
.section h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 21px;
}
.section h2::after {
    content: "";
    flex: 1;
    height: 1px;
    margin-left: 8px;
    background: linear-gradient(90deg, var(--line-strong), transparent);
}
.section h2 span { font-size: 18px; }

/* Grille de tuiles */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.tile { position: relative; }
.tile-link {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    padding: 14px 44px 14px 14px;
    border-radius: var(--radius);
    text-decoration: none;
    background: var(--glass);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform .2s ease, background .2s, border-color .2s, box-shadow .2s;
}
.tile-link:hover {
    transform: translateY(-2px);
    background: var(--glass-hover);
    border-color: rgba(232, 180, 107, 0.45);
    box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(232, 180, 107, 0.08);
}
.tile-icon {
    flex: none;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    font-size: 22px;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 240, 220, 0.14), rgba(255, 240, 220, 0.03));
    border: 1px solid var(--line);
}
.tile-text { display: flex; flex-direction: column; min-width: 0; }
.tile-text strong { font-weight: 600; font-size: 15px; line-height: 1.3; }
.tile-text small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }

.tag {
    display: inline-block;
    margin-right: 6px;
    vertical-align: 1px;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .08em;
    line-height: 1.5;
    padding: 0 5px;
    border-radius: 4px;
    color: var(--ok);
    background: rgba(159, 216, 164, 0.1);
    border: 1px solid rgba(159, 216, 164, 0.25);
}

/* Bouton favori */
.fav {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px; height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--faint);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, color .15s, background .15s;
}
.tile:hover .fav, .fav:focus-visible, .fav[aria-pressed="true"] { opacity: 1; }
.fav:hover { background: var(--glass-hover); color: var(--text); }
.fav[aria-pressed="true"] { color: var(--accent); }
@media (hover: none) { .fav { opacity: .6; } }

/* Groupes de liens */
.groups {
    columns: 3 260px;
    column-gap: 12px;
}
.group {
    break-inside: avoid;
    margin-bottom: 12px;
    padding: 16px 12px 10px;
    border-radius: var(--radius);
    background: var(--glass);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.group h3 {
    margin: 0 4px 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
}
.group h3 span { margin-right: 4px; }
.group ul { list-style: none; margin: 0; padding: 0; }
.tile-mini .tile-link {
    padding: 8px 40px 8px 10px;
    gap: 8px;
    justify-content: space-between;
    background: transparent;
    border-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 10px;
    font-size: 14.5px;
}
.tile-mini .tile-link:hover { transform: none; box-shadow: none; background: var(--glass-hover); border-color: transparent; }
.tile-mini .tile-link svg { width: 14px; height: 14px; color: var(--faint); flex: none; transition: color .2s, transform .2s; }
.tile-mini .tile-link:hover svg { color: var(--accent); transform: translate(2px, -2px); }
.tile-mini .fav { top: 50%; transform: translateY(-50%); right: 26px; }

/* Rappel « Mes applications » */
.empty-app {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px dashed var(--line-strong);
    background: rgba(255, 246, 232, 0.03);
}
.empty-app > span { font-size: 28px; }
.empty-app p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

.no-result {
    margin: 50px 0;
    text-align: center;
    color: var(--muted);
    font-size: 16px;
}

.footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    width: calc(100% - 64px);
    max-width: 1200px;
    width: min(1200px, 100% - 2 * clamp(16px, 4vw, 48px));
    margin: 0 auto;
    padding: 22px 0 30px;
    border-top: 1px solid var(--line);
    color: var(--faint);
    font-size: 12.5px;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }

@media (max-width: 760px) {
    .topbar { flex-wrap: wrap; gap: 12px; }
    .search { order: 3; flex-basis: 100%; max-width: none; }
    .search kbd, .footer .hint { display: none; }
    .user { margin-left: auto; }
    .user-name em { display: none; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .tile-link { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
    .tile-mini .tile-link { flex-direction: row; align-items: center; padding-right: 40px; }
    html { scroll-padding-top: 130px; }
}

/* =========================================================
   Pages d'authentification (connexion, création de compte)
   ========================================================= */
.page-auth {
    display: grid;
    place-items: center;
    padding: 24px;
}
.page-auth::before {
    background:
        radial-gradient(900px 500px at 50% 0%, rgba(232, 180, 107, 0.16), transparent 65%),
        linear-gradient(180deg, rgba(22, 18, 14, 0.55), rgba(18, 15, 12, 0.85)),
        url("../images/background.jpg") center / cover no-repeat;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 36px 32px 30px;
    border-radius: 22px;
    background: rgba(28, 23, 18, 0.55);
    border: 1px solid var(--line);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
    animation: rise .6s ease both;
}
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card h1 {
    margin: 0 0 4px;
    text-align: center;
    font-family: var(--serif);
    font-weight: 400;
    font-size: 30px;
}
.auth-card .sub { margin: 0 0 24px; text-align: center; color: var(--muted); font-size: 14px; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.field input, .field select {
    font-size: 16px !important;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font: inherit;
    transition: border-color .2s, background .2s;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field select option { background: #241d16; }
.field input:focus, .field select:focus { outline: 0; border-color: var(--accent); background: rgba(0, 0, 0, 0.35); }
.field-pw { position: relative; }
.field-pw input { padding-right: 48px; }
.toggle-pw {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 34px; height: 34px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--faint);
    cursor: pointer;
    display: grid; place-items: center;
}
.toggle-pw:hover { color: var(--text); background: var(--glass-hover); }
.toggle-pw svg { width: 18px; height: 18px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    margin-top: 8px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-strong), #d39150);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s, filter .2s, box-shadow .2s;
    box-shadow: 0 10px 24px -10px rgba(232, 180, 107, 0.6);
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--line);
    box-shadow: none;
}
.btn-ghost:hover { color: var(--text); background: var(--glass-hover); filter: none; }

.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 18px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 14px;
}
.alert-error { color: var(--danger); background: rgba(255, 138, 122, 0.1); border: 1px solid rgba(255, 138, 122, 0.3); }
.alert-success { color: var(--ok); background: rgba(159, 216, 164, 0.1); border: 1px solid rgba(159, 216, 164, 0.3); }

.auth-foot { margin: 22px 0 0; text-align: center; font-size: 12.5px; color: var(--faint); }


/* =========================================================
   ADAPTATION AUX ÉCRANS
   ========================================================= */

/* Navigateurs sans flou (anciens écrans) : fond plus opaque */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .topbar { background: rgba(20, 16, 12, 0.94); }
    .tile-link, .group { background: rgba(38, 31, 24, 0.82); }
    .auth-card { background: rgba(28, 23, 18, 0.93); }
}

/* Survol : uniquement avec une souris (évite les effets « collés » au doigt) */
@media (hover: none) {
    .tile-link:hover { transform: none; box-shadow: none; }
    .tile-link:active { transform: scale(0.98); background: var(--glass-hover); }
    .btn:active { transform: scale(0.98); }
}

/* ---------- Écrans tactiles : cibles plus grandes ---------- */
@media (pointer: coarse) {
    .fav { opacity: .7; width: 40px; height: 40px; top: 4px; right: 4px; font-size: 18px; }
    .tile-mini .fav { right: 22px; }
    .tile-mini .tile-link { min-height: 48px; padding-right: 64px; }
    .chip { padding: 10px 16px; font-size: 15px; }
    .icon-btn { width: 44px; height: 44px; }
    .search { height: 48px; }
    .search kbd { display: none; }
    .footer .hint { display: none; }
}

/* ---------- Petits téléphones ---------- */
@media (max-width: 380px) {
    .grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .tile-link { padding: 12px; }
    .tile-icon { width: 38px; height: 38px; font-size: 19px; }
    .tile-text strong { font-size: 14px; }
    .brand span { display: none; }
    .user-name { display: none; }
}

/* ---------- Téléphone : catégories défilantes sur une ligne ---------- */
@media (max-width: 760px) {
    .chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-left: calc(-1 * clamp(16px, 4vw, 48px));
        margin-right: calc(-1 * clamp(16px, 4vw, 48px));
        padding: 2px clamp(16px, 4vw, 48px) 6px;
        scrollbar-width: none;
    }
    .chips::-webkit-scrollbar { display: none; }
    .chip { flex: none; }
    .hero { padding: 26px 0 16px; }
    .section { margin-top: 28px; }
    .auth-card { padding: 28px 22px 24px; border-radius: 18px; }
}

/* ---------- Tablette (iPad…) ---------- */
@media (min-width: 761px) and (max-width: 1100px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .groups { columns: 2 280px; }
}

/* ---------- Grand écran tactile (frigo Samsung Family Hub, borne, TV) ---------- */
@media (pointer: coarse) and (min-width: 900px), (min-width: 1900px) {
    body { font-size: 17px; }
    .wrap, .footer { max-width: 1500px; }
    .topbar { padding-top: 18px; padding-bottom: 18px; }
    .brand { font-size: 26px; }
    .brand img { width: 36px; height: 36px; }
    .search { height: 58px; max-width: 640px; border-radius: 16px; }
    .search input { font-size: 19px !important; }
    .avatar { width: 44px; height: 44px; font-size: 19px; }
    .user-name { font-size: 18px; }
    .icon-btn { width: 54px; height: 54px; }
    .icon-btn svg { width: 24px; height: 24px; }

    .eyebrow { font-size: 16px; }
    .hero h1 { font-size: 64px; }
    .clock { font-size: 40px; color: var(--text); font-weight: 500; margin-top: 10px; }

    .chip { padding: 13px 22px; font-size: 18px; }
    .section { margin-top: 44px; }
    .section h2 { font-size: 27px; margin-bottom: 18px; }

    .grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
    .tile-link { padding: 22px 56px 22px 20px; gap: 18px; border-radius: 20px; }
    .tile-icon { width: 64px; height: 64px; font-size: 32px; border-radius: 16px; }
    .tile-text strong { font-size: 20px; }
    .tile-text small { font-size: 15.5px; }
    .tag { font-size: 12px; }
    .fav { width: 48px; height: 48px; font-size: 22px; }

    .groups { columns: 2 380px; column-gap: 16px; }
    .group { padding: 20px 14px 12px; margin-bottom: 16px; border-radius: 20px; }
    .group h3 { font-size: 15px; margin-bottom: 10px; }
    .tile-mini .tile-link { min-height: 60px; font-size: 19px; padding: 12px 76px 12px 14px; }
    .tile-mini .tile-link svg { width: 18px; height: 18px; }
    .tile-mini .fav { right: 26px; }

    .footer { font-size: 15px; }

    .auth-card { max-width: 560px; padding: 48px 44px 40px; }
    .auth-card h1 { font-size: 40px; }
    .auth-card .sub { font-size: 17px; }
    .field label { font-size: 16px; }
    .field input, .field select { height: 60px; font-size: 19px !important; }
    .btn { height: 62px; font-size: 19px; }
    .toggle-pw { width: 48px; height: 48px; }
}

/* ---------- Écran en mode portrait très haut (frigo) : on remplit l'espace ---------- */
@media (orientation: portrait) and (min-width: 900px) and (min-height: 1500px) {
    .hero { padding-top: 70px; padding-bottom: 30px; }
    .hero h1 { font-size: 76px; }
    .clock { font-size: 56px; }
}

/* ---------- Application installée sur l'écran d'accueil (iPhone/Android) ---------- */
@media (display-mode: standalone) {
    .footer { padding-bottom: max(30px, env(safe-area-inset-bottom)); }
}
