/* Portail interne — Mairie de Pradines
   Palette et typographie reprises des documents municipaux existants. */

:root {
  --ink: #1A1A1A;
  --forest: #1B5E3A;
  --ember: #BC6B13;
  --stone: #767676;
  --linen: #FAF8F4;
  --hairline: #E0DDD5;
  --panel: #F0EDE6;
  --white: #FFFFFF;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Marianne", "Marianne Light", -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--linen);
  line-height: 1.5;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 3px solid var(--ember);
  padding: 40px 0 28px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-logo {
  height: 56px;
  width: auto;
  flex-shrink: 0;
}

.site-header .eyebrow {
  margin: 0 0 6px;
  color: var(--stone);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.site-header h1 {
  margin: 0 0 10px;
  color: var(--forest);
  font-size: 2rem;
  font-weight: 700;
}

.site-header .lede {
  margin: 0;
  max-width: 640px;
  color: var(--ink);
  font-size: 1.02rem;
}

/* Tabs */
.tabs {
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--hairline);
}

.tabs-inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.95rem;
  color: var(--stone);
  padding: 14px 16px 12px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn[aria-selected="true"] {
  color: var(--forest);
  font-weight: 700;
  border-bottom-color: var(--forest);
}

.tab-btn:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

/* Panels + grid */
main.wrap { padding: 32px 24px 64px; }

.panel { display: none; }
.panel[data-active="true"] { display: block; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

/* Tiles */
.tile {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--forest);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.06), 0 1px 2px rgba(26, 26, 26, 0.04);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  min-height: 168px;
}

.tile.is-soon {
  border-top-color: var(--hairline);
  background: var(--linen);
  box-shadow: none;
  opacity: 0.72;
}

.tile-icon {
  width: 30px;
  height: 30px;
  color: var(--ember);
  margin-bottom: 10px;
}

.tile.is-soon .tile-icon { color: var(--stone); }

.tile-title {
  margin: 0 0 4px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.tile-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--stone);
  flex-grow: 1;
}

.tile-soon-label {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--stone);
  border: 1px solid var(--hairline);
  padding: 2px 8px;
  width: fit-content;
}

.tile-actions {
  margin-top: 14px;
  display: flex;
  gap: 14px;
  border-top: 1px solid var(--hairline);
  padding-top: 12px;
}

.tile-actions a {
  font-size: 0.86rem;
  text-decoration: none;
  color: var(--forest);
  font-weight: 700;
  border-bottom: 1px solid transparent;
}

.tile-actions a:hover,
.tile-actions a:focus-visible {
  border-bottom-color: var(--forest);
}

.tile-actions a.secondary {
  color: var(--stone);
  font-weight: 400;
}

.tile-actions a.secondary:hover,
.tile-actions a.secondary:focus-visible {
  border-bottom-color: var(--stone);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 18px 0 30px;
}

.site-footer p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--stone);
  text-align: center;
}

@media (max-width: 480px) {
  .site-header { padding: 28px 0 20px; }
  .site-header h1 { font-size: 1.6rem; }
  .tile-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .tile { padding: 14px; min-height: 150px; }
}

@media (max-width: 340px) {
  .tile-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* Fiches "plus d'infos" */
.fiche-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.fiche-header {
  background: var(--white);
  border-bottom: 3px solid var(--ember);
  padding: 32px 0 24px;
}

.fiche-header .back {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--stone);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.fiche-header .back:hover { border-bottom-color: var(--stone); }

.fiche-header h1 {
  margin: 0 0 6px;
  color: var(--forest);
  font-size: 1.6rem;
}

.fiche-header .subtitle {
  margin: 0;
  color: var(--stone);
  font-size: 0.95rem;
}

.fiche-summary {
  background: var(--panel);
  border-left: 3px solid var(--ember);
  padding: 18px 22px;
  margin: 28px 0;
  font-size: 1rem;
}

.fiche-summary p { margin: 0 0 10px; }
.fiche-summary p:last-child { margin-bottom: 0; }

.fiche-body {
  padding: 0;
}

.fiche-body h1 {
  color: var(--forest);
  font-size: 1.3rem;
  margin-top: 2.2em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}

.fiche-body h2 {
  color: var(--ember);
  font-size: 1.05rem;
  margin-top: 1.8em;
}

.fiche-body p { margin: 0 0 1em; }
.fiche-body ul, .fiche-body ol { margin: 0 0 1em; padding-left: 1.3em; }
.fiche-body li { margin-bottom: 0.5em; }

.fiche-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0 1.6em;
  font-size: 0.92rem;
}
.fiche-body th, .fiche-body td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.fiche-body th { background: var(--panel); color: var(--forest); }

.fiche-body blockquote {
  background: var(--linen);
  border-left: 3px solid var(--hairline);
  margin: 1em 0;
  padding: 10px 16px;
}

.fiche-toggle {
  margin: 32px 0 40px;
}

.fiche-toggle summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--forest);
  padding: 10px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

/* Admin */
.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.admin-top a {
  font-size: 0.85rem;
  color: var(--stone);
}

.admin-wrap h1 {
  color: var(--forest);
  font-size: 1.5rem;
  margin: 0 0 20px;
}

.admin-wrap h2 {
  color: var(--ember);
  font-size: 1rem;
  margin-top: 34px;
  margin-bottom: 10px;
}

.admin-msg {
  background: var(--panel);
  border-left: 3px solid var(--forest);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.admin-err {
  background: #FBEAEA;
  border-left: 3px solid #B00020;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.admin-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  overflow: hidden;
}

.admin-wrap th, .admin-wrap td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.88rem;
}

.admin-wrap th {
  background: var(--panel);
  color: var(--forest);
  font-weight: 700;
}

.admin-wrap tr:last-child td { border-bottom: none; }

.admin-wrap td a {
  color: var(--forest);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.admin-wrap td a:hover { border-bottom-color: var(--forest); }

.admin-form {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(26, 26, 26, 0.06);
  padding: 22px 24px 26px;
  margin-top: 36px;
}

.admin-form legend {
  padding: 0 8px;
  color: var(--forest);
  font-weight: 700;
}

.admin-form label {
  display: block;
  margin: 14px 0 4px;
  font-size: 0.85rem;
  color: var(--stone);
}

.admin-form input, .admin-form select {
  width: 100%;
  padding: 8px 10px;
  box-sizing: border-box;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
}

.admin-form input:focus, .admin-form select:focus {
  outline: 2px solid var(--ember);
  outline-offset: 1px;
  border-color: var(--ember);
}

.btn {
  display: inline-block;
  padding: 9px 18px;
  background: var(--forest);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
}
.btn:hover { background: #164a2f; }

.btn.danger { background: #B00020; padding: 6px 12px; margin-top: 0; font-weight: 400; }
.btn.danger:hover { background: #8c0019; }

.login-wrap {
  max-width: 320px;
  margin: 100px auto;
  padding: 0 24px;
}

.login-wrap h1 { color: var(--forest); font-size: 1.3rem; }

.login-wrap label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.88rem;
}

.login-wrap input {
  width: 100%;
  padding: 9px 10px;
  box-sizing: border-box;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  font: inherit;
}

/* Sélecteur d'icônes (admin) */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.icon-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 8px 4px 6px;
  cursor: pointer;
  color: var(--stone);
}

.icon-swatch svg {
  width: 20px;
  height: 20px;
}

.icon-swatch span {
  font-size: 0.66rem;
  text-align: center;
  line-height: 1.1;
}

.icon-swatch:hover {
  border-color: var(--ember);
  color: var(--ink);
}

.icon-swatch.is-selected {
  border-color: var(--forest);
  background: var(--panel);
  color: var(--forest);
  font-weight: 700;
}

.icon-picker-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--stone);
}
