/* UEA Hubs — thèmes alignés sur UATWeb (clair / sombre) */
:root,
html[data-theme="light"] {
  --blue: #1e3a8a;
  --blue-dark: #1e293b;
  --blue-light: #2563eb;
  --blue-soft: #dbeafe;
  --ink: #1e293b;
  --ink-soft: #64748b;
  --paper: #ffffff;
  --surface: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.1);
  --shadow-soft: rgba(0, 0, 0, 0.08);
  --bg: #f1f5f9;
  --bg-grad: linear-gradient(135deg, #eff6ff 0%, #f1f5f9 50%, #f0fdf4 100%);
  --tile-bg: #ffffff;
  --tile-border: #e2e8f0;
  --link-bg: #ffffff;
  --modal-bg: #ffffff;
  --modal-scrim: rgba(15, 23, 42, 0.45);
  --accent: #1e3a8a;
  --accent-soft: #dbeafe;
  --install-color: #1e3a8a;
  --install-border: #2563eb;
  --help-bg: #ffffff;
  --go: #2563eb;
  --radius: 16px;
  --font-display: "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --theme-color: #1e3a8a;
  color-scheme: light;
}

html[data-theme="dark"] {
  --blue: #60a5fa;
  --blue-dark: #f1f5f9;
  --blue-light: #93c5fd;
  --blue-soft: #1e3a5f;
  --ink: #e2e8f0;
  --ink-soft: #94a3b8;
  --paper: #1e293b;
  --surface: #1e293b;
  --border: #334155;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --shadow-soft: rgba(0, 0, 0, 0.35);
  --bg: #0f172a;
  --bg-grad: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --tile-bg: #1e293b;
  --tile-border: #334155;
  --link-bg: rgba(30, 41, 59, 0.92);
  --modal-bg: #1e293b;
  --modal-scrim: rgba(2, 6, 23, 0.72);
  --accent: #60a5fa;
  --accent-soft: #1e3a5f;
  --install-color: #93c5fd;
  --install-border: #60a5fa;
  --help-bg: #1e293b;
  --go: #60a5fa;
  --theme-color: #0f172a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background: var(--bg-grad);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.15rem 0 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: rise 0.7s ease both;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark img {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  object-fit: contain;
  box-shadow: 0 8px 24px var(--shadow-soft);
}

.brand-mark .meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-mark .meta strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue-dark);
}

.brand-mark .meta span {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.lang-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.lang-select-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 7.5rem;
  padding: 0.42rem 1.85rem 0.42rem 0.7rem;
  border: 1.5px solid var(--blue);
  border-radius: 8px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231e3a8a' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 10px 7px;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.lang-select:focus {
  outline: 2px solid color-mix(in srgb, var(--blue) 35%, transparent);
  outline-offset: 1px;
}

html[data-theme="dark"] .lang-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2393c5fd' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.install-btn,
.help-btn,
.lan-btn,
.theme-btn {
  appearance: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.68rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.install-btn {
  background: transparent;
  color: var(--install-color);
  border: 1.5px solid var(--install-border);
  box-shadow: none;
}

.install-btn:hover {
  background: var(--blue-soft);
}

.help-btn,
.lan-btn,
.theme-btn {
  background: var(--help-bg);
  color: var(--ink);
  border: 1px solid var(--border);
}

.help-btn:hover,
.lan-btn:hover,
.theme-btn:hover {
  background: var(--blue-soft);
  border-color: var(--blue-light);
}

.lan-btn.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

html[data-theme="dark"] .lan-btn.is-active {
  background: #14b8a6;
  border-color: #14b8a6;
  color: #042f2e;
}

.theme-btn .theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-btn .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-btn .theme-icon-dark { display: inline; }

.install-btn:hover,
.help-btn:hover,
.lan-btn:hover,
.theme-btn:hover { transform: translateY(-1px); }

.install-btn[hidden],
.install-btn.is-installed { display: none; }

.lan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  background: linear-gradient(120deg, #ecfdf5, #e0f2fe);
  border: 1px solid #99f6e4;
  color: #134e4a;
  animation: rise 0.35s ease both;
}

.lan-banner[hidden] {
  display: none !important;
}

html[data-theme="dark"] .lan-banner {
  background: linear-gradient(120deg, #134e4a, #1e3a5f);
  border-color: #2dd4bf55;
  color: #ccfbf1;
}

.lan-banner-text {
  font-size: 0.9rem;
  line-height: 1.35;
}

.lan-banner-btn {
  border: 0;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.modal-actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.modal-card .close.close--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}

html[data-theme="dark"] .modal-card .close.close--ghost {
  background: transparent;
  color: var(--ink);
}

.hero {
  padding: 0.5rem 0 1rem;
  animation: rise 0.8s 0.08s ease both;
}

.hero .eyebrow {
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
}

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--blue);
}

html[data-theme="light"] .hero h1 {
  color: #1e3a8a;
}

html[data-theme="dark"] .hero h1 {
  color: #60a5fa;
}

.hero p {
  margin: 0.85rem 0 0;
  max-width: 38rem;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.55;
}

.section {
  margin-top: 2rem;
  animation: rise 0.85s 0.16s ease both;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.7rem;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--blue-dark);
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 148px;
  padding: 1.15rem 1.2rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--tile-border);
  background: var(--tile-bg);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  position: relative;
  overflow: hidden;
}

.tile::after {
  content: "";
  position: absolute;
  inset: auto -18% -42% auto;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--blue) 18%, transparent), transparent 70%);
  pointer-events: none;
}

.tile:hover,
.tile:focus-visible {
  transform: translateY(-3px);
  border-color: var(--blue);
  outline: none;
}

.tile .kicker {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  font-weight: 700;
}

.tile .title {
  margin-top: 0.85rem;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--blue-dark);
}

.tile .hint {
  margin-top: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.4;
}

.tile .go {
  margin-top: 1.05rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--go);
}

.tile--with-actions {
  cursor: default;
}

.tile--with-actions:hover,
.tile--with-actions:focus-visible {
  transform: none;
}

.tile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 1.05rem;
  position: relative;
  z-index: 1;
}

.tile-action {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--go);
  text-decoration: none;
}

.tile-action:hover,
.tile-action:focus-visible {
  text-decoration: underline;
  outline: none;
}

.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}

.link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem;
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--tile-border);
  background: var(--link-bg);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 4px 14px var(--shadow-soft);
}

.link:hover,
.link:focus-visible {
  border-color: var(--blue);
  transform: translateY(-1px);
  outline: none;
  background: var(--blue-soft);
}

.link .glyph {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 700;
  flex: 0 0 auto;
  overflow: hidden;
}

.link .glyph svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
  fill: currentColor;
}

.link .glyph--facebook { background: #1877f2; color: #fff; }
.link .glyph--linkedin { background: #0a66c2; color: #fff; }
.link .glyph--x { background: #0f172a; color: #fff; }
[data-theme="dark"] .link .glyph--x { background: #e2e8f0; color: #0f172a; }
.link .glyph--whatsapp { background: #25d366; color: #fff; }
.link .glyph--youtube { background: #ff0000; color: #fff; }
.link .glyph--tiktok { background: #010101; color: #fff; }
.link .glyph--webmail { background: #1e3a8a; color: #fff; }

.link .copy strong {
  display: block;
  font-size: 0.92rem;
}

.link .copy span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

.site-footer {
  margin-top: 2.6rem;
  text-align: center;
  animation: rise 0.9s 0.24s ease both;
}

.org-name {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.35;
}

.motto {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
}

.copyright {
  margin: 0.45rem 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.copyright a {
  color: var(--blue);
  font-weight: 650;
  text-decoration: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: var(--modal-scrim);
  display: none;
  place-items: center;
  padding: 1rem;
  z-index: 1000;
}

.modal.is-open {
  display: grid;
}

.modal-card {
  width: min(460px, 100%);
  background: var(--modal-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.35rem 1.3rem 1.2rem;
  box-shadow: var(--shadow);
}

.modal-card h3 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  color: var(--blue-dark);
}

.modal-card ol,
.modal-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.modal-card ol { padding-left: 1.15rem; }

.contact-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.contact-list li {
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: var(--link-bg);
  border: 1px solid var(--border);
}

.contact-list strong {
  display: block;
  font-size: 0.98rem;
}

.contact-list a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.contact-list .role {
  display: block;
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.modal-card .close {
  margin-top: 1rem;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 0.75rem;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

html[data-theme="dark"] .modal-card .close {
  background: #2563eb;
  color: #fff;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Full-screen loading while opening an app */
.uea-loading {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.uea-loading.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.uea-loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  min-width: 200px;
  padding: 1.35rem 1.6rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.uea-loading-spinner {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--blue) 25%, transparent);
  border-top-color: var(--blue);
  animation: uea-spin 0.75s linear infinite;
}

.uea-loading-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

@keyframes uea-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .actions { width: 100%; }
  .install-btn, .help-btn, .lan-btn, .theme-btn { flex: 1 1 auto; text-align: center; }
  .lang-select-wrap { width: 100%; justify-content: flex-end; }
  .lang-select { flex: 1 1 auto; max-width: 12rem; }
}

/* In-PWA app viewer (keeps navigation inside the installed window) */
body.app-view {
  margin: 0;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.app-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 52px;
  flex: 0 0 auto;
  padding: 0 0.85rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 10px var(--shadow-soft);
}

.app-back,
.app-external,
.app-refresh {
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--blue);
  white-space: nowrap;
}

.app-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.35rem;
  margin-left: -0.25rem;
  border-radius: 0.45rem;
}

.app-back-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  fill: currentColor;
  flex: 0 0 auto;
}

.app-back:hover,
.app-back:focus-visible {
  background: var(--blue-soft);
  text-decoration: none;
  outline: none;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.app-refresh,
.app-external {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0.35rem;
  margin: 0;
  cursor: pointer;
  font: inherit;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.45rem;
  color: var(--blue);
}

.app-refresh svg,
.app-external svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  fill: currentColor;
}

.app-refresh:hover,
.app-refresh:focus-visible,
.app-external:hover,
.app-external:focus-visible {
  background: var(--blue-soft);
  text-decoration: none;
  outline: none;
}

.app-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--blue-dark);
  font-size: 0.95rem;
}

.app-frame-wrap {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  background: var(--bg);
}

.app-view .site-footer {
  margin: 0;
  padding: 0.45rem 0.75rem 0.55rem;
  flex: 0 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  animation: none;
}

.app-view .org-name {
  font-size: 0.62rem;
  margin-bottom: 0.15rem;
}

.app-view .motto {
  font-size: 0.78rem;
}

.app-view .copyright {
  margin-top: 0.2rem;
  font-size: 0.72rem;
}

.app-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.app-fallback {
  position: absolute;
  inset: 0;
  place-content: center;
  gap: 0.85rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--ink-soft);
  background: var(--bg);
}

.app-fallback:not([hidden]) {
  display: grid;
}

.app-fallback[hidden] {
  display: none !important;
}

.app-fallback-title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--ink);
}

.app-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.app-fallback .install-btn,
.app-fallback .help-btn {
  display: inline-block;
  text-decoration: none;
  text-align: center;
  border: 0;
  cursor: pointer;
  font: inherit;
}
