/* Private family memory book: system fonts, quiet colours, comfortable reading. */
:root {
  color-scheme:light;
  --paper:#f8f6f1;
  --surface:#fffefa;
  --ink:#292e28;
  --muted:#697063;
  --line:#dedfd4;
  --sage:#465c49;
  --soft:#eaf0e6;
  --error:#8e3f31;
  --serif:"Iowan Old Style","Palatino Linotype",Palatino,Georgia,serif;
  --sans:system-ui,-apple-system,"Segoe UI",sans-serif
}

@media(prefers-color-scheme:dark) {
  :root:not([data-theme=light]) {
    color-scheme:dark;
    --paper:#191d19;
    --surface:#222722;
    --ink:#e9e9df;
    --muted:#b5bbaa;
    --line:#3b4539;
    --sage:#b7cbb2;
    --soft:#2d392c;
    --error:#f0aa99
  }
}

:root[data-theme=dark] {
  color-scheme:dark;
  --paper:#191d19;
  --surface:#222722;
  --ink:#e9e9df;
  --muted:#b5bbaa;
  --line:#3b4539;
  --sage:#b7cbb2;
  --soft:#2d392c;
  --error:#f0aa99
}

* {
  box-sizing:border-box
}

/* Laptops and larger screens read at 18 px; every size in rem grows with it (breakpoints stay in px). */
@media(min-width:1051px) {
  html {
    font-size:112.5%
  }
}

body {
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font:400 1rem/1.6 var(--sans);
  min-height:100vh;
  display:flex;
  flex-direction:column
}

a {
  color:var(--sage);
  text-underline-offset:.24em
}

a:hover {
  text-decoration-thickness:2px
}

button,input,textarea,select {
  font:inherit
}

button,a,input,select,textarea {
  -webkit-tap-highlight-color:transparent
}

button {
  cursor:pointer
}

img,video {
  max-width:100%;
  height:auto;
  display:block
}

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

h1,h2,h3 {
  font-family:var(--serif);
  font-weight:400;
  line-height:1.13;
  overflow-wrap:anywhere
}

h1 {
  font-size:clamp(2.4rem,4vw,4.4rem);
  letter-spacing:-.035em;
  margin-bottom:1rem
}

h2 {
  font-size:1.9rem
}

h3 {
  font-size:1.45rem
}

p {
  overflow-wrap:anywhere
}

a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible {
  outline:3px solid var(--sage);
  outline-offset:4px
}

main:focus {
  outline:none
}

.sr-only {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap
}

.skip {
  position:fixed;
  left:1rem;
  top:-8rem;
  z-index:99;
  padding:1rem;
  background:var(--surface)
}

.skip:focus {
  top:1rem
}

.site-header {
  display:flex;
  align-items:center;
  gap:2rem;
  border-bottom:1px solid var(--line);
  padding:.5rem clamp(1rem,3vw,3.5rem)
}

.brand {
  color:var(--ink);
  text-decoration:none;
  line-height:1.2;
  font:1.25rem var(--serif);
  flex-shrink:0
}

.primary-nav {
  display:flex;
  gap:1.7rem;
  flex:1;
  align-items:center;
  font-size:1rem
}

.primary-nav a {
  text-decoration:none;
  color:var(--muted);
  white-space:nowrap
}

.primary-nav a[aria-current] {
  color:var(--ink);
  text-decoration:underline
}

.primary-nav .nav-external {
  margin-left:auto
}

.header-tools {
  display:flex;
  align-items:center;
  gap:1.1rem;
  margin-left:auto
}

.header-tools form {
  display:flex;
  margin:0
}

.languages {
  display:flex;
  gap:.15rem
}

.languages button {
  border:0;
  background:transparent;
  padding:.55rem .45rem;
  font-size:.85rem;
  color:var(--muted);
  min-height:44px
}

.languages button[aria-current] {
  color:var(--ink);
  text-decoration:underline;
  text-underline-offset:.4rem
}

.theme-button {
  font-size:1.4rem;
  background:transparent;
  border:0;
  color:var(--sage);
  width:44px;
  min-height:44px
}

.text-button {
  background:transparent;
  color:var(--sage);
  border:0;
  text-decoration:underline;
  text-underline-offset:.25em;
  padding:.6rem 0;
  min-height:44px
}

.header-tools .text-button {
  display:inline-flex;
  align-items:center;
  font-size:.9rem
}

.header-tools .text-button[aria-current] {
  color:var(--ink)
}

.button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.7rem;
  min-height:48px;
  padding:.75rem 1.3rem;
  background:var(--sage);
  border:1px solid var(--sage);
  color:var(--paper);
  border-radius:4px;
  text-decoration:none;
  line-height:1.4;
  font-size:1rem;
  font-weight:500
}

.button:hover {
  filter:brightness(.94)
}

.button.secondary {
  background:transparent;
  color:var(--sage)
}

.button.danger {
  color:var(--error);
  border-color:var(--error)
}

/* The button that confirms a permanent deletion. */
.button.danger:not(.secondary) {
  background:var(--error);
  color:var(--paper)
}

.button:disabled {
  opacity:.5;
  cursor:wait
}

.full {
  width:100%
}

.page {
  padding:clamp(1.6rem,4vw,4rem) clamp(1rem,3vw,3.5rem);
  width:100%;
  max-width:156rem;
  margin:0 auto;
  flex:1
}

/* Lists without a visible title start with the search bar right under the header. */
.list-page {
  padding-top:0
}

.list-page .browse-tools {
  border-top:0
}

.list-page .messages {
  padding-top:1rem
}

.narrow {
  max-width:42rem
}

.page-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:2rem;
  margin-bottom:2.5rem
}

.page-heading>div {
  max-width:51rem
}

.page-heading .button {
  flex-shrink:0
}

.page-heading.compact h1 {
  font-size:clamp(2.2rem,3.3vw,3.5rem)
}

.eyebrow {
  text-transform:uppercase;
  letter-spacing:.16em;
  color:var(--muted);
  font-size:.8rem;
  font-weight:600;
  margin-bottom:1.3rem
}

.lead {
  font:1.2rem/1.65 var(--serif);
  max-width:40rem;
  margin-bottom:0;
  color:var(--muted)
}

/* One line: search and date filters, with the count and the add button at the far right. */
.browse-tools {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:.8rem 1rem;
  padding:.8rem 0;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
  margin-bottom:1rem
}

.search {
  display:flex;
  flex:1 1 11rem;
  max-width:32rem
}

.search input {
  min-width:0;
  border-radius:4px 0 0 4px
}

.search button,.filter button {
  border:1px solid var(--line);
  background:var(--surface);
  color:var(--sage);
  padding:.6rem .85rem;
  min-height:44px
}

.search button {
  border-left:0;
  border-radius:0 4px 4px 0
}

.filter {
  display:flex;
  flex-wrap:wrap;
  gap:.4rem;
  align-items:center
}

.clear-filters {
  font-size:.95rem;
  white-space:nowrap
}

.filter select {
  width:auto;
  max-width:16rem
}

.result-count {
  font-size:.88rem;
  color:var(--muted);
  white-space:nowrap
}

/* The count and the add button stay together at the right end of the search bar. */
.bar-end {
  display:flex;
  align-items:center;
  gap:1rem;
  margin-left:auto
}

.add-memory {
  flex-shrink:0
}

/* Memories follow one another across the full width, separated by a fine rule and space. */
.memory-list {
  display:flex;
  flex-direction:column
}

.memory-entry {
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);
  gap:clamp(1.5rem,4vw,4.5rem);
  align-items:center;
  padding:clamp(2rem,4vw,3.5rem) 0;
  border-bottom:1px solid var(--line)
}

.memory-entry:first-child {
  padding-top:1rem
}

.memory-entry:last-child {
  border-bottom:0
}

.text-entry {
  grid-template-columns:minmax(0,1fr)
}

/* The whole photo is always shown, never cropped; very tall ones are limited in height. */
.entry-image {
  position:relative;
  display:block;
  width:fit-content;
  max-width:100%;
  margin:0 auto
}

.entry-image img,.entry-image video {
  display:block;
  max-width:100%;
  /* The width and height attributes give the shape; both stay automatic so a tall photo keeps it. */
  width:auto;
  height:auto;
  max-height:min(75vh,40rem);
  border-radius:4px
}

/* Several photos or videos: one at a time in a frame as tall as the tallest, never cropped. */
.entry-media {
  position:relative;
  width:100%;
  max-width:calc(min(75vh,40rem) * var(--widest,10));
  margin:0 auto
}

.slides {
  display:flex;
  /* An explicit width: otherwise the height limit would narrow the frame through its ratio. */
  width:100%;
  aspect-ratio:var(--tallest,4/3);
  max-height:min(75vh,40rem);
  overflow-x:auto;
  overscroll-behavior-x:contain;
  scroll-snap-type:x mandatory;
  scrollbar-width:none
}

.slides::-webkit-scrollbar {
  display:none
}

.slide {
  position:relative;
  flex:0 0 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  scroll-snap-align:center;
  scroll-snap-stop:always
}

.slide img,.slide video {
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  border-radius:4px
}

.slide-arrow {
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  display:grid;
  place-items:center;
  width:2.75rem;
  height:2.75rem;
  padding:0 0 .2rem;
  border:0;
  border-radius:50%;
  background:#fffdf0e6;
  color:#334333;
  font:1.9rem/1 var(--serif);
  cursor:pointer;
  box-shadow:0 1px 5px rgb(0 0 0 / .3)
}

.slide-arrow[hidden] {
  display:none
}

.slide-arrow.previous {
  left:.6rem
}

.slide-arrow.next {
  right:.6rem
}

.slide-count {
  position:absolute;
  right:.6rem;
  bottom:.6rem;
  padding:.1rem .6rem;
  border-radius:999px;
  background:#1d241dcc;
  color:#f4f2ea;
  font-size:.82rem;
  white-space:nowrap
}

.entry-body {
  max-width:46rem
}

.entry-body h2 {
  font-size:clamp(1.8rem,2.6vw,2.6rem);
  margin-bottom:.9rem
}

.entry-body h2 a {
  color:inherit;
  text-decoration:none
}

.entry-body h2 a:hover {
  text-decoration:underline
}

.entry-context {
  font-size:.82rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:.9rem
}

.excerpt {
  font:1.15rem/1.7 var(--serif);
  color:var(--muted);
  margin-bottom:1.3rem
}

.entry-meta {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:.4rem 1.4rem;
  font-size:.9rem;
  color:var(--muted)
}

.badge {
  display:inline-block;
  background:var(--soft);
  border:1px solid var(--line);
  border-radius:3px;
  padding:.15rem .5rem;
  font-size:.82rem;
  line-height:1.5;
  color:var(--muted)
}


.empty-state {
  grid-column:1/-1;
  text-align:center;
  padding:3rem 1rem 4rem
}

.empty-state h2 {
  margin-bottom:1rem
}

.empty-state p {
  margin:0 auto 2rem;
  color:var(--muted)
}

.pagination {
  display:flex;
  justify-content:center;
  gap:2rem;
  margin-top:2.5rem
}

.welcome {
  display:grid;
  place-items:center;
  width:100%;
  padding:clamp(2.5rem,7vw,7rem) clamp(1rem,5vw,5rem);
  flex:1
}

.login-panel {
  width:100%;
  max-width:28rem;
  background:var(--surface);
  border:1px solid var(--line);
  padding:clamp(1.4rem,3vw,3rem);
  border-radius:5px
}

.login-panel h1 {
  font-size:1.9rem;
  letter-spacing:0
}

.login-panel>p {
  color:var(--muted);
  font-size:1rem
}

.quiet-link {
  display:inline-block;
  margin-top:1.5rem;
  font-size:.95rem
}

label {
  display:block;
  font-size:.95rem;
  font-weight:500;
  margin-bottom:.45rem
}

input:not([type=hidden]),textarea,select {
  display:block;
  width:100%;
  padding:.7rem .8rem;
  background:var(--surface);
  color:var(--ink);
  border:1px solid var(--line);
  border-radius:4px;
  min-height:46px
}

textarea {
  resize:vertical;
  line-height:1.7
}

input[type=file] {
  font-size:.9rem;
  padding:.7rem;
  max-width:100%
}

input::file-selector-button {
  margin-right:.5rem;
  padding:.4rem;
  border:1px solid var(--line);
  border-radius:3px;
  background:var(--soft);
  color:var(--ink)
}

.helptext {
  display:block;
  margin-top:.5rem;
  font-size:.88rem;
  color:var(--muted)
}

ul.errorlist {
  padding:.5rem 1rem .5rem 1.7rem;
  background:var(--soft);
  color:var(--error);
  font-size:.95rem
}

form>p {
  margin-bottom:1.5rem
}

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

.cancel-link {
  margin-left:auto;
  font-size:1rem
}

.danger-link,.error {
  color:var(--error)
}

.privacy-note {
  font-size:.92rem;
  color:var(--muted)
}

/* The editor sits in the middle of the page, heading and form together. */
.editor {
  max-width:48rem;
  margin:0 auto
}

.form-note {
  color:var(--muted);
  font-size:1rem
}

.memory-form textarea[name=story] {
  font:1.2rem/1.7 var(--serif)
}

/* Wide screens: the details on the left, the writing on the right as tall as they are.
   The order for keyboards and screen readers stays the phone order. */
@media(min-width:1100px) {
  .editor {
    max-width:80rem
  }
  .memory-form {
    display:grid;
    grid-template-columns:minmax(0,30rem) minmax(0,1fr);
    grid-template-rows:auto auto auto auto auto 1fr auto auto;
    grid-template-areas:
      "note note"
      "errors errors"
      "title story"
      "media story"
      "date story"
      "place story"
      "privacy privacy"
      "actions actions";
    column-gap:3.5rem
  }
  .memory-form .form-note {
    grid-area:note
  }
  .memory-form>.errorlist {
    grid-area:errors
  }
  .memory-form .title-field {
    grid-area:title
  }
  .memory-form .media-fields {
    grid-area:media
  }
  .memory-form .date-fields {
    grid-area:date
  }
  .memory-form .place-field {
    grid-area:place
  }
  .memory-form .privacy-note {
    grid-area:privacy
  }
  .memory-form .memory-actions {
    grid-area:actions
  }
  .memory-form .story-field {
    grid-area:story;
    display:flex;
    flex-direction:column
  }
  .memory-form textarea[name=story] {
    flex:1;
    min-height:22rem
  }
  .memory-form .file-list {
    grid-template-columns:repeat(auto-fill,minmax(min(100%,10rem),1fr))
  }
  /* “I don’t know” must fit in each date field of the narrower column. */
  .memory-form .date-row {
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:0 .8rem
  }
}

.media-fields .helptext {
  margin-top:.4rem
}

.file-list {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(min(100%,14rem),1fr));
  gap:0 1.5rem;
  margin-bottom:1rem
}

.file-card {
  border-top:1px solid var(--line);
  padding:1.5rem 0;
  margin-top:1rem
}

.file-card img {
  max-height:15rem;
  width:100%;
  object-fit:contain;
  margin-bottom:1rem
}

.filename {
  font-size:.92rem;
  word-break:break-word;
  margin-bottom:.5rem
}

.filename small {
  color:var(--muted)
}

.file-card input[type=number] {
  max-width:6rem
}

.file-card textarea {
  margin-bottom:.7rem
}

.file-card .actions {
  font-size:.9rem
}

.file-card .badge {
  background:var(--surface)
}

.first-choice {
  display:flex;
  align-items:center;
  gap:.5rem;
  font-weight:400;
  margin:.6rem 0 0;
  cursor:pointer
}

.first-choice input[type=radio] {
  display:inline-block;
  width:1.1rem;
  height:1.1rem;
  min-height:0;
  padding:0;
  margin:0;
  accent-color:var(--sage)
}

.notice {
  padding:1rem 1.3rem;
  border-left:3px solid var(--sage);
  background:var(--soft);
  font-size:1rem
}

.notice.error {
  border-color:var(--error)
}

.detail-tools {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  margin-bottom:2.5rem;
  font-size:.95rem
}

.memory-detail {
  max-width:72rem;
  margin:auto
}

.memory-detail>header {
  max-width:48rem;
  margin:1rem auto 3rem;
  text-align:center
}

.memory-detail h1 {
  font-size:clamp(2.3rem,4.5vw,4.8rem)
}

.context {
  color:var(--muted);
  font:1.15rem var(--serif)
}

/* What a deletion would remove, shown before it is confirmed. */
.remove-summary {
  margin:1.5rem 0 2rem;
  padding:1.4rem 0;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line)
}

.remove-summary h2 {
  margin-bottom:.4rem
}

.remove-summary .excerpt {
  margin:1rem 0 0
}

.story {
  max-width:46rem;
  margin:0 auto 3rem;
  font:1.25rem/1.9 var(--serif);
  overflow-wrap:anywhere
}

.memory-media figure {
  margin:0 0 3rem
}

.memory-media img,.memory-media video {
  margin:auto;
  max-height:80vh;
  object-fit:contain
}

.memory-media video {
  width:100%;
  background:#111
}

.memory-media figcaption {
  max-width:46rem;
  margin:1rem auto;
  text-align:center;
  font-size:1rem;
  color:var(--muted)
}

/* Every member can save a shared photo or video to their own device. */
.memory-media .download {
  min-height:40px;
  padding:.45rem 1rem;
  gap:.5rem;
  font-size:.95rem
}

/* Several files on a memory's page: one at a time, at the top, with its number and download button right below it.
   book.js gives the position of the one shown (--item-*), so the arrows stand right beside it. */
.memory-media[data-carousel] {
  position:relative;
  margin:0 auto 3rem
}

/* As tall as the one shown (book.js sets the height); without JavaScript, as the tallest. */
.memory-media .slides {
  align-items:flex-start;
  aspect-ratio:auto;
  max-height:none;
  overflow-y:hidden
}

.memory-media .slide {
  flex-direction:column;
  justify-content:flex-start;
  margin:0
}

.memory-media .slide img,.memory-media .slide video {
  width:auto;
  max-height:80vh;
  margin:0
}

.memory-media .slide-arrow {
  top:var(--item-middle,50%)
}

.memory-media .slide-arrow.previous {
  left:max(.6rem,calc(var(--item-left,0px) - 3.35rem))
}

.memory-media .slide-arrow.next {
  right:auto;
  left:min(calc(100% - 3.35rem),calc(var(--item-right,100%) + .6rem))
}

/* The same photo or video in other memories, linked under its download button. */
.also-in {
  margin:.7rem 0 0;
  font-size:.95rem;
  overflow-wrap:anywhere
}

/* "2 / 4" beside the download button. */
.slide-number {
  margin-right:1rem;
  font-variant-numeric:tabular-nums;
  white-space:nowrap
}

/* Room for the arrows beside a photo or video; on phones they lie on its edges. */
@media(min-width:700px) {
  .memory-media .slide {
    padding:0 3.6rem
  }
}

.download small {
  color:var(--muted);
  font-size:.85rem
}

.member-layout {
  display:grid;
  grid-template-columns:minmax(260px,1fr) 2fr;
  gap:3rem
}

.panel {
  background:var(--surface);
  padding:1.5rem;
  border:1px solid var(--line);
  border-radius:5px;
  align-self:start
}

.member {
  display:flex;
  justify-content:space-between;
  gap:1rem;
  border-bottom:1px solid var(--line);
  padding:1.2rem 0
}

.member p {
  font-size:.9rem;
  color:var(--muted);
  margin-bottom:.5rem
}

.member h3 {
  margin-bottom:.5rem
}

.invitation-link {
  overflow-wrap:anywhere
}

progress {
  display:block;
  width:100%;
  height:1rem;
  margin:.5rem 0;
  accent-color:var(--sage)
}

.upload-row {
  margin-top:1rem;
  font-size:.95rem
}

.upload-row button {
  font-size:.95rem
}

.upload-row p {
  margin-bottom:.4rem
}

.upload-notice p {
  margin:.6rem 0 0;
  padding-left:.7rem;
  border-left:2px solid var(--sage);
  font-size:.9rem;
  overflow-wrap:anywhere
}

/* Dates, recollections and administration. */
.field {
  margin-bottom:1.5rem
}

/* Places of other memories, suggested under the place field. */
.combobox {
  position:relative
}

.suggestions {
  position:absolute;
  z-index:5;
  top:calc(100% + 2px);
  left:0;
  right:0;
  max-height:22rem;
  overflow-y:auto;
  margin:0;
  padding:.25rem 0;
  list-style:none;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:4px;
  box-shadow:0 6px 18px rgb(0 0 0 / .14)
}

.suggestions li {
  padding:.6rem .8rem;
  cursor:pointer;
  overflow-wrap:anywhere
}

.suggestions li:hover,.suggestions li[aria-selected=true] {
  background:var(--soft)
}

.suggestions mark {
  background:none;
  color:inherit;
  font-weight:600
}

fieldset {
  border:1px solid var(--line);
  border-radius:5px;
  padding:1.2rem 1.3rem .3rem;
  margin:0 0 1.8rem;
  min-width:0
}

legend {
  font:1.2rem var(--serif);
  padding:0 .4rem
}

.date-row {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1.5fr) minmax(0,.8fr);
  gap:0 1rem
}

.date-row .field {
  margin-bottom:1rem
}

.section-note {
  color:var(--muted);
  max-width:46rem;
  margin-bottom:1.5rem
}

.recollection-edit[open] {
  flex-basis:100%
}

.recollection-edit summary {
  display:flex;
  align-items:center;
  min-height:44px;
  color:var(--sage);
  cursor:pointer;
  font-size:.95rem
}

.recollection-delete summary {
  color:var(--error)
}

.recollection-delete p {
  margin:.4rem 0 .8rem
}

.recollections {
  max-width:48rem;
  margin:3rem auto 0;
  padding-top:2.2rem;
  border-top:1px solid var(--line)
}

.recollections h2 {
  margin-bottom:1.2rem
}

.recollection {
  padding:1.2rem 0;
  border-bottom:1px solid var(--line)
}

.recollection-meta {
  color:var(--muted);
  font-size:.9rem;
  margin-bottom:.5rem
}

.recollection-text {
  font:1.1rem/1.75 var(--serif);
  overflow-wrap:anywhere
}

.recollection .actions {
  align-items:flex-start;
  font-size:.95rem
}

.recollection-edit textarea {
  margin:.4rem 0 .8rem
}

.recollection-form {
  margin-top:1.8rem
}

.recollection-form textarea {
  font:1.1rem/1.7 var(--serif)
}

.recollection-form .button {
  margin-top:1rem
}

.status-list {
  display:grid;
  gap:.35rem;
  margin:0;
  font-size:.95rem;
  min-width:min(100%,19rem)
}

.status-list div {
  display:flex;
  justify-content:space-between;
  gap:1rem
}

.status-list dt {
  color:var(--muted)
}

.status-list dd {
  margin:0;
  font-weight:600;
  text-align:right
}

.share-panel {
  margin-bottom:2rem
}

.share-panel textarea {
  margin-bottom:.8rem;
  font-size:1rem
}

.member-actions {
  display:flex;
  flex-wrap:wrap;
  gap:0 1.2rem;
  align-items:flex-start
}

@media(max-width:700px) {
  .date-row {
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)
  }
  .date-row .field:last-child {
    grid-column:1/-1
  }
  fieldset {
    padding:1rem .9rem .2rem
  }
  .status-list {
    margin-top:1.4rem
  }
}

/* Below this width the site name, menu and tools do not fit on one line at 18 px (Spanish is longest). */
@media(max-width:1620px) {
  .site-header {
    flex-wrap:wrap;
    gap:.2rem 1.5rem
  }
  .primary-nav {
    order:3;
    flex-basis:100%;
    border-top:1px solid var(--line);
    padding-top:.2rem
  }
}

@media(max-width:1050px) {
  .member-layout {
    gap:1.5rem
  }
}

@media(max-width:700px) {
  .site-header {
    padding:.4rem 1rem;
    gap:.1rem .8rem
  }
  .brand {
    font-size:1.05rem;
    flex-shrink:1;
    min-width:0
  }
  .header-tools {
    gap:.1rem
  }
  .header-tools .text-button {
    max-width:5rem;
    line-height:1.25;
    text-align:center
  }
  .primary-nav {
    flex-wrap:wrap;
    gap:0 1.2rem;
    font-size:.9rem
  }
  .primary-nav a {
    display:inline-flex;
    align-items:center;
    min-height:40px
  }
  .primary-nav .nav-external {
    margin-left:0
  }
  .page-heading {
    display:block;
    margin-bottom:1.8rem
  }
  .page-heading .button {
    margin-top:1.4rem
  }
  .page-heading.compact>a {
    font-size:.95rem
  }
  .lead {
    font-size:1.1rem
  }
  .search {
    max-width:none;
    flex-basis:100%
  }
  .filter {
    flex:1 1 100%
  }
  .filter select {
    flex:1 1 9rem;
    max-width:none
  }
  .bar-end {
    flex-basis:100%;
    flex-wrap:wrap;
    justify-content:flex-end;
    gap:.6rem
  }
  .add-memory {
    flex-basis:100%
  }
  .member-layout {
    display:block
  }
  .login-panel {
    padding:1.5rem
  }
  .memory-detail>header {
    margin-top:0
  }
  .story {
    font-size:1.15rem;
    line-height:1.8
  }
  .empty-state {
    padding:1rem .5rem 3rem
  }
  .member-list {
    margin-top:1.5rem
  }
  .member {
    flex-wrap:wrap
  }
  .memory-entry {
    grid-template-columns:minmax(0,1fr);
    gap:1.2rem;
    padding:2rem 0
  }
  .page-heading.compact h1 {
    margin-bottom:.8rem
  }
}

@media(prefers-reduced-motion:no-preference) {
  a,button {
    transition:background-color .15s ease,color .15s ease
  }
  .memory-media .slides.resizing {
    transition:height .25s ease
  }
}
