/* ==========================================================================
   Tunivisions ISSAT Kairouan — base.css
   Design tokens, reset, typography, buttons, pills, utilities, motion.
   Load order: base.css -> layout.css -> components.css -> pages.css
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,600;1,700&family=Sora:wght@600;700;800;900&display=swap');

/* Club display script — shipped with the project, not a webfont. */
@font-face {
    font-family: 'Transcity';
    src: url('../fonts/Transcity DEMO.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand — palette unchanged */
    --red: #ed174c;
    --red-dark: #c90f3d;
    --red-soft: #ff6b8e;

    /* Surfaces */
    --paper: #000000;
    --soft: #101010;
    --surface: #101010;
    --surface-2: #181818;
    --surface-3: #1f1f1f;

    /* Text */
    --ink: #ffffff;
    --muted: #b8b8c0;
    --muted-strong: #d5d5dc;
    --faint: #8a8a93;

    /* Lines */
    --line: #2c2c2c;
    --line-strong: #3d3d3d;

    /* Status */
    --ok: #72e2a4;
    --ok-bg: #173b2b;
    --warn: #ffd166;
    --warn-bg: #3b301b;
    --danger: #ff8585;
    --danger-bg: #401f22;

    /* Corners — squarer, less “bubbly” */
    --r-xs: 8px;
    --r-sm: 11px;
    --r-md: 14px;
    --r-lg: 18px;
    --r-xl: 24px;
    --radius-sm: var(--r-sm);
    --radius: var(--r-lg);
    --radius-lg: var(--r-xl);
    --pill: var(--r-md);

    /* Elevation */
    --shadow-sm: 0 6px 18px rgba(0, 0, 0, .35);
    --shadow: 0 20px 48px rgba(0, 0, 0, .5);
    --shadow-red: 0 12px 28px rgba(237, 23, 76, .24);

    /* Motion */
    --ease: .22s cubic-bezier(.4, 0, .2, 1);
    --ease-out: .65s cubic-bezier(.22, 1, .36, 1);

    /* Layout */
    --max: 1180px;
    --nav-h: 80px;
    --nav-h-sm: 64px;

    /* Type */
    --font-head: 'Sora', system-ui, sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-script: 'Transcity', 'Sora', cursive;
    --font-journal: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
}

/* --------------------------------------------------------------------------
   2. Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    /* Depth instead of flat black: a cool vertical wash plus two faint brand
       glows. `fixed` ties it to the viewport, so the page keeps one sky. */
    background-color: var(--paper);
    background-image:
        radial-gradient(1100px 700px at 84% -8%, rgba(237, 23, 76, .15), transparent 60%),
        radial-gradient(900px 600px at -12% 24%, rgba(237, 23, 76, .07), transparent 58%),
        linear-gradient(180deg, #0c0b10 0%, #05050a 34%, #000 76%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* `clip` prevents a horizontal scroll container, which would break the
   sticky header. Supported by every modern browser. */
@supports (overflow: clip) {
    body { overflow-x: clip; }
}

img,
svg { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

button,
input,
textarea,
select { font: inherit; color: inherit; }

button { cursor: pointer; background: none; border: 0; }

button,
a { -webkit-tap-highlight-color: transparent; }

ul,
ol { margin: 0; padding: 0; list-style: none; }

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 3px;
    border-radius: var(--r-xs);
}

::selection { background: var(--red); color: #fff; }

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5 {
    font-family: var(--font-head);
    font-weight: 800;
    line-height: 1.14;
    letter-spacing: -.6px;
    margin: 0;
}

p { margin: 0; }
strong { font-weight: 700; }
small { font-size: 12px; }

/* --------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 22px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: transform var(--ease), box-shadow var(--ease), background var(--ease), color var(--ease), border-color var(--ease);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn[disabled],
.btn.is-busy { opacity: .55; pointer-events: none; }

.btn-primary {
    background-image: linear-gradient(115deg, var(--red) 0%, var(--red) 42%, #ff587f 50%, var(--red) 58%, var(--red) 100%);
    background-size: 240% 100%;
    background-position: 100% 0;
    color: #fff;
    box-shadow: var(--shadow-red);
    transition: transform var(--ease), box-shadow var(--ease), background-position .7s var(--ease);
}
.btn-primary:hover { background-position: 0 0; box-shadow: 0 16px 34px rgba(237, 23, 76, .32); }

.btn-light { background: #fff; color: #08080a; border-color: #fff; }
.btn-light:hover { box-shadow: 0 12px 26px rgba(255, 255, 255, .14); }

.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }

.btn-ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--red); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #6b2a2f; }
.btn-danger:hover { background: #52262a; }

.btn-small { padding: 10px 16px; font-size: 13px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; border-radius: var(--r-sm); }

/* --------------------------------------------------------------------------
   5. Eyebrow, links, pills
   -------------------------------------------------------------------------- */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--red);
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.7px;
    text-transform: uppercase;
}
.eyebrow::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--red);
    font-size: 13px;
    font-weight: 700;
    transition: color var(--ease), gap var(--ease);
}
.text-link:hover { color: var(--red-soft); gap: 8px; }

.status,
.badge {
    display: inline-block;
    padding: 5px 11px;
    border-radius: var(--r-xs);
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}
.badge { background: var(--surface-3); color: var(--muted-strong); text-transform: none; }
.status.pending,
.status.draft { background: var(--warn-bg); color: var(--warn); }
.status.approved,
.status.active,
.status.published { background: var(--ok-bg); color: var(--ok); }
.status.rejected,
.status.suspended,
.status.archived { background: var(--danger-bg); color: var(--danger); }

/* --------------------------------------------------------------------------
   6. Alerts
   -------------------------------------------------------------------------- */
.alert {
    padding: 12px 15px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 13px;
    line-height: 1.6;
}
.alert-error { background: var(--danger-bg); border-color: #6b2a2f; color: #ffb4b4; }
.alert-ok    { background: var(--ok-bg); border-color: #1f5740; color: #b6f2d1; }
.alert-info  { background: #16233b; border-color: #294066; color: #bcd4ff; }
.alert[hidden] { display: none; }

/* --------------------------------------------------------------------------
   7. Utilities
   -------------------------------------------------------------------------- */
.hidden,
[hidden] { display: none !important; }

.text-center { text-align: center; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; }

/* --------------------------------------------------------------------------
   8. Feedback: skeleton, spinner, empty state, toast
   -------------------------------------------------------------------------- */
.skeleton {
    min-height: 170px;
    border-radius: var(--r-lg);
    background: linear-gradient(100deg, var(--surface-2) 30%, #262626 50%, var(--surface-2) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
}

/* Shimmer placeholders shaped like the content they stand in for, so nothing
   jumps when the real rows arrive. */
.sk-card {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
}
.sk-card.is-media { padding: 0 0 22px; overflow: hidden; }
.sk-card.is-media > :not(.sk-cover) { margin-inline: 22px; }
.sk {
    --sk-h: 12px;
    height: var(--sk-h);
    border-radius: 6px;
    background: linear-gradient(100deg, var(--surface-2) 30%, #262626 50%, var(--surface-2) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
}
.sk-cover { --sk-h: 118px; border-radius: 0; }
.sk-tag { --sk-h: 10px; width: 92px; }
.sk-title { --sk-h: 18px; width: 62%; }
.sk-line { width: 100%; }
.sk-line.is-short { width: 46%; }
.sk-thumb { --sk-h: 62px; width: 100%; border-radius: var(--r-sm); }

/* Standalone shimmer for a short label with no box of its own. */
.sk-inline {
    display: inline-block;
    width: 6em;
    height: .8em;
    border-radius: 5px;
    vertical-align: middle;
    background: linear-gradient(100deg, var(--surface-2) 30%, #262626 50%, var(--surface-2) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.3s linear infinite;
}

.spinner {
    width: 26px; height: 26px;
    border: 3px solid var(--line-strong);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.loading-block {
    display: grid;
    place-items: center;
    gap: 12px;
    padding: 50px 0;
    color: var(--faint);
    font-size: 13px;
}

.empty-state {
    padding: 46px 22px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
    font-size: 14px;
    background: rgba(255, 255, 255, .015);
}
.empty-state strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 16px; font-family: var(--font-head); }

.toast-wrap {
    position: fixed;
    inset-block-end: 20px;
    inset-inline-end: 20px;
    z-index: 120;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100% - 40px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
    box-shadow: var(--shadow);
    font-size: 13px;
    animation: toastIn .35s var(--ease-out) both;
}
.toast.ok { border-color: #1f5740; }
.toast.error { border-color: #6b2a2f; }
.toast button { margin-inline-start: auto; color: var(--faint); font-size: 16px; line-height: 1; }
.toast button:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   9. Scroll reveal
   -------------------------------------------------------------------------- */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
    transition-delay: calc(var(--stagger, 0) * 70ms);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* Dynamic cards animate in as they are rendered. `backwards` (not `both`)
   clears the animation once it ends so hover transforms keep working. */
.rise-in {
    animation: rise .55s var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 70ms);
}

/* --------------------------------------------------------------------------
   10. Motion
   -------------------------------------------------------------------------- */
@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to   { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}
@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}
@keyframes spinSlow { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* --------------------------------------------------------------------------
   11. Scrollbar
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: #2b2b2b; border-radius: 999px; border: 3px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }
