/* Browse overview: one shared presentation for the real collection and demo.
   Styles are deliberately scoped to .memory-browse so organizer/review and
   guided-story media remain unchanged. */
#app .memory-browse{
  width:min(1500px,calc(100% - 72px));
  max-width:none;
  margin:0 auto;
  padding:48px 0 42px;
}
#app main:has(.memory-browse)>.collection-summary{display:none}
#app .memory-browse .memory-browse-heading{
  display:flex;align-items:flex-start;justify-content:space-between;gap:25px;margin-bottom:28px;
}
#app .memory-browse-heading h2{
  font-family:"Newsreader",Georgia,serif;
  font-weight:500;font-size:clamp(38px,4.3vw,64px);
  letter-spacing:-.035em;line-height:1.08;color:var(--ink);margin:0 0 13px;
}
#app .memory-browse-heading p{
  font-family:"Newsreader",Georgia,serif;font-style:italic;font-size:clamp(18px,2vw,24px);
  color:var(--ink);margin:0;line-height:1.35;
}
#app .memory-browse-count{padding-top:19px;white-space:nowrap;font-family:"Newsreader",serif;font-size:18px}
#app .memory-browse .collection-tabs,
#app .collection-mockup .memory-browse .collection-tabs{
  position:relative;top:auto;display:flex;align-items:center;flex-wrap:wrap;gap:10px;
  width:100%;margin:0;padding:6px 0 26px;
  border:0;background:transparent;backdrop-filter:none;overflow:visible;
}
#app .memory-browse .collection-tabs .tab{
  display:inline-flex;align-items:center;justify-content:center;
  padding:10px 19px;min-height:42px;margin:0;border:1px solid var(--line);border-radius:999px;
  background:var(--paper)!important;color:var(--ink);letter-spacing:0;text-transform:none;
  font:500 16px/1.3 "Newsreader",Georgia,serif;white-space:nowrap;
}
#app .memory-browse .collection-tabs .tab.active{
  background:var(--ink)!important;color:var(--paper);border-color:var(--ink);
}
#app .memory-browse .collection-tabs .tab.active::after{display:none}
#app .memory-browse .collection-order{
  margin-left:auto;order:0;padding:0;flex:0 0 auto;border:0;
  font:500 13px/1.3 "DM Sans",sans-serif;color:var(--ink);
}
#app .memory-browse .collection-order select{
  border:0;background:transparent;box-shadow:none;min-height:42px;
  padding:7px 20px 7px 5px;color:var(--ink);font-size:13px;
}
#app .memory-browse .story-grid{
  position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  align-items:stretch;column-gap:24px;row-gap:28px;width:100%;max-width:none;
  margin:0;padding:0 0 55px;overflow:visible;
}
#app .memory-browse .story-grid::before{display:none}
#app .memory-browse .story-card.memory-preview-card,
#app .memory-browse .story-card.memory-preview-card[data-story-type]{
  --memory-accent:var(--ochre);--memory-pill:var(--ochre-pale);--memory-ink:var(--ochre-ink);
  display:grid;grid-template-columns:48% minmax(0,1fr);grid-template-rows:minmax(0,1fr);
  grid-column:auto;min-width:0;width:100%;height:320px;min-height:320px;max-height:320px;
  margin:0;padding:0;gap:0;overflow:hidden;position:relative;
  background:var(--paper);border:1px solid var(--line);border-radius:16px;
  box-shadow:0 5px 17px rgba(38,46,41,.055);text-align:left;
}
#app .memory-browse .story-card.memory-preview-card[data-story-type="photo"]{
  --memory-accent:var(--fjord);--memory-pill:var(--fjord-pale);--memory-ink:var(--fjord);
}
#app .memory-browse .story-card.memory-preview-card[data-story-type="audio"]{
  --memory-accent:var(--ochre);--memory-pill:#f8e9bc;--memory-ink:#705015;
}
#app .memory-browse .story-card.memory-preview-card[data-story-type="video"]{
  --memory-accent:var(--falu);--memory-pill:var(--falu-pale);--memory-ink:var(--falu);
}
#app .memory-browse .memory-card-visual{
  position:relative;display:block;grid-column:1;grid-row:1;min-width:0;width:100%;height:100%;
  overflow:hidden;border-radius:15px 0 0 15px;
  background:linear-gradient(150deg,#ccb58f 0%,#ae956c 65%,#806d52 100%);
}
#app .memory-browse .memory-card-visual .memory-cover-image{
  display:block;width:100%;height:100%;max-width:none;min-height:0;
  object-fit:cover;object-position:center;border:0;border-radius:0;
}
#app .memory-browse .memory-card-visual .memory-video-poster{pointer-events:none}
#app .memory-browse .memory-preview-card[data-story-type="audio"] .memory-card-visual{
  background:
    radial-gradient(ellipse at 55% 42%,rgba(240,212,156,.45),transparent 52%),
    linear-gradient(155deg,#816c4b,#c1a575 48%,#8a7149);
}
#app .memory-browse .memory-audio-photo{
  opacity:.45;filter:sepia(.7) saturate(.65) blur(1px);
}
#app .memory-browse .memory-waveform{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  gap:4px;padding:25px 10%;filter:drop-shadow(0 1px 4px rgba(30,21,12,.2))
}
#app .memory-browse .memory-waveform i{width:3px;flex:1 1 2px;max-width:5px;min-height:5px;border-radius:5px;background:#fffdf8;opacity:.97}
#app .memory-browse .memory-preview-card[data-story-type="video"] .memory-card-visual{
  background:linear-gradient(170deg,#9db3b7 0%,#e9c2a3 48%,#708994 49%,#34475c 100%);
}
#app .memory-browse .memory-video-landscape:after{
  content:"";position:absolute;bottom:0;left:36%;width:28%;height:45%;
  background:linear-gradient(170deg,#493a2d,#273a3b);
  clip-path:polygon(46% 0,54% 0,100% 100%,0 100%);opacity:.85;
}
#app .memory-browse .memory-play-symbol{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:66px;height:66px;border:2px solid #fff;border-radius:50%;
  display:grid;place-items:center;padding-left:4px;
  background:rgba(28,35,36,.52);color:white;font-size:29px;line-height:1;
  box-shadow:0 3px 16px rgba(0,0,0,.15);pointer-events:none;
}
#app .memory-browse .memory-cover-badge{
  position:absolute;left:14px;bottom:14px;padding:6px 12px;border-radius:999px;
  background:rgba(31,35,32,.72);color:#fffdf8;font:600 12px/1.2 "DM Sans",sans-serif;
}
#app .memory-browse .memory-preview-card[data-story-type="text"] .memory-card-visual{
  background:
   radial-gradient(ellipse at 0 90%,rgba(255,255,236,.85) 0%,transparent 26%),
   radial-gradient(ellipse at 98% 8%,rgba(35,68,25,.32) 0%,transparent 28%),
   linear-gradient(128deg,#9da884,#d7c9a5 43%,#a4a77c 100%);
}
#app .memory-browse .memory-letter-sheet{
  position:absolute;top:10%;left:17%;width:85%;height:84%;
  padding:32px 22px;overflow:hidden;transform:rotate(8deg);
  background:linear-gradient(120deg,rgba(255,255,255,.35),transparent 36%),#e9dcb9;
  border:1px solid rgba(115,96,66,.3);box-shadow:0 10px 24px rgba(51,38,17,.28);
}
#app .memory-browse .memory-letter-lines{
  display:-webkit-box;-webkit-line-clamp:7;-webkit-box-orient:vertical;overflow:hidden;
  color:#594b36;font:italic 19px/1.55 "Newsreader",Georgia,serif;transform:rotate(-1deg);
}
#app .memory-browse .memory-letter-leaves{
  position:absolute;inset:-12%;background:
    radial-gradient(ellipse at 10% 28%,rgba(42,87,43,.55),transparent 22%),
    radial-gradient(ellipse at 89% 8%,rgba(54,100,49,.5),transparent 25%),
    radial-gradient(ellipse at 16% 95%,rgba(247,234,195,.8),transparent 29%);
  filter:blur(9px);
}
#app .memory-browse .memory-paper-blossoms{
  position:absolute;bottom:4%;left:4%;font-size:45px;line-height:1;color:#fff8e6;
  text-shadow:4px 5px 4px rgba(66,50,18,.23);
}
#app .memory-browse .memory-empty-photo{
  display:grid;place-items:center;height:100%;color:#fffdf8;font-size:80px;
  background:linear-gradient(135deg,var(--fjord),#7791a0);
}
#app .memory-browse .memory-card-copy{
  position:relative;grid-column:2;grid-row:1;min-width:0;min-height:0;
  display:flex;flex-direction:column;align-items:stretch;padding:23px 24px 21px;gap:0;
}
#app .memory-browse .memory-card-copy::before{
  content:"";position:absolute;top:0;left:0;right:0;height:5px;background:var(--memory-accent);
}
#app .memory-browse .memory-card-kind{
  display:flex;align-items:center;gap:8px;
  font:700 12px/1.25 "DM Sans",sans-serif;letter-spacing:.095em;text-transform:uppercase;
  color:var(--memory-ink);margin:0 0 14px;
}
#app .memory-browse .memory-format-icon{flex:none;display:block}
#app .memory-browse .story-card.memory-preview-card h3.memory-card-title{
  grid-column:auto;grid-row:auto;max-width:100%;margin:0 0 6px;
  font:500 clamp(25px,2.35vw,36px)/1.08 "Newsreader",Georgia,serif;
  letter-spacing:-.025em;color:#202b26;text-align:left;
  display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;
}
#app .memory-browse .story-card.memory-preview-card p.memory-card-by{
  grid-column:auto;grid-row:auto;margin:0 0 13px;
  font:400 15px/1.2 "Newsreader",Georgia,serif;color:#343c35;
}
#app .memory-browse .story-card.memory-preview-card p.memory-card-excerpt{
  grid-column:auto;grid-row:auto;display:-webkit-box;-webkit-box-orient:vertical;
  -webkit-line-clamp:3;overflow:hidden;max-width:none;min-height:0;margin:0 0 14px;
  color:#2e342c;font:400 19px/1.32 "Newsreader",Georgia,serif;text-align:left;
  overflow-wrap:anywhere;
}
#app .memory-browse .memory-card-open{
  align-self:flex-end;display:inline-flex;align-items:center;justify-content:center;gap:12px;
  flex:0 0 auto;min-height:39px;margin:auto 0 0;padding:8px 16px;
  background:var(--memory-pill);color:var(--memory-ink);border-radius:999px;
  font:600 15px/1.2 "Newsreader",Georgia,serif;text-decoration:none;white-space:nowrap;
}
#app .memory-browse .memory-card-open:hover,#app .memory-browse .memory-card-open:focus-visible{
  box-shadow:inset 0 0 0 2px var(--memory-accent);outline:2px solid transparent;
}
#app .memory-browse .memory-card-open span{font:500 19px/1 "DM Sans",sans-serif}
#app .memory-browse .empty{font-size:17px;margin:10px 0 35px;padding:55px 25px;text-align:center;border:1px solid var(--line);border-radius:12px}
.memory-detail{max-width:920px;padding:60px 0 110px}
.memory-detail-back{display:inline-block;margin-bottom:40px;color:var(--fjord)}
.memory-detail-kind{display:flex;align-items:center;gap:9px;text-transform:uppercase;letter-spacing:.13em;font:700 12px "DM Sans",sans-serif;color:var(--falu)}
.memory-detail h1{font:500 clamp(42px,5.5vw,74px)/1.07 "Newsreader",Georgia,serif;letter-spacing:-.035em;color:var(--fjord);margin:18px 0}
.memory-detail-by{font:400 19px "Newsreader",Georgia,serif;color:var(--muted);margin:0 0 32px}
.memory-detail-media{max-width:820px;margin:25px 0 42px}
.memory-detail-media .photo-strip.single-photo-frame{aspect-ratio:auto;max-width:820px;width:auto;border:0;background:transparent;overflow:visible}
.memory-detail-media .photo-strip.single-photo-frame img{max-width:100%;width:auto;height:auto;max-height:70vh;object-fit:contain;display:block;margin:auto}
.memory-detail-media .photo-carousel{max-width:820px;width:100%;aspect-ratio:1.45;border-radius:12px}
.memory-detail-media .photo-carousel-img{object-fit:contain}
.memory-detail-media audio,.memory-detail-media video{max-width:100%;width:100%;border-radius:9px}
.memory-detail-body{max-width:790px;color:var(--ink);font:400 clamp(21px,2.6vw,25px)/1.65 "Newsreader",Georgia,serif;overflow-wrap:anywhere}
.memory-detail-body p{white-space:pre-wrap;margin:0 0 25px}
.memory-detail-context{margin:35px 0;padding:20px 26px;border-left:3px solid var(--ochre);background:var(--ochre-pale);font:italic 20px/1.5 "Newsreader",serif}
.memory-detail-return{display:inline-block;margin-top:30px;color:var(--fjord);font-weight:600}

/* Collection browser: one fluid layout system.
   Grid columns are based on the minimum comfortable card width, not the
   viewport type. Individual cards change orientation based on *their own*
   available width. This prevents awkward 462/494 and 921/988 jumps. */
#app .memory-browse{
  width:min(1360px,calc(100% - 36px));
  container-type:inline-size;
  margin:0 auto;
  padding:clamp(28px,4vw,44px) 0 22px;
}
#app .memory-browse .memory-browse-heading{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:7px;
  margin:0 auto 18px;
}
#app .memory-browse-heading h2{
  font-size:clamp(32px,4vw,56px);
  line-height:1.1;
  margin:0;
}
#app .memory-browse-count{
  display:block;
  margin:0;
  padding:0;
  white-space:nowrap;
  color:var(--muted);
  font:500 13px/1.45 "DM Sans",sans-serif;
}
#app .memory-browse .collection-tabs{
  justify-content:center;
  align-items:center;
  gap:8px;
  padding:3px 0 23px;
  margin:0;
}
#app .memory-browse .collection-tabs .tab{
  min-height:42px;
  padding:8px 15px;
  font-size:15px;
}
#app .memory-browse .collection-order{
  flex:0 0 auto;
  margin-left:15px;
  font-size:13px;
}
/* The grid adds a second column only when TWO cards of at least 400px
   genuinely fit, rather than switching abruptly at a device breakpoint. */
#app .memory-browse .story-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:20px;
  align-items:stretch;
  padding:0 0 24px;
}
/* Maximum two editorial columns, enabled by actual available container
   width. Never generate an unexpected third column on wide monitors. */
@container (min-width:820px){
  #app .memory-browse .story-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
#app .memory-browse .story-card.memory-preview-card,
#app .memory-browse .story-card.memory-preview-card[data-story-type]{
  container-type:inline-size;
  display:block;
  min-width:0;
  min-height:0;
  height:auto;
  max-height:none;
  margin:0;
  padding:0;
  overflow:hidden;
}
#app .memory-browse .memory-card-layout{
  display:grid;
  width:100%;
  min-height:0;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:minmax(0,auto) minmax(0,auto);
  align-content:start;
}
/* Narrow cards stack naturally. Media is a stable responsive *frame*;
   uploaded image dimensions never set the dimensions of the card. This thumbnail may crop; detailed media never does. */
#app .memory-browse .memory-card-visual{
  grid-column:1;
  grid-row:1;
  position:relative;
  width:100%;
  height:auto;
  min-height:0;
  aspect-ratio:16/9;
  align-self:start;
  border-radius:15px 15px 0 0;
  overflow:hidden;
}
#app .memory-browse .memory-card-visual > .memory-cover-image{
  position:absolute;
  inset:0;
  display:block;
  width:100%;
  height:100%;
  min-width:0;
  min-height:0;
  max-width:none;
  max-height:none;
  object-fit:cover;
  object-position:50% 35%;
  background:#e8e4d9;
}
/* In a wide-format card, the image panel has enough height to use a
   tasteful, top-biased crop. A narrow card instead shows the whole source. */
#app .memory-browse .memory-card-copy{
  grid-column:1;
  grid-row:2;
  min-width:0;
  min-height:0;
  padding:16px 18px 16px;
}
#app .memory-browse .memory-card-kind{
  margin-bottom:7px;
  font-size:11px;
}
#app .memory-browse .story-card.memory-preview-card h3.memory-card-title{
  display:block;
  overflow:visible;
  -webkit-line-clamp:unset;
  line-clamp:unset;
  overflow-wrap:break-word;
  font-size:clamp(23px,5vw,29px);
  line-height:1.1;
  margin-bottom:5px;
}
#app .memory-browse .story-card.memory-preview-card p.memory-card-by{
  font-size:14px;
  margin-bottom:8px;
}
#app .memory-browse .story-card.memory-preview-card p.memory-card-excerpt{
  display:-webkit-box;
  overflow:hidden;
  -webkit-line-clamp:3;
  line-clamp:3;
  font-size:16px;
  line-height:1.32;
  margin-bottom:10px;
}
#app .memory-browse .memory-card-open{
  min-height:40px;
  padding:8px 13px;
  font-size:14px;
}
#app .memory-browse .memory-play-symbol{
  width:54px;
  height:54px;
  font-size:25px;
}
/* An individual card becomes horizontal only when its own content box is
   wide enough. Both columns share one row and grow together for long text. */
@container (min-width:390px){
  #app .memory-browse .memory-card-layout{
    grid-template-columns:40% minmax(0,1fr);
    grid-template-rows:minmax(242px,auto);
    min-height:242px;
  }
  #app .memory-browse .memory-card-visual{
    grid-column:1;
    grid-row:1;
    height:242px;
    aspect-ratio:auto;
    align-self:start;
    border-radius:15px 0 0 15px;
  }
  #app .memory-browse .memory-card-visual > .memory-cover-image{
    object-fit:cover;
    object-position:50% 28%;
    background:transparent;
  }
  #app .memory-browse .memory-card-copy{
    grid-column:2;
    grid-row:1;
    padding:15px 16px 14px;
  }
  #app .memory-browse .story-card.memory-preview-card h3.memory-card-title{
    font-size:clamp(21px,2.2vw,28px);
  }
  #app .memory-browse .story-card.memory-preview-card p.memory-card-excerpt{
    -webkit-line-clamp:2;
    line-clamp:2;
  }
}
/* Card container rules intentionally override all old media breakpoints. */
@media(max-width:680px){
  #app .memory-browse{
    width:calc(100% - 28px);
    padding:30px 0 20px;
  }
  #app .memory-browse .collection-tabs{gap:7px;padding-bottom:20px}
  #app .memory-browse .collection-tabs .tab{
    padding:8px 12px;
    min-height:40px;
    font-size:14px;
  }
  #app .memory-browse .collection-order{
    flex:1 0 100%;
    margin:8px auto 0;
    justify-content:center;
    order:2;
  }
  #app .memory-browse .story-grid{gap:16px}
}
@media(max-width:380px){
  #app .memory-browse .memory-card-copy{padding:14px}
}
@media(prefers-reduced-motion:reduce){
  #app .memory-browse *{scroll-behavior:auto}
}
.memory-detail{padding:42px 0 70px}
@media(max-width:680px){.memory-detail h1{font-size:42px}}
/* Browse-card labels must not receive the long-form editorial quotation ornament. */
#app .collection-editorial .story-card.memory-preview-card[data-story-type="text"]::before,
#app .story-card.memory-preview-card[data-story-type="text"]::before{
  content:none!important;
  display:none!important;
}
