:root{font:15px/1.45 Helvetica,Arial,sans-serif;color:#202820;color-scheme:light;--panel:#fffdfa;--line:#dedfd5;--ink:#223227;--accent:#355443}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0}
main,#map{position:absolute;inset:0}
#map{background:#d7e2df;font-family:inherit}
button,input,select,textarea{font:inherit}
button{cursor:pointer;color:inherit}
button:focus-visible,summary:focus-visible{outline:2px solid #4b8663;outline-offset:3px}
.panel,.status,#coords{position:absolute;z-index:500}
h1{font-size:17px;letter-spacing:-.025em;margin:0}
summary{font-weight:700;cursor:pointer;padding:13px 16px}
.layer-list label{display:flex;align-items:center;gap:9px;padding:5px 0;font-size:13px;cursor:pointer}
input[type=checkbox]{width:16px;height:16px;margin:0;accent-color:var(--accent)}
.switch button:hover{background:#e9eee7}
.status{bottom:65px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 110px);text-align:center;padding:9px 13px;font-size:13px}
#coords{bottom:29px;left:12px;padding:3px 7px;font-size:11px;font-variant-numeric:tabular-nums;pointer-events:none}
.leaflet-bottom.leaflet-right .leaflet-control-zoom{margin-bottom:30px;margin-right:18px}
.leaflet-control-scale{margin-left:12px}
.leaflet-control-attribution{max-width:100vw}
.leaflet-container .carnet-marker{display:grid;place-items:center;background:transparent;border:0}
.leaflet-popup-content{width:min(246px,68vw)!important;margin:14px}
.leaflet-popup-content h3{margin:4px 0;font-size:17px}
.leaflet-popup-content p{margin:8px 0;white-space:pre-wrap}
.leaflet-popup-content small{color:#4b5a50}
.photo-button{display:block;border:0;padding:0;background:none;width:100%;margin:8px 0}
.photo-button img{width:100%;height:135px;object-fit:cover;border-radius:7px}
dialog{width:min(92vw,430px);max-height:90dvh;border:1px solid var(--line);border-radius:14px;background:var(--panel);color:inherit;padding:20px;}
dialog::backdrop{background:#1e2f2a65;backdrop-filter:blur(4px)}
form{display:grid;gap:12px}
form header,form footer{display:flex;align-items:center;justify-content:space-between;gap:12px}
form h2{margin:0;font-size:21px}
form label{display:grid;gap:4px;font-size:13px}
form input:not([type=checkbox]),form select,form textarea{width:100%;padding:8px;border:1px solid var(--line);border-radius:6px;background:white;color:inherit}
#error{color:#932b26}
.icon-button,.switch button{position:relative;display:inline-grid;place-items:center;width:36px;height:36px;border:0;border-radius:7px;padding:0;text-decoration:none;color:var(--ink);background:#eef1e9;cursor:pointer}
.icon-button svg,.switch svg,.carnet-marker svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.layer-list:last-child{margin-bottom:0}
.leaflet-container,.leaflet-container.placing{cursor:crosshair}
.leaflet-container.leaflet-dragging,.leaflet-dragging .leaflet-container{cursor:grabbing}
.leaflet-interactive{cursor:pointer}
.leaflet-container .carnet-marker{cursor:pointer}
.popup-actions{display:flex;gap:8px;margin-top:8px}
#confirm-action{border:1px solid var(--line);border-radius:7px;background:#e5ebe1;padding:8px 12px}
#confirm-title{margin:0;font-size:19px}
.leaflet-container.leaflet-dragging,.leaflet-container.leaflet-dragging *{cursor:grabbing!important}
.switch button[aria-pressed=true]{background:#2028200e;color:#202820}
.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:rgba(255,255,255,.94);backdrop-filter:blur(7px)}
.leaflet-popup.oriented-photo .leaflet-popup-tip-container{display:none}
.photo-beam-holder,.photo-beam{pointer-events:none}
.photo-beam{position:absolute;display:block;width:0;height:0;transform-origin:0 0;--photo-beam-length:clamp(75px,15vw,153px)}
.photo-beam::before,.photo-beam::after{content:"";position:absolute;left:0;transform:translateX(-50%)}
.photo-beam::before{
  bottom:6px;width:clamp(30px,7vw,72px);height:var(--photo-beam-length);
  background:linear-gradient(90deg,transparent,#fff6d7bb 40%,#fff6d7bb 60%,transparent);
  clip-path:polygon(50% 100%,0 0,100% 0);
  -webkit-mask-image:linear-gradient(to top,#000 2%,#000a 65%,transparent);
  mask-image:linear-gradient(to top,#000 2%,#000a 65%,transparent)
}
.photo-beam::after{
  bottom:13px;width:2px;height:calc(var(--photo-beam-length) - 16px);
  background:repeating-linear-gradient(to top,#fffbed 0 2px,transparent 2px 8px);
  filter:drop-shadow(0 0 1px #252525b0);
  -webkit-mask-image:linear-gradient(to top,#000 78%,transparent);
  mask-image:linear-gradient(to top,#000 78%,transparent)
}

dialog{background:rgba(255,255,255,.96)}
.leaflet-container.moving-pin,.leaflet-container.moving-pin *{cursor:grabbing!important}
.carnet-marker{touch-action:none}
.leaflet-national-contours-pane{filter:brightness(0) invert(1)}
.leaflet-popup-content p{max-height:22vh;overflow:auto}

.panel .jules-action svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.panel{top:72px;width:max-content;max-width:calc(100vw - 24px);background:#fff;color:#171717;border:1px solid #2223;border-radius:8px}
.panel input[type=checkbox]{accent-color:#222}
.leaflet-container .leaflet-popup-content-wrapper,.leaflet-container .leaflet-popup-tip,.leaflet-container .leaflet-control-layers,.leaflet-container .leaflet-bar{box-shadow:none}

.editing-photo-angle .photo-button{cursor:grab;touch-action:none;user-select:none}
.editing-photo-angle .photo-button:active{cursor:grabbing}
.popup-actions button[aria-pressed=true]{background:#dce5dc}

.panel summary{display:grid;place-items:center;list-style:none;width:36px;height:36px;padding:0;color:#171717;background:#fff;border-radius:7px}
.panel summary::-webkit-details-marker{display:none}
.panel summary svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.panel details[open] summary svg{transform:rotate(180deg)}
.panel .layer-list label{position:relative;padding:6px 8px;border-radius:5px;color:#737773}
.panel .layer-list label:hover{background:#f1f1f1}
.panel .layer-list label:has(input:checked){color:#454846}
.panel .layer-list label:has(input:focus-visible){outline:2px solid #555;outline-offset:1px}
.panel .layer-list label:has(input:disabled){opacity:.45;cursor:default}
.panel .layer-list input{position:absolute;opacity:0;width:1px;height:1px}
@media(pointer:coarse){.panel .layer-list label{min-height:44px}}
.panel .ruler-toggle{display:grid;place-items:center;width:36px;height:36px;margin:5px 0 0;border:1px solid #2223;border-radius:7px;background:#fff;color:#454846}
.ruler-toggle svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}
.panel .ruler-toggle[aria-pressed=true]{background:#454846;color:white}
.ruler-handle{border-radius:50%;background:white;border:2px solid #252525;cursor:grab}
@media(pointer:coarse){.panel .ruler-toggle{width:44px;height:44px}}

.carnet-marker .marker-glyph{display:grid;place-items:center;width:15px;height:15px;border:1px solid white;border-radius:50%;background:#414944;color:white}
.carnet-marker .marker-glyph svg{width:10px;height:10px;stroke-width:2}
.refuge-marker .marker-glyph{background:#fff7e6;color:#244c36;border-color:#244c36}
.photo-marker .marker-glyph{background:#63b5e2;color:#173b50}
.panel .layer-list label{font:400 14px/1.4 Helvetica,Arial,sans-serif}

.ruler-caption{pointer-events:none}
.ruler-caption span{display:block;width:max-content;transform:translate(-50%,-50%);padding:1px 5px;border:1px solid #25252533;border-radius:4px;background:#fff;color:#252525;font:500 12px/1.25 Helvetica,Arial,sans-serif;white-space:nowrap}

.terrain-name-label{display:grid;justify-items:center;gap:2px;width:max-content;transform:translate(-50%,-50%);color:var(--terrain-symbol,#fff);font:400 12px/1.25 Helvetica,Arial,sans-serif;white-space:nowrap;text-shadow:none}
.terrain-name-label svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linejoin:round;stroke-linecap:round}

.panel{width:46px;padding:2px 2px 9px;background:#fff;border:1px solid #2223;max-height:calc(100dvh - 90px)}
.panel .switch,.panel .layer-list{display:grid;grid-template-columns:1fr;justify-items:center;margin:0;padding:0;background:none;border:0}
.panel .switch{padding-bottom:5px;margin-bottom:4px;border-bottom:1px solid #2222}
.panel summary,.panel .ruler-toggle,.panel .switch button,.panel .layer-list label{display:grid;place-items:center;width:40px;height:38px;margin:0;padding:0;border:0;background:none;color:#89928d;border-radius:5px}
.panel .ruler-toggle{margin-top:5px;border-top:1px solid #2222}
.panel .layer-list label{position:relative;min-height:0}
.panel .layer-list label:has(input:checked),.panel .switch button[aria-pressed=true],.panel .ruler-toggle[aria-pressed=true]{color:var(--layer-ink,#4e7367);background:none}
.layer-category{display:grid;place-items:center}
.panel :is(.switch button,.layer-category) svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.45;stroke-linecap:round;stroke-linejoin:round}
.panel :is(label:has(input:checked) svg,button[aria-pressed=true] svg){stroke-width:1.55}
.panel label:has([data-layer="detail"]){--layer-ink:#8c744b}
.panel label:has([data-layer="water"]){--layer-ink:#4b8178}
.panel label:has([data-layer="photos"]){--layer-ink:#507e97}
.panel .layer-list input{inset:0;width:100%;height:100%;cursor:pointer}
@media(pointer:coarse){.panel{width:50px}.panel summary,.panel .ruler-toggle,.panel .switch button,.panel .layer-list label{width:44px;height:44px}}

/* Keep the map modes and ruler reachable when the list exceeds the viewport. */
#map{top:var(--jules-bar-height)}
.panel{
  top:calc(var(--jules-bar-height) + 8px);
  left:max(9px,env(safe-area-inset-left));
  bottom:auto;
  max-height:calc(100dvh - var(--jules-bar-height) - 16px - env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
  align-items:center;
  overflow:visible;
}
.panel .switch,.panel .ruler-toggle{flex:none}
.panel #layers{min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:none}
.panel #layers summary{position:sticky;top:0;z-index:1;background:#fff}
.panel .layer-list label:has(input:focus-visible){outline-offset:-2px}
@media(pointer:coarse){
  .panel .layer-list label{min-height:44px}
  .panel .switch button,.panel .ruler-toggle{touch-action:manipulation}
}
@media(max-height:340px){
  .panel{top:calc(var(--jules-bar-height) + 4px);max-height:calc(100dvh - var(--jules-bar-height) - 8px)}
}

.panel .switch [data-mode="satellite"][aria-pressed=true]{--layer-ink:#60778c}
.panel :is(summary,.ruler-toggle) svg{stroke-width:1.45}
.panel .ruler-toggle[aria-pressed=true] svg{stroke-width:1.55}

.layer-popover{position:fixed;inset:auto;margin:0;width:min(215px,calc(100vw - 16px));max-height:calc(100dvh - 16px);overflow:auto;padding:5px;background:#fff;color:#303833;border:1px solid #c9d2ca;border-radius:7px;font:400 13px/1.4 Helvetica,Arial,sans-serif}
.layer-popover label{position:relative;display:grid;grid-template-columns:19px 1fr;align-items:center;gap:8px;padding:5px 8px;min-height:30px;border-radius:4px;cursor:pointer}
.layer-popover label:has(input:not(:checked)){color:#717873}
.layer-popover label:has(input:not(:checked)) .terrain-filter-symbol{color:#858e88!important}
.layer-popover label:has(input:focus-visible){outline:2px solid #557265;outline-offset:-2px}
.layer-popover label:hover{background:#f2f5f2}
.layer-popover input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.terrain-filter-symbol{display:grid;place-items:center}
.terrain-filter-symbol svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linejoin:round;stroke-linecap:round}
.layer-popover label:has(input:not(:checked)) svg{stroke-width:1}
@media(pointer:coarse){.layer-popover label{min-height:44px}}
.panel label:has([data-layer="detail"]){-webkit-touch-callout:none}

@media(max-width:630px){.leaflet-bottom.leaflet-right .leaflet-control-zoom{margin-right:9px;margin-bottom:42px}}

#photo-field{position:relative}
#photo-field input{position:absolute;width:1px;height:1px;padding:0;opacity:0;pointer-events:none}
#photo-filename{display:block;overflow-wrap:anywhere;font-size:12px}
#save:disabled{opacity:.45}

#editor #save{display:grid;place-items:center;width:32px;height:32px;padding:0;border:1px solid #dedfd5;border-radius:6px;background:#f3f5f1;color:#355443}

#photo-field label{display:grid;place-items:center;width:32px;height:32px;margin:0;border:1px solid #dedfd5;border-radius:6px;background:#f3f5f1;color:#355443}
#photo-field svg,#save svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linejoin:round;stroke-linecap:round}
#photo-field:focus-within label{outline:2px solid #557265;outline-offset:2px}
#photo-filename:empty{display:none}
@media(pointer:coarse){#photo-field label,#editor #save{width:44px;height:44px}}

#entry{width:min(92vw,270px);padding:14px;background:rgba(255,255,255,.86);backdrop-filter:blur(8px)}
#editor{gap:9px}
#editor h2{font-size:17px}

#editor :is(input,textarea)::placeholder,#editor select:has(option[value=""]:checked){color:#6c726e;opacity:1}
#editor #note-toggle{display:grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid #dedfd5;border-radius:6px;background:#f3f5f1;color:#355443}
#editor #note-toggle[aria-expanded=true]{background:#e0e9de}
#editor #note-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linejoin:round;stroke-linecap:round}
@media(pointer:coarse){#editor #note-toggle{width:44px;height:44px}#editor :is(select,textarea,#name){font-size:16px}}
@media(max-width:630px),(pointer:coarse){
  .carnet-marker .marker-glyph{transform:scale(var(--map-icon-scale,1))}
  .terrain-name-label svg{transform:scale(var(--map-icon-scale,1))}
}

#editor .editor-meta{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);justify-items:center;gap:4px;align-items:center}
#editor .editor-meta #save{margin:0}
#editor :is(#note-toggle,#save,#delete-entry,#remove-photo,#photo-field label){display:grid;place-items:center;flex:none;width:min(40px,100%);height:36px;padding:0;border:1px solid #dedfd5;border-radius:6px;background:#f3f5f1;color:#355443}
#editor :is(#delete-entry,#remove-photo) svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
#editor #existing{overflow:hidden;border-radius:6px}
#editor #remove-photo{margin-top:6px}
#editor #thumbnail{display:block;border-radius:6px;width:100%;max-height:none;aspect-ratio:391/220;object-fit:cover}
.pin-selected .marker-glyph{outline:2px solid #86bac6;outline-offset:2px}
@media(pointer:coarse){#editor :is(#note-toggle,#save,#delete-entry,#remove-photo,#photo-field label){width:min(44px,100%);height:44px}}

#editor #photo-field{width:100%;display:grid;justify-items:center}

.layer-popover p{margin:6px 8px}
#editor .photo-date-label{margin:6px 0 3px;color:#56645a}
#editor #photo-date{min-width:0}
.panel label:has([data-layer="photos"]){-webkit-touch-callout:none}

.iceland-overview-tile{filter:sepia(.16) brightness(.96)}

#viewer{position:fixed;inset:0;margin:0;width:100%;height:100%;max-width:none;max-height:none;
  box-sizing:border-box;border:0;border-radius:0;padding:12px;background:transparent;color:white;
  overflow:hidden;overscroll-behavior:contain;touch-action:none;user-select:none}
#viewer[open]{display:grid;grid-template:minmax(0,1fr)/minmax(0,1fr);place-items:center}
.viewer-image-area{display:grid;place-items:center;width:100%;height:100%;min-height:0;overflow:hidden}
#viewer img{display:block;max-width:100%;max-height:100%;min-height:0;box-sizing:border-box;
  object-fit:contain;border:1px solid white;border-radius:3px;pointer-events:none}
#viewer::backdrop{background:#1118;backdrop-filter:blur(12px)}
@media (max-width:700px),(pointer:coarse){
  #viewer{padding-block:max(44px,env(safe-area-inset-top)) max(44px,env(safe-area-inset-bottom))}
}

