:root {
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: #ffffff;
  --bs-body-bg: linear-gradient(135deg, #00d4aa 0%, #00b8a9 50%, #0099ff 100%);
  --accent: #ffffff;
  --muted: #d4f1f4;
  --border: rgba(255, 255, 255, 0.2);
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

a, button, input, textarea, select {
  -webkit-user-select: text;
  user-select: text;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  font-family: var(--bs-body-font-family);
  color: var(--bs-body-color);
  background: var(--bs-body-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, .serif {
  font-family: 'Lora', Georgia, serif;
  letter-spacing: -0.01em;
}

.container {
  max-width: 100%;
  padding: 1rem;
  margin: 0 auto;
  flex: 1;
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding: 2rem 1rem;
  }
}

/* Bottom Navigation */
.navbar-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  padding-bottom: var(--safe-bottom);
  background: rgba(0, 50, 60, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

.navbar-bottom .nav-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  color: #b0d4d0;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  transition: color 0.2s ease;
  text-align: center;
  padding: 0 0.25rem;
}

.navbar-bottom .nav-item i {
  font-size: 1.5rem;
}

.navbar-bottom .nav-item:active,
.navbar-bottom .nav-item.active {
  color: #ffffff;
  background: rgba(0, 212, 170, 0.1);
}

.navbar-bottom .nav-item:hover {
  color: #ffffff;
}

/* Page Header */
.page-header {
  padding: 1.5rem 0 1rem;
}

.page-header .eyebrow {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: #d4f1f4;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.page-header h1 {
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 700;
  margin: 0;
  color: #ffffff;
  line-height: 1.2;
}

.page-header p.lead {
  color: #d4f1f4;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
  line-height: 1.5;
}

/* Post Cards */
.post-card {
  background: rgba(0, 50, 60, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #ffffff;
  transition: border-color 0.2s ease, background 0.2s ease;
  overflow: hidden;
  margin-bottom: 1rem;
  active: rgba(255, 255, 255, 0.1);
}

.post-card:active {
  background: rgba(0, 50, 60, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
}

.post-card:hover {
  background: rgba(0, 50, 60, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  color: #ffffff;
}

.post-card .category-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: #d4f1f4;
  margin-bottom: 0.5rem;
  padding: 0 1rem;
  padding-top: 1rem;
}

.post-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 1rem 0.4rem;
  color: #ffffff;
  line-height: 1.3;
}

.post-card .excerpt {
  color: #d4f1f4;
  font-size: 0.85rem;
  line-height: 1.5;
  flex: 1;
  padding: 0 1rem;
}

.post-card .meta {
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  padding: 0 1rem;
  font-size: 0.75rem;
  color: #b0d4d0;
}

.post-thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  width: 100%;
  border-radius: 0;
}

.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Grid */
.grid-posts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .grid-posts {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* Article */
.article-hero {
  max-width: 100%;
  margin: 0 0 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
}

.article-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.article-header {
  max-width: 100%;
  margin: 0;
  padding: 1.5rem 0 1rem;
}

.article-body {
  max-width: 100%;
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #ffffff;
}

.article-body p {
  margin-bottom: 1rem;
}

.article-body h2 {
  font-size: 1.4rem;
  margin: 1.5rem 0 0.75rem;
  font-weight: 600;
  color: #ffffff;
}

.article-body h3 {
  font-size: 1.15rem;
  margin: 1.25rem 0 0.5rem;
  font-weight: 600;
  color: #ffffff;
}

.article-body a {
  color: #ffd700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
  display: block;
}

.article-body iframe {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16/9;
  height: auto;
  border-radius: 0.5rem;
  border: 0;
  margin: 1rem 0;
}

.article-body pre {
  background: #f6f8fa;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
  margin: 1rem 0;
  color: #000;
  line-height: 1.4;
}

.article-body code {
  background: #f6f8fa;
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  color: #000;
  font-family: 'Courier New', monospace;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

.article-body ul, .article-body ol {
  margin-bottom: 1rem;
  padding-left: 1.25rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--muted);
  font-style: italic;
  margin: 1rem 0;
}

/* Links */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #d4f1f4;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
}

.back-link:active,
.back-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Forms */
.form-control, .form-select {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  color: #ffffff;
  padding: 0.75rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  min-height: 44px;
}

.form-control::placeholder {
  color: #b0d4d0;
}

.form-control:focus, .form-select:focus {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: #00d4aa;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.25);
  outline: none;
}

.btn {
  padding: 0.6rem 1.2rem;
  min-height: 44px;
  border-radius: 0.375rem;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #00d4aa 0%, #00b8a9 100%);
  color: #ffffff;
}

.btn-primary:hover, .btn-primary:active {
  background: linear-gradient(135deg, #00c495 0%, #00a89a 100%);
  color: #ffffff;
  text-decoration: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-secondary:hover, .btn-secondary:active {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
  text-decoration: none;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #d4f1f4;
}

.empty-state h2 {
  color: #ffffff;
  margin-bottom: 1rem;
}

/* Alert */
.alert {
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
}

.alert-success {
  background: rgba(0, 212, 170, 0.15);
  border-color: rgba(0, 212, 170, 0.3);
  color: #d4f1f4;
}

.alert-error {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

/* Post Item (Actualité List) */
.post-item {
  display: flex;
  gap: 1rem;
  background: rgba(0, 50, 60, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  padding: 1rem;
  text-decoration: none;
  color: #ffffff;
  transition: border-color 0.2s ease, background 0.2s ease;
  align-items: flex-start;
}

.post-item:active {
  background: rgba(0, 50, 60, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
}

.post-item:hover {
  background: rgba(0, 50, 60, 0.8);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

.post-item-image {
  width: 80px;
  height: 80px;
  min-width: 80px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.375rem;
}

.post-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-item-content {
  flex: 1;
  min-width: 0;
}

.post-item .category-tag {
  font-size: 0.7rem;
  margin-bottom: 0.4rem;
  padding: 0;
}

.post-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.3rem;
  color: #ffffff;
  line-height: 1.3;
}

.post-item .excerpt {
  color: #d4f1f4;
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0;
}

.post-item .meta {
  font-size: 0.7rem;
  margin-top: 0.5rem;
}

/* Timeline (Actualité) */
.day-header {
  margin: 1.25rem 0 .5rem;
  padding: 0 .15rem .35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.65);
}

.day-header:first-child {
  margin-top: .25rem;
}

.day-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-bottom: .5rem;
}

.day-list.is-new .post-item {
  animation: pwa-row-in 0.3s ease both;
}

@keyframes pwa-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 1rem;
}

.load-more-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: .65rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  min-height: 44px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}

.load-more-btn:active,
.load-more-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.load-more-btn[disabled] {
  opacity: 0.65;
  cursor: wait;
}

.lm-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: lm-spin 0.8s linear infinite;
}

.load-more-btn.is-loading .lm-spinner { display: inline-block; }
.load-more-btn.is-loading .lm-label { opacity: 0.7; }

@keyframes lm-spin {
  to { transform: rotate(360deg); }
}

/* Keyboard Safety */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
  -webkit-appearance: none;
  appearance: none;
  font-size: 16px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23d4f1f4' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* Touch Feedback */
@media (hover: none) and (pointer: coarse) {
  a, button, .post-card {
    -webkit-tap-highlight-color: rgba(0, 212, 170, 0.2);
  }
}

/* PWA Footer */
.pwa-footer {
  background: rgba(0, 50, 60, 0.6);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  margin-top: auto;
  margin-bottom: calc(70px + var(--safe-bottom) + 1rem);
  text-align: center;
  flex-shrink: 0;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 1rem;
}

.dashboard-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.dashboard-link:active,
.dashboard-link:hover {
  color: #ffffff;
}

.dashboard-link i {
  font-size: 0.9rem;
}

.footer-separator {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
}

.footer-credit {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

.footer-credit a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-credit a:active,
.footer-credit a:hover {
  color: #ffffff;
  text-decoration: underline;
}

/* Print */
@media print {
  .navbar-site, .site-footer, #install-btn {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000;
  }

  a {
    color: #0066cc;
  }
}
