/* hyd-place-notebook.css
   The place notebook dialog (#hyd-place-notebook, behaviour in hyd-place-notebook.js): a compact
   Aqua-style window with a compose view (form on the left, review queue and send on the right) and
   a published view (a Leaflet map and report cards). Hooks use the pn- prefix. Colours are literal
   values; the font comes from --desktop-font, defined by other site sheets. */

/* A compact Aqua notebook, sharing the desktop's type and window materials. */
#hyd-place-notebook {
  box-sizing: border-box;
  width: min(960px, calc(100vw - 32px));
  height: min(780px, calc(100dvh - 38px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #626b78;
  border-radius: 9px 9px 5px 5px;
  background: #e9edf1;
  color: #263445;
  box-shadow:
    0 0 0 3px #dce3ec,
    4px 9px 20px #10182180;
  font: calc(13 * var(--px)) var(--desktop-font,Tahoma,sans-serif);
  overflow: hidden;
  text-transform: lowercase;
}

#hyd-place-notebook[open] {
  display: flex;
  flex-direction: column;
}

#hyd-place-notebook::backdrop {
  background: #11172255;
}

#hyd-place-notebook * {
  box-sizing: border-box;
}

/* Script toggles hidden on parts of the notebook; !important stops any display rule below from
   showing them anyway. */
#hyd-place-notebook [hidden] {
  display: none !important;
}

/* --- Shared form controls and text --- */
#hyd-place-notebook :is(button, input, textarea, select) {
  font: inherit;
  color: inherit;
}

#hyd-place-notebook button {
  min-height: 32px;
  padding: 5px 12px;
  border: 1px solid #8794a4;
  border-radius: 4px;
  background: linear-gradient(#fff, #edf2f7 48%, #d7e1ec 49%, #ecf1f7);
  box-shadow:
    inset 0 1px #fff,
    0 1px 2px #31415c30;
  cursor: pointer;
  white-space: normal;
  text-shadow: 0 1px #fff9;
}

#hyd-place-notebook button:hover {
  border-color: #447aa5;
}

#hyd-place-notebook button:disabled {
  opacity: 0.5;
  cursor: default;
}

#hyd-place-notebook :focus-visible {
  outline: 2px solid #387cb8;
  outline-offset: 2px;
}

#hyd-place-notebook :is(input:not([type='checkbox']), textarea, select) {
  width: 100%;
  min-width: 0;
  border: 1px solid #909da9;
  border-radius: 3px;
  background: #fcfdfe;
  padding: 7px;
  box-shadow: inset 0 1px 2px #1d304326;
}

#hyd-place-notebook textarea {
  resize: vertical;
  line-height: 1.5;
}

#hyd-place-notebook label {
  display: block;
  font-size: calc(12 * var(--px));
  font-weight: 600;
}

#hyd-place-notebook label :is(input, textarea, select) {
  display: block;
  margin-top: 5px;
}

#hyd-place-notebook small {
  display: block;
  font-size: calc(11 * var(--px));
  font-weight: 400;
  line-height: 1.45;
  color: #586575;
  margin: 5px 0;
}

#hyd-place-notebook p {
  line-height: 1.5;
  margin: 7px 0 14px;
}

#hyd-place-notebook h3 {
  font-size: calc(15 * var(--px));
  margin: 0 0 10px;
  font-weight: 600;
}

/* --- Titlebar and tabs --- */
#hyd-place-notebook .pn-titlebar {
  flex: none;
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: repeating-linear-gradient(#e4e7ea 0 1px, #d9dde2 1px 2px);
  border-bottom: 1px solid #949eaa;
}

#hyd-place-notebook .pn-titlebar h2 {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin: 0;
}

#hyd-place-notebook [data-pn-close] {
  border-radius: 50%;
  width: 21px;
  min-height: 21px;
  height: 21px;
  padding: 0;
  font-size: 16px;
  line-height: 17px;
  border-color: #976b66;
  background: linear-gradient(#fff0e9, #df9e95);
  color: #613b38;
}

#hyd-place-notebook .pn-title-mark {
  text-align: center;
  font-size: 20px;
}

#hyd-place-notebook .pn-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 12px;
  background: #dce5ef;
  border-bottom: 1px solid #abb9c7;
  flex: none;
}

#hyd-place-notebook .pn-tabs button {
  min-width: 140px;
  border-radius: 0;
  margin-left: -1px;
}

#hyd-place-notebook .pn-tabs button:first-child {
  border-radius: 5px 0 0 5px;
  margin-left: 0;
}

#hyd-place-notebook .pn-tabs button:last-child {
  border-radius: 0 5px 5px 0;
}

#hyd-place-notebook .pn-tabs button[aria-pressed='true'],
#hyd-place-notebook #pn-send {
  background: linear-gradient(#c4e3fb, #6ba4cf 49%, #4d8abd 50%, #a2cbe7);
  border-color: #4b7698;
  color: #183d5a;
}

/* --- Compose view: form on the left --- */
#hyd-place-notebook .pn-scroll {
  min-height: 0;
  overflow: auto;
  flex: 1;
}

#hyd-place-notebook .pn-compose {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
}

#hyd-place-notebook .pn-left {
  padding: 22px;
  border-right: 1px solid #b4bec9;
  background: #f3f5f7;
}

#hyd-place-notebook #pn-form > label {
  margin: 15px 0 5px;
}

#hyd-place-notebook #pn-intro {
  color: #546476;
  font-size: calc(12 * var(--px));
  max-width: 55ch;
}

#hyd-place-notebook .pn-search-row {
  display: flex;
  gap: 6px;
}

#hyd-place-notebook .pn-search-row input {
  flex: 1;
  width: 0;
}

#hyd-place-notebook #pn-results {
  max-height: 170px;
  overflow: auto;
}

#hyd-place-notebook #pn-results button {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 0;
}

#hyd-place-notebook #pn-results strong {
  display: block;
}

#hyd-place-notebook #pn-picker {
  height: 210px;
  margin-top: 10px;
  border: 1px solid #91a0ae;
  background: #d2d8d9;
  isolation: isolate;
}

#hyd-place-notebook .pn-pin-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: calc(11 * var(--px));
}

#hyd-place-notebook .pn-pin-row button {
  font-size: calc(11 * var(--px));
  min-height: 27px;
  padding: 3px 7px;
  flex: none;
}

#hyd-place-notebook details {
  margin: 12px 0;
  border-top: 1px solid #c6ced7;
  padding-top: 10px;
}

#hyd-place-notebook summary {
  cursor: pointer;
  font-size: calc(12 * var(--px));
  font-weight: 600;
}

#hyd-place-notebook details label {
  margin-top: 12px;
}

#hyd-place-notebook .pn-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

#hyd-place-notebook .pn-pair label span {
  font-weight: 400;
  color: #647080;
}

#hyd-place-notebook .pn-actions {
  display: flex;
  gap: 8px;
  margin: 14px 0 0;
  flex-wrap: wrap;
}

#hyd-place-notebook #pn-error {
  border: 1px solid #aa6757;
  background: #f7e5df;
  padding: 10px;
}

/* --- Review queue and send (right column) --- */
#hyd-place-notebook .pn-review {
  padding: 22px 18px;
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
}

#hyd-place-notebook .pn-review h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

#hyd-place-notebook #pn-count {
  font: calc(11 * var(--px)) var(--desktop-font,Tahoma,sans-serif);
  color: #647080;
}

#hyd-place-notebook .pn-queue-help {
  font-size: calc(12 * var(--px));
  color: #556574;
}

#hyd-place-notebook #pn-queue {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  max-height: 38dvh;
  overflow: auto;
}

#hyd-place-notebook #pn-queue li {
  border-top: 1px solid #b9c4ce;
  padding: 12px 0;
  overflow-wrap: anywhere;
}

#hyd-place-notebook #pn-queue p {
  font-size: calc(12 * var(--px));
  white-space: pre-wrap;
}

#hyd-place-notebook #pn-queue button {
  font-size: calc(11 * var(--px));
  min-height: 27px;
  padding: 3px 8px;
}

#hyd-place-notebook .pn-consent {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-weight: 400;
  font-size: calc(11 * var(--px));
  line-height: 1.5;
}

#hyd-place-notebook .pn-consent input {
  margin: 3px 0;
  accent-color: #4c86b4;
}

#hyd-place-notebook #pn-send {
  width: 100%;
  margin-top: 12px;
}

#hyd-place-notebook #pn-send-status {
  font-size: calc(12 * var(--px));
  overflow-wrap: anywhere;
}

/* --- Published view: map and report cards --- */
#hyd-place-notebook .pn-published {
  padding: 16px;
}

#hyd-place-notebook .pn-map-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#hyd-place-notebook .pn-map-tools p {
  margin: 0;
}

#hyd-place-notebook #pn-map {
  height: 330px;
  isolation: isolate;
  border: 1px solid #90a0ad;
  background: #d2d8d9;
}

#hyd-place-notebook #pn-reports {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#hyd-place-notebook .pn-report {
  border: 1px solid #b2bec9;
  background: #fffdf4;
  padding: 13px;
  overflow-wrap: anywhere;
}

#hyd-place-notebook .pn-report p {
  white-space: pre-wrap;
  font-size: calc(12 * var(--px));
}

#hyd-place-notebook .pn-pin {
  display: grid;
  place-content: center;
  width: 28px;
  height: 32px;
  background: #fff5d2;
  color: #3c5d76;
  border: 1px solid #857963;
  box-shadow: 1px 2px 2px #0006;
  font-size: 20px;
  border-radius: 2px;
  transform: rotate(-4deg);
}

#hyd-place-notebook .leaflet-popup-content {
  font-family: var(--desktop-font,Tahoma,sans-serif);
  color: #263445;
}

#hyd-place-notebook .leaflet-popup-content .pn-report {
  border: 0;
  padding: 0;
  background: none;
}

/* --- Footer --- */
#hyd-place-notebook .pn-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  border-top: 1px solid #a8b5c1;
  background: #d5dce4;
  font-size: calc(10 * var(--px));
  color: #4c5b69;
  flex: none;
}

/* The header's motion toggle (.shell .motion) is not part of the notebook. It stays in the DOM, because
   hyd-desktop.js clicks it and hyd-audio-viz.js listens to it, but it is never shown; !important keeps
   it hidden against any other display rule. */
.shell .motion {
  display: none !important;
}

/* --- Narrow screens --- */
@media (max-width: 700px) {
  #hyd-place-notebook {
    width: calc(100vw - 16px);
    height: calc(100dvh - 20px);
  }

  #hyd-place-notebook .pn-tabs {
    padding: 10px;
  }

  #hyd-place-notebook .pn-tabs button {
    min-width: 0;
    flex: 1;
    font-size: calc(11 * var(--px));
    padding: 5px;
  }

  #hyd-place-notebook .pn-compose {
    grid-template-columns: 1fr;
  }

  #hyd-place-notebook .pn-left {
    padding: 16px;
    border-right: 0;
  }

  #hyd-place-notebook .pn-review {
    position: static;
    border-top: 1px solid #aab8c6;
    padding: 16px;
  }

  #hyd-place-notebook #pn-queue {
    max-height: none;
  }

  #hyd-place-notebook #pn-reports {
    grid-template-columns: 1fr;
  }

  #hyd-place-notebook #pn-map {
    height: 280px;
  }

  #hyd-place-notebook .pn-pair {
    gap: 8px;
  }

  #hyd-place-notebook .pn-pin-row {
    flex-wrap: wrap;
  }
}

/* A place can begin with a name; a pin and a media reference stay optional. */
#hyd-place-notebook .pn-unlisted {
  padding: 9px 0 2px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
}

#hyd-place-notebook .pn-unlisted small {
  flex: 1;
  min-width: 180px;
  margin: 0;
}

#hyd-place-notebook .pn-pin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#hyd-place-notebook #pn-locate-later[aria-pressed='true'] {
  background: linear-gradient(#d6edff, #9fc4e1);
  border-color: #5783a4;
  color: #254760;
}

#hyd-place-notebook .pn-attachment {
  margin: 18px 0;
  padding: 13px;
  border: 1px solid #b4c3d0;
  border-radius: 5px;
  background: #e8eff6;
}

#hyd-place-notebook .pn-attachment h4 {
  margin: 0 0 6px;
  font-size: calc(13 * var(--px));
}

#hyd-place-notebook .pn-attachment h4 span {
  font-weight: 400;
  color: #647080;
}

#hyd-place-notebook #pn-file {
  margin-top: 7px;
  padding: 7px;
  background: #f9fbfd;
}

#hyd-place-notebook #pn-file::file-selector-button {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid #8794a4;
  border-radius: 4px;
  background: linear-gradient(#fff, #dbe5f0);
  color: #263445;
  margin-right: 8px;
  cursor: pointer;
}

#hyd-place-notebook #pn-file-preview {
  margin-top: 10px;
  text-align: center;
  border: 1px solid #bac7d2;
  background: #d7e0e7;
  border-radius: 3px;
  overflow: hidden;
}

#hyd-place-notebook #pn-file-preview :is(img, video) {
  display: block;
  max-width: 100%;
  max-height: 190px;
  width: auto;
  height: auto;
  margin: auto;
  object-fit: contain;
}

#hyd-place-notebook #pn-file-status {
  font-size: calc(11 * var(--px));
  overflow-wrap: anywhere;
  margin: 7px 0;
}

#hyd-place-notebook #pn-file-remove {
  font-size: calc(11 * var(--px));
  min-height: 28px;
  padding: 4px 8px;
}

@media (max-width: 700px) {
  #hyd-place-notebook .pn-pin-row {
    align-items: flex-start;
  }

  #hyd-place-notebook .pn-pin-actions {
    justify-content: flex-start;
  }

  #hyd-place-notebook .pn-unlisted {
    display: block;
  }

  #hyd-place-notebook .pn-unlisted small {
    margin-top: 6px;
  }
}

/* --- Media contribution link ---
   The two hidden rules below repeat the !important hidden rule near the top without !important;
   they are redundant but harmless. */
#hyd-place-notebook #pn-contribute-media {
  display: inline-block;
  margin: 8px 0 2px;
  color: #225b87;
  font-size: calc(12 * var(--px));
  font-weight: 600;
  text-underline-offset: 3px;
}

#hyd-place-notebook #pn-contribute-media:focus-visible {
  outline: 2px solid #5b8ab0;
  outline-offset: 3px;
  border-radius: 2px;
}

#hyd-place-notebook #pn-contribute-media[hidden] {
  display: none;
}

#hyd-place-notebook #pn-direct-upload[hidden] {
  display: none;
}

/* Date precision is a separate field, with the same label spacing as its neighbour. */
#hyd-place-notebook #pn-date-precision {
  margin-top: 5px;
  margin-bottom: 12px;
}

#hyd-place-notebook :is(#pn-date-row, #pn-month-row) {
  margin: 0;
}

/* Touch: date, month and time inputs get a 44px minimum height. */
@media (pointer: coarse) {
  #hyd-place-notebook :is(#pn-date, #pn-month, #pn-time) {
    min-height: 44px;
  }
}
