/* SuiviProjets — visual system.
   Academia / teamwork / student-success vibe: warm violet + coral + green,
   a friendly display face (Fredoka) for headings/brand/buttons, clean
   system sans for body copy and form controls so it stays legible as a
   working tool, not just a poster. */

@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/fredoka-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/fredoka-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF;
}

:root {
  --brand: #7c5cfc;
  --brand-dark: #5b3df0;
  --brand-light: #ede9fe;
  --coral: #ff7a59;
  --coral-light: #ffe8e0;
  --amber: #f5a524;
  --amber-light: #fef3dc;
  --green: #1fa971;
  --green-light: #dcfce7;
  --red: #e5484d;
  --red-light: #fde4e4;
  --ink: #201b36;
  --body-text: #443f5c;
  --muted: #8a84a3;
  --border: #e7e3f5;
  --bg: #f8f6ff;
  --card-bg: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.82);
  --bg-glow-1: rgba(124, 92, 252, 0.14);
  --bg-glow-2: rgba(255, 122, 89, 0.12);
  --shadow-sm: 0 1px 2px rgba(76, 53, 169, 0.06);
  --shadow: 0 6px 20px rgba(85, 61, 176, 0.10), 0 1px 3px rgba(85, 61, 176, 0.06);
  --shadow-lift: 0 10px 26px rgba(85, 61, 176, 0.16), 0 2px 6px rgba(85, 61, 176, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --font-display: 'Fredoka', system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Dark palette — same roles, different values. Defined once and shared by
   both the system-preference media query and the explicit toggle so they
   never drift apart. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --brand: #9c89ff; --brand-dark: #c3b5ff; --brand-light: rgba(156, 137, 255, 0.18); --coral: #ff9478; --coral-light: rgba(255, 122, 89, 0.18); --amber: #f7b955; --amber-light: rgba(245, 165, 36, 0.18); --green: #3ecf8e; --green-light: rgba(31, 169, 113, 0.2); --red: #f3767b; --red-light: rgba(229, 72, 77, 0.2); --ink: #f3f1ff; --body-text: #c9c4de; --muted: #948daf; --border: #35304f; --bg: #150f24; --card-bg: #1e1832; --header-bg: rgba(21, 15, 36, 0.82); --bg-glow-1: rgba(156, 137, 255, 0.16); --bg-glow-2: rgba(255, 148, 120, 0.10); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25); --shadow-lift: 0 10px 26px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3); }
}
:root[data-theme="dark"] { --brand: #9c89ff; --brand-dark: #c3b5ff; --brand-light: rgba(156, 137, 255, 0.18); --coral: #ff9478; --coral-light: rgba(255, 122, 89, 0.18); --amber: #f7b955; --amber-light: rgba(245, 165, 36, 0.18); --green: #3ecf8e; --green-light: rgba(31, 169, 113, 0.2); --red: #f3767b; --red-light: rgba(229, 72, 77, 0.2); --ink: #f3f1ff; --body-text: #c9c4de; --muted: #948daf; --border: #35304f; --bg: #150f24; --card-bg: #1e1832; --header-bg: rgba(21, 15, 36, 0.82); --bg-glow-1: rgba(156, 137, 255, 0.16); --bg-glow-2: rgba(255, 148, 120, 0.10); --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25); --shadow-lift: 0 10px 26px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.3); }

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    radial-gradient(680px circle at 8% -10%, var(--bg-glow-1), transparent 55%),
    radial-gradient(520px circle at 100% 0%, var(--bg-glow-2), transparent 55%);
  background-attachment: fixed;
  transition: background-color 0.2s, color 0.2s;
  color: var(--body-text);
  margin: 0;
  line-height: 1.5;
}

h1, h2, h3, .brand, button, .btn, .task-card .title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
}

h1 { font-size: 1.7rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin-top: 2.25rem; color: var(--ink); }

a { color: var(--brand-dark); }

/* The join link is a long unbroken token — without this it overflows the
   viewport width on narrow screens instead of wrapping. */
code { overflow-wrap: anywhere; }

/* ---------- header / nav ---------- */

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.site .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 700;
}
header.site .brand .mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--coral));
  color: #fff;
  font-size: 1rem;
  box-shadow: var(--shadow-sm);
}
header.site .brand .word {
  background: linear-gradient(135deg, var(--brand-dark), var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

header.site nav { display: flex; align-items: center; gap: 0.4rem; }
header.site nav a {
  margin-left: 0.15rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  color: var(--body-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
header.site nav a:hover { background: var(--brand-light); color: var(--brand-dark); }

.icon-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.4rem;
  font-size: 1.1rem;
  line-height: 1;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.icon-btn:hover { background: var(--brand-light); transform: none; box-shadow: none; }

/* ---------- layout ---------- */

main { max-width: 760px; margin: 2.5rem auto; padding: 0 1.5rem; }
main.wide { max-width: 1140px; }

/* ---------- forms ---------- */

form.stack { display: flex; flex-direction: column; gap: 1rem; max-width: 400px; }
.inline-form { flex-direction: row; align-items: end; max-width: none; flex-wrap: wrap; }
label { font-size: 0.82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
input, select, textarea {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-body);
  width: 100%;
  background: var(--card-bg);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-light);
}

button, .btn {
  padding: 0.65rem 1.3rem;
  border: none;
  background: linear-gradient(135deg, var(--brand), var(--coral));
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
button:active, .btn:active { transform: translateY(0); }

button.secondary, .btn.secondary {
  background: var(--card-bg);
  color: var(--brand-dark);
  border: 1.5px solid var(--border);
  box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover { border-color: var(--brand); background: var(--brand-light); }

button.danger { background: linear-gradient(135deg, var(--coral), var(--red)); }

.error {
  color: var(--red);
  background: var(--red-light);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.hint { color: var(--muted); font-size: 0.88rem; }

/* ---------- cards ---------- */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

/* ---------- auth pages (welcome feel) ---------- */

.auth-shell {
  max-width: 420px;
  margin: 4rem auto;
  padding: 0 1.5rem;
  text-align: center;
}
.auth-shell .badge-emoji {
  font-size: 2.6rem;
  display: block;
  margin-bottom: 0.5rem;
}
.auth-shell .card { text-align: left; margin-top: 1.5rem; }
.auth-shell h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-shell form.stack { max-width: none; }

/* ---------- rubric table ---------- */

table.rubric { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 1rem; }
table.rubric th {
  text-align: left;
  padding: 0.5rem 0.7rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
table.rubric td { padding: 0.7rem; border-bottom: 1px solid var(--border); background: var(--card-bg); }
table.rubric tr:first-child td { padding-top: 0.9rem; }
table.rubric input { width: 100%; }
table.rubric details { margin-top: 0.4rem; }
table.rubric details summary { cursor: pointer; color: var(--brand-dark); font-weight: 500; }
table.rubric details form.stack { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; gap: 0.5rem; margin-top: 0.6rem; }
table.rubric details form.stack input, table.rubric details form.stack select { width: auto; flex: 1 1 160px; }

.weight-pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--amber-light);
  color: #8a5a05;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---------- kanban board ---------- */

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; margin-top: 1rem; }
.board .column {
  border-radius: var(--radius);
  padding: 0.9rem;
  min-height: 220px;
  background: var(--card-bg);
  border: 1px solid var(--border);
}
.board .column h3 {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.board .column.todo { background: linear-gradient(180deg, var(--brand-light), var(--card-bg) 140px); }
.board .column.todo h3 { color: var(--brand-dark); }
.board .column.in_progress { background: linear-gradient(180deg, var(--amber-light), var(--card-bg) 140px); }
.board .column.in_progress h3 { color: #8a5a05; }
.board .column.done { background: linear-gradient(180deg, var(--green-light), var(--card-bg) 140px); }
.board .column.done h3 { color: #167a54; }

.task-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 0.8rem 0.85rem;
  margin-bottom: 0.7rem;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
}
.task-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.task-card.overdue { border-color: var(--red); box-shadow: 0 0 0 1px var(--red-light); }
.task-card .title { font-size: 0.98rem; margin-bottom: 0.4rem; }
.task-card .title a { color: var(--ink); text-decoration: none; }
.task-card .title a:hover { color: var(--brand-dark); }
.task-card .meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.task-card .overdue-flag {
  color: var(--red);
  font-weight: 700;
  background: var(--red-light);
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill);
}

.move-select {
  width: 100%;
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--body-text);
}

/* ---------- avatars ---------- */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-display);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.avatar.lg { width: 42px; height: 42px; font-size: 1rem; }

.member-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.member-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem 0.25rem 0.25rem;
  font-size: 0.85rem;
  color: var(--body-text);
  box-shadow: var(--shadow-sm);
}

/* ---------- project list ---------- */

.project-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.project-grid li {
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.project-grid li:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.project-grid li .bar { height: 8px; }
.project-grid li .body { padding: 1rem 1.1rem 1.15rem; }
.project-grid a {
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  display: block;
  margin-bottom: 0.3rem;
}
.project-grid .due { font-size: 0.82rem; color: var(--muted); }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.empty-state .emoji { font-size: 2.4rem; display: block; margin-bottom: 0.5rem; }

/* ---------- how it works ---------- */

.steps { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-direction: column; gap: 1.4rem; }
.steps li { display: flex; gap: 1rem; align-items: flex-start; }
.steps h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.steps p { margin: 0; color: var(--body-text); }
.step-num {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--coral));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* ---------- danger zone (project deletion) ---------- */

.danger-zone {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}
.danger-zone summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.danger-zone form { margin-top: 0.75rem; }

/* ---------- privacy page ---------- */

.privacy-section { margin-bottom: 1.75rem; }
.privacy-section h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.privacy-section p { margin: 0; color: var(--body-text); }
.privacy-section ul { margin: 0.4rem 0 0; padding-left: 1.2rem; color: var(--body-text); }

/* ---------- site footer ---------- */

.site-footer {
  max-width: 1140px;
  margin: 3rem auto 2rem;
  padding: 1.25rem 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand-dark); }
.site-footer span { margin: 0 0.4rem; }

/* ---------- mobile nav (hamburger) ---------- */

.nav-toggle-btn { display: none; }

@media (max-width: 640px) {
  .nav-toggle-btn { display: inline-flex; }

  header.site nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem 1rem;
    box-shadow: var(--shadow);
  }
  header.site nav.open { display: flex; }
  header.site nav a, header.site nav .icon-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 0.6rem 0.85rem;
    margin-left: 0;
  }

  main { margin: 1.5rem auto; padding: 0 1rem; }
  .board { grid-template-columns: 1fr; }

  /* Row-laid-out forms (standalone task, per-rubric-item task) would
     otherwise overflow horizontally on narrow screens — stack instead. */
  .inline-form,
  table.rubric details form.stack {
    flex-direction: column;
    align-items: stretch;
  }
  .inline-form input, .inline-form select,
  table.rubric details form.stack input, table.rubric details form.stack select {
    width: 100%;
    flex: none;
  }

  table.rubric th:nth-child(3), table.rubric td:nth-child(3) { display: none; }
}
