/* Mon Meudon: a quiet civic shell so each app keeps its own identity.
   Layout: header with the address; the week at that address, then the apps;
   an app opens in the main column beside the list of apps. */
:root {
  --ground: #f1f3ef;
  --panel: #ffffff;
  --ink: #19231e;
  --muted: #59655f;
  --line: #d5dcd4;
  --line-soft: #e4e9e3;
  --forest: #2c5b40;
  --on-forest: #ffffff;
  --forest-soft: #e2ebe3;
  --err: #9b1c1c;
  /* the apps' own colours, used in their previews (same in both themes) */
  --app-adresse: #1d3a7a;
  --app-weekend: #ff48b0;
  --app-logement: #f0b40f;
  --lid-menagere: #59636e;
  --lid-selective: #f2c230;
  --lid-alimentaires: #8a5a34;
  --lid-verts: #3f8f4e;
  --lid-encombrants: #8e6ac8;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121714; --panel: #1b221e; --ink: #e7ece8; --muted: #a3ada7; --line: #303b35; --line-soft: #26302a;
    --forest: #3f7a57; --forest-soft: #22332a; --err: #f19999;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #121714; --panel: #1b221e; --ink: #e7ece8; --muted: #a3ada7; --line: #303b35; --line-soft: #26302a;
  --forest: #3f7a57; --forest-soft: #22332a; --err: #f19999;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); }
body { font: 400 15px/1.45 var(--sans); }
h1, h2, h3 { margin: 0; text-wrap: balance; }
a { color: var(--forest); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--forest); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.err { color: var(--err); font-weight: 600; }
.wide { font-stretch: 75%; }

/* ---------------------------------------------------------------- header */
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top-in {
  max-width: 1360px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mark-bg { fill: var(--forest); }
.mark-fg { fill: var(--ground); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 18px; letter-spacing: -0.01em; }
.brand-text small { font-size: 12px; color: var(--muted); }

.where { display: flex; align-items: center; gap: 8px; flex: 1 1 320px; max-width: 460px; min-width: 0; }
.where label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.where-box { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--forest); }
.where-box input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; font-weight: 600; color: var(--ink); }
.where-box input:focus { outline: none; }
.where-box:focus-within { border-color: var(--forest); box-shadow: 0 0 0 2px var(--forest-soft); }
.suggest { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); list-style: none; margin: 0; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); box-shadow: 0 10px 30px rgba(17, 24, 20, 0.14); }
.suggest li { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.suggest li:hover, .suggest li[aria-selected="true"] { background: var(--forest-soft); }
.suggest .none { color: var(--muted); cursor: default; }


/* ---------------------------------------------------------------- frame */
.frame {
  max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start;
  padding-block: 32px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
@media (min-width: 900px) { .frame, .top-in { padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); } }
.view { min-width: 0; display: flex; flex-direction: column; gap: 44px; }
.view:focus { outline: none; }
.loading { color: var(--muted); }

/* ---------------------------------------------------------------- home: the week */
.week { display: flex; flex-direction: column; gap: 18px; }
.week-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.week-head .date { margin: 0 0 6px; color: var(--muted); font-weight: 500; }
.week-head h1 { font-size: clamp(40px, 6vw, 64px); line-height: 0.95; font-weight: 700; font-stretch: 75%; letter-spacing: -0.01em; }
.legend { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.days { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: 8px; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; min-width: 0; }
.day-name { display: flex; flex-direction: column; line-height: 1.05; }
.day-name b { font-size: 26px; font-weight: 700; font-stretch: 75%; white-space: nowrap; }
.day-name small { font-size: 12px; font-weight: 600; color: var(--muted); }
.day-items { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ev .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  .days { grid-template-columns: 1fr; gap: 6px; }
  .day { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; min-height: 0; padding: 12px 14px; }
  .day-name b { font-size: 22px; }
}
.day.today { background: var(--forest); border-color: var(--forest); color: var(--on-forest); }
.day.today .muted, .day.today small { color: var(--on-forest); opacity: 0.85; }
.day.today a { color: var(--on-forest); }
.item { display: flex; gap: 8px; align-items: flex-start; overflow-wrap: anywhere; }
.item small { display: block; color: var(--muted); }
.lid { flex: none; width: 18px; height: 8px; border-radius: 3px; margin-top: 6px; background: var(--lid, var(--muted)); }
.lid.out { background: transparent; border: 2px solid var(--lid, var(--muted)); }
.day.today .lid.alimentaires { --lid: #b9875c; }
.lid.menagere { --lid: var(--lid-menagere); }
.lid.selective { --lid: var(--lid-selective); }
.lid.alimentaires { --lid: var(--lid-alimentaires); }
.lid.verts { --lid: var(--lid-verts); }
.lid.encombrants { --lid: var(--lid-encombrants); }
.dot { flex: none; width: 8px; height: 8px; border-radius: 2px; margin-top: 6px; background: var(--app-weekend); }
.ev b { font-weight: 600; font-variant-numeric: tabular-nums; }
.more { font-size: 13px; font-weight: 600; }
.source { margin: 0; font-size: 13px; color: var(--muted); max-width: 80ch; }

/* ---------------------------------------------------------------- home: tiles */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.section-head h2 { font-size: 34px; font-weight: 700; font-stretch: 75%; }
.section-head p { margin: 0; color: var(--muted); }
.apps, .soon { display: flex; flex-direction: column; gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.tile-preview { height: 196px; padding: 20px 22px; display: flex; flex-direction: column; justify-content: center; gap: 10px; text-decoration: none; }
.tile-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tile-body h3 { font-size: 20px; }
.tile-body p { margin: 0; }
.tile-body .status { font-weight: 600; }
.tile-body .open { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; }

/* the enamel plaque, in Mon adresse's own colours */
.p-adresse { background: #eef1f5; }
.plaque { background: #1d3a7a; border-radius: 12px; padding: 6px; box-shadow: 0 6px 14px rgba(20, 33, 61, 0.18); }
.plaque-in { border: 2px solid #ffffff; border-radius: 8px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; color: #ffffff; font-family: "Barlow Condensed", "Arial Narrow", sans-serif; }
.plaque-num { flex: none; min-width: 46px; height: 46px; padding: 0 6px; border: 2.5px solid #ffffff; border-radius: 999px; display: grid; place-items: center; font-size: 30px; font-weight: 700; }
.plaque-street { display: flex; flex-direction: column; min-width: 0; }
.plaque-street b { font-size: 24px; font-weight: 700; line-height: 1; text-transform: uppercase; overflow-wrap: anywhere; }
.plaque-street span { font-size: 13px; font-weight: 600; }
.lids { display: flex; gap: 6px; }
.lids span { width: 22px; height: 9px; border-radius: 3px; }

/* the riso dates, in Ce week-end's own colours */
.p-weekend { background: #ffffff; color: #3255a4; font-family: "Bricolage Grotesque", "Avenir Next", sans-serif; border-bottom: 1px solid #e8ecf6; gap: 4px; }
.p-weekend .k { font-weight: 700; font-size: 15px; }
.riso { position: relative; display: block; font-weight: 800; font-size: 100px; line-height: 0.86; letter-spacing: -0.055em; white-space: nowrap; }
.riso span { position: absolute; left: 0; top: 0; color: #ff48b0; mix-blend-mode: multiply; transform: translate(4px, 3px) rotate(-0.8deg); }
.p-weekend .c { font-weight: 600; font-size: 14px; }

/* the DPE ladder, in Mon logement's own colours */
.p-logement { background: #ffffff; color: #1f2a37; font-family: "Archivo", "Helvetica Neue", Arial, sans-serif; border-bottom: 1px solid #eceef1; gap: 3px; }
.rung { display: flex; align-items: center; gap: 10px; }
.bar { height: 18px; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); font-weight: 800; font-size: 12px; line-height: 18px; font-stretch: 125%; padding-left: 6px; color: #1f2a37; }
.bar.A, .bar.G { color: #ffffff; }
.rung.none .bar { opacity: 0.3; }
.rung b { font-size: 13px; }
.rung .tag { background: #1f2a37; color: #ffffff; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 3px; white-space: nowrap; }

.soon ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.soon li { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; }
.soon li b { display: block; font-weight: 600; }
.soon li span { color: var(--muted); font-size: 14px; }
.foot { border-top: 1px solid var(--line); padding-top: 18px; font-size: 13px; color: var(--muted); max-width: 80ch; display: flex; flex-direction: column; gap: 6px; }
.foot p { margin: 0; }
.foot code { font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }

/* first visit: no address yet */
.welcome { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.welcome h1 { font-size: clamp(40px, 6vw, 64px); line-height: 0.95; font-weight: 700; font-stretch: 75%; }
.welcome p { margin: 0; color: var(--muted); font-size: 17px; max-width: 60ch; }
.welcome .try { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; font-size: 14px; font-weight: 500; cursor: pointer; }
.pill:hover { border-color: var(--forest); }

/* ---------------------------------------------------------------- app view */
.appview { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.appnav { flex: 1 1 200px; max-width: 230px; display: flex; flex-direction: column; gap: 4px; }
.appnav a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 500; border: 1px solid transparent; }
.appnav a:hover { background: var(--panel); }
.appnav a[aria-current="page"] { background: var(--panel); border-color: var(--line); font-weight: 600; }
.appnav .sq { flex: none; width: 12px; height: 12px; border-radius: 3px; }
.appnav p { margin: 14px 12px 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.appmain { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.app-head h1 { font-size: 40px; line-height: 1; font-weight: 700; font-stretch: 75%; }
.app-head p { margin: 4px 0 0; color: var(--muted); }
.app-links { margin: 0; overflow-wrap: anywhere; }
.app-links:empty { display: none; }
.app-frame { background: #ffffff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; min-height: 320px; }
.app-frame iframe { display: block; width: 100%; height: 320px; border: 0; background: transparent; }
@media (max-width: 760px) {
  .appnav { max-width: none; flex-direction: row; flex-wrap: wrap; flex-basis: 100%; }
  .appnav p { display: none; }
  .appnav a { min-height: 40px; }
}
