:root {
  --bg: #fbf7f3;
  --surface: #ffffff;
  --surface-strong: #f8efe6;
  --text: #3f2c27;
  --muted: #6f5a54;
  --primary: #b96a43;
  --primary-dark: #6a4338;
  --accent: #e2b451;
  --danger: #b42318;
  --safe: #2f7c52;
  --border: #eadfda;
  --shadow: 0 18px 45px rgba(82, 51, 41, 0.13);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --focus: 0 0 0 4px rgba(41, 70, 211, 0.25);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(226, 180, 81, 0.20), transparent 32rem),
    radial-gradient(circle at top right, rgba(185, 106, 67, 0.18), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.5;
}

button,
a,
input {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
dialog:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  transform: translateY(-160%);
  z-index: 10;
  background: var(--primary);
  color: #fff;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.hero,
.layout {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.hero {
  padding: 26px 0 18px;
}

.hero__topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.brand__logo {
  width: clamp(130px, 16vw, 220px);
  height: auto;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  padding: 0.35rem;
}

.brand__tagline {
  margin: 0.55rem 0 0;
  max-width: 780px;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
}

.eyebrow {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  line-height: 1.05;
  font-size: clamp(2rem, 5vw, 4.2rem);
}

.hero__lead {
  max-width: 760px;
  margin: 1.4rem 0 1.2rem;
  color: var(--muted);
  font-size: clamp(1.08rem, 2.6vw, 1.35rem);
}

.safety-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 8px solid var(--safe);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.safety-panel h2 {
  font-size: 1.35rem;
  margin-bottom: 0.25rem;
}

.safety-panel p {
  color: var(--muted);
  margin-bottom: 0;
}

.safety-panel__badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  min-height: 54px;
  padding: 0.75rem 1rem;
  color: #fff;
  background: var(--safe);
  border-radius: 999px;
  font-weight: 800;
}

.layout {
  padding-bottom: 2rem;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 14px 0 10px;
  backdrop-filter: blur(18px);
}

.search-box {
  display: grid;
  gap: 0.45rem;
  font-weight: 800;
}

.search-box input {
  width: 100%;
  min-height: 64px;
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 0 1.15rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 30px rgba(21, 31, 56, 0.08);
}

.category-tabs {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding: 0.8rem 0 0.25rem;
  scrollbar-width: thin;
}

.tab-button,
.help-chip,
.ghost-button,
.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

.tab-button {
  flex: 0 0 auto;
  padding: 0.65rem 1rem;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.tab-button[aria-pressed="true"] {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.ghost-button {
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.78);
  color: var(--primary-dark);
  border-color: var(--border);
}

.quick-help,
.footer-note {
  margin: 1rem 0;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.quick-help h2,
.footer-note h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.quick-help__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.help-chip {
  padding: 0.7rem 1rem;
  background: var(--surface-strong);
  color: var(--primary-dark);
}

.result-info p {
  min-height: 1.5rem;
  margin: 0.65rem 0;
  color: var(--muted);
  font-weight: 700;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 285px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.05rem;
  box-shadow: 0 14px 34px rgba(21, 31, 56, 0.09);
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.card__icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-strong);
  font-size: 1.6rem;
}

.card h3 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.28rem;
  line-height: 1.2;
}

.card p {
  color: var(--muted);
  margin-bottom: 1rem;
}

.card__domain {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  margin-top: auto;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  background: #f3f4f8;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.card__actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 1rem;
}

.open-button {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 17px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
  cursor: pointer;
}

.open-button:hover,
.primary-button:hover {
  background: var(--primary-dark);
}

.card--warning {
  border-color: rgba(180, 35, 24, 0.5);
}

.tag {
  align-self: flex-start;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(8, 116, 67, 0.1);
  color: var(--safe);
  font-size: 0.82rem;
  font-weight: 900;
}

.footer-note {
  margin-top: 1.2rem;
}

.footer-note p {
  color: var(--muted);
  margin-bottom: 0;
}

dialog {
  width: min(560px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(9, 15, 30, 0.58);
  backdrop-filter: blur(4px);
}

.launch-dialog__content {
  padding: 1.35rem;
}

.domain-check,
.dialog-warning {
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  font-weight: 800;
}

.domain-check {
  background: rgba(8, 116, 67, 0.1);
  color: var(--safe);
}

.dialog-warning {
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
}

.primary-button {
  background: var(--primary);
  color: #fff;
}

.secondary-button {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.empty-state {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 760px) {
  body {
    font-size: 17px;
  }

  .hero__topline,
  .safety-panel,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .brand {
    align-items: flex-start;
  }

  .brand__logo {
    width: min(170px, 42vw);
  }

  .cards {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #231916;
    --surface: #31221e;
    --surface-strong: #49342d;
    --text: #fff8f4;
    --muted: #ead9d1;
    --border: #5a433b;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    color-scheme: dark;
  }

  .ghost-button,
  .quick-help,
  .footer-note,
  .search-box input,
  .tab-button,
  .secondary-button {
    background: var(--surface);
  }

  .card__domain {
    background: #24324f;
  }
}


/* Blocs façon portail Kiosk : urgences, actions utiles, association */
.portal-blocks {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr;
  gap: 1rem;
  margin: 1rem 0 0;
}

.portal-block {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.05rem;
  box-shadow: 0 14px 34px rgba(82, 51, 41, 0.09);
}

.portal-block__header {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.portal-block__icon {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-strong);
  font-size: 1.55rem;
}

.portal-block h2 {
  margin-bottom: 0.1rem;
  font-size: 1.3rem;
}

.portal-block p {
  margin-bottom: 0;
  color: var(--muted);
}

.urgent-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.urgent-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.7rem;
  border-radius: 16px;
  background: var(--surface-strong);
}

.urgent-list span {
  font-weight: 950;
  color: var(--danger);
  white-space: nowrap;
}

.action-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.action-link {
  min-height: 54px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  color: var(--primary-dark);
  cursor: pointer;
  font-weight: 850;
  text-align: left;
  padding: 0.65rem 0.8rem;
}

.action-link:hover,
.action-link:focus-visible {
  border-color: var(--primary);
  background: var(--surface-strong);
}

.association-contact {
  display: grid;
  gap: 0.55rem;
  margin: 0.25rem 0 0.8rem;
}

.association-contact a {
  display: block;
  padding: 0.7rem 0.8rem;
  border-radius: 16px;
  background: var(--surface-strong);
  color: var(--primary-dark);
  font-weight: 900;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.portal-block__note {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.service-sections {
  display: grid;
  gap: 1rem;
}

.service-section {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.service-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.service-section__title {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.service-section__title span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-strong);
  font-size: 1.35rem;
}

.service-section h2 {
  margin-bottom: 0.15rem;
  font-size: 1.45rem;
}

.service-section p {
  margin-bottom: 0;
  color: var(--muted);
}

.service-section__count {
  flex: 0 0 auto;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  .portal-blocks {
    grid-template-columns: 1fr;
  }

  .action-links {
    grid-template-columns: 1fr;
  }

  .service-section__header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-color-scheme: dark) {
  .portal-block,
  .service-section,
  .action-link {
    background: var(--surface);
  }
}
